Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leveldown failing to compile on win 10 #213

Closed
kde99 opened this issue Aug 23, 2015 · 37 comments · Fixed by #249
Closed

Leveldown failing to compile on win 10 #213

kde99 opened this issue Aug 23, 2015 · 37 comments · Fixed by #249

Comments

@kde99
Copy link

kde99 commented Aug 23, 2015

Hello everyone!

I'm trying to install level and it fails at installing leveldown. I have windows 10 and visual studio 2015 (newly installed) also the newest node-gyp (v2.0.2) Nodejs is 0.12.7 my pc is a 64bits system. The headers are not missing and there are placed in the correctly.
npm-debug.log
image
image

@No9
Copy link
Contributor

No9 commented Aug 23, 2015

This looks the same as #196

@ralphtheninja
Copy link
Member

@No9 Thanks for replying to this. I'm completely in the dark when it comes to windows these days.

@kde99
Copy link
Author

kde99 commented Aug 24, 2015

@No9 It can be #196 but I don't understand what was the fix for it back then and also I wanted to let you know that this error is still there even in a newer version.

@No9
Copy link
Contributor

No9 commented Aug 24, 2015

@kde99 So there isn't a solution in #196 :(
I was just flagging it for consistency

Fortunately I installed the Rust plugin for VS 2013 last week and it has completely killed my VS 2013 so I am going to put 2015 on today and see if I can replicate this.

My working assumption at the moment is that there has been a change to the default behavior of VS builds and we are going to need a flag of some sort. (Totally guessing right now but lets see)

@No9
Copy link
Contributor

No9 commented Aug 24, 2015

@kde99 FYI I can now replicate this locally on my VS 2015 install

@ralphtheninja
Copy link
Member

👍

@No9
Copy link
Contributor

No9 commented Aug 25, 2015

Hey @kde99
I made progress on this tonight and as with all good assumptions I got it completely wrong :)

What has happened is M$ have decided to be good citizens and start implementing some of the standard language features so we don't need to supply level implementations anymore.

The immediate workaround is to replace

  #include "stdint-msvc2008.h"
  #define PLATFORM_IS_LITTLE_ENDIAN true
  #define snprintf _snprintf

in /deps/leveldb/port-libuv/port_uv.h
https://github.com/Level/leveldown/blob/master/deps/leveldb/port-libuv/port_uv.h#L29

With

#if _MSC_VER < 1900 
  #include "stdint-msvc2008.h"
#endif
  #define PLATFORM_IS_LITTLE_ENDIAN true
#if _MSC_VER < 1900 
  #define snprintf _snprintf
#endif

And delete this file completely
/deps/leveldb/leveldb-1.18.0/port/win/stdint.h

This should compile for you with a single warning but that should be ok.

c:\leveldown\deps\leveldb\leveldb-1.18.0\db/skiplist.h(360): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size (compiling source file leveldb-1.18.0\db\memtable.cc) [c:\leveldown\deps\leveldb\leveldb.vcxproj]

After I work up the strength to look at gyp config ill try and figure out the best way to manage the exclusion of the win/stdint.h and that bothersome warning then make a pull request.

@thunder7553
Copy link

I have the same problem after installing Visual Studio 2015. Is there anything new on this matter?

@No9
Copy link
Contributor

No9 commented Sep 15, 2015

So I couldn't work out how to determine the actual version of MSVC being used to compile when node-gyp runs under auto select.
i.e. I when build is ran without an explicit MSVC being added at the command line or as an ENV variable.
The above patch should work in the mean time but I will raise a ticket on there to see what those folks have to say.

@barbalex
Copy link

same problem here

this completely blocks building most of my node projects using npm i as they all contain pouchdb which installs leveldown :-(

Somehow this worked on my last windows machine but not on this brand new one.

I had to install VS2015 just for leveldown. If I understand correct, things would work with older versions of VS?

update:
Yep, VS2013 works. Please update your readme and point windows users to VS2013, explicitly not to VS2015.

@No9
Copy link
Contributor

No9 commented Dec 13, 2015

OK Deleted the previous message because I got it wrong and thought 1.4.3 was out
@ralphtheninja can we do a release and then @nolanlawson can bump 1.4.3

@nolanlawson
Copy link

@No9 We use Greenkeeper for PouchDB, so we'll get the new leveldown whenever someone releases it. 😃

@ralphtheninja
Copy link
Member

OK Deleted the previous message because I got it wrong and thought 1.4.3 was out
@ralphtheninja can we do a release and then @nolanlawson can bump 1.4.3

Absolutely. I didn't think we needed a new release, sorry for the inconvenience :)

@ralphtheninja
Copy link
Member

@No9 I'll take this opportunity to bump dependencies as well

@ralphtheninja
Copy link
Member

1.4.3 released, awaiting @mafintosh to push the button for prebuilts

@No9
Copy link
Contributor

No9 commented Dec 14, 2015

OK I can still recreate the issue @barbalex is seeing on the 1.4.3 release.
Looks like this can be a little bit flaky
13e7034#diff-fe74db22d3e05f3e0fb5effc5b4df636R30

If the user sets the environment variable MSVS_VERSION to 2015 then it works as expected
@obastemur Do you have anything to add or should I just update the docs?

Thanks

@raymens
Copy link

raymens commented Dec 23, 2015

I'm still having issues with the MSVS_VERSION set to 2015. Other native libraries are compiling just fine.
image

@ralphtheninja
Copy link
Member

@raymens What OS are you running and which version of leveldown are you trying to install? There should be prebuilt binaries available for most OSes now.

@raymens
Copy link

raymens commented Dec 23, 2015

@ralphtheninja W10 and trying to install latest (1.4.3)

@ralphtheninja
Copy link
Member

@raymens I'm curious why you aren't getting one from https://github.com/Level/leveldown/releases/tag/v1.4.3 .. mind doing npm i leveldown --verbose and posting a gist?

@3tgame
Copy link

3tgame commented Dec 24, 2015

I use Win10 and VS2015, I have the same problem.
After downloaded the Prebuilt binaries, how to use the Prebuilt binaries?
some output of npm i leveldown --verbose are:

npm info lifecycle tar@2.2.1install: tar@2.2.1
install:fstream ▐ ╢█████████████████████████████████████████████npm info lifecycle glob@4.5.3
install: glob@4.5.3
install:tar ▀ ╢█████████████████████████████████████████████npm info lifecycle node-gyp@3.2.1install: node-gyp@3.2.1
install:glob ▌ ╢████████████████████████████████████████████
npm info lifecycle prebuild@2.7.1
install: prebuild@2.7.1
install:node-gyp ▄ ╢████████████████████████████████████████████
npm info lifecycle leveldown@1.4.3~install: leveldown@1.4.3
install:prebuild ▐ ╢█████████████████████████████████████████████

leveldown@1.4.3 install D:\nodeworkspace\vision\node_modules\leveldown
prebuild --download

install:prebuild ▐ ╢█████████████████████████████████████████████prebuild info begin Prebuild version 2.7.1
prebuild info looking for local prebuild @ prebuilds\leveldown-v1.4.3-node-v47-win32-x64.tar.gz
prebuild info not found. downloading...
prebuild WARN install unexpected end of file
prebuild info install We will now try to compile from source.
prebuild verb starting node-gyp process
prebuild verb execute node-gyp with node index.js rebuild --target=v5.2.0 --target_arch=x64
prebuild verb command rebuild []
prebuild verb ok
prebuild verb command clean []
prebuild verb clean removing "build" directory
prebuild verb ok
prebuild verb command configure []
prebuild verb check python checking for Python executable "python2" in the PATH
prebuild verb which failed Error: not found: python2
prebuild verb which failed at F (D:\nodeworkspace\vision\node_modules\which\which.js:78:19)
prebuild verb which failed at E (D:\nodeworkspace\vision\node_modules\which\which.js:87:29)
prebuild verb which failed at D:\nodeworkspace\vision\node_modules\which\which.js:98:16
prebuild verb which failed at FSReqWrap.oncomplete (fs.js:83:15)
prebuild verb which failed python2 [Error: not found: python2]
prebuild verb check python checking for Python executable "python" in the PATH
prebuild verb which succeeded python D:\Python27\python.EXE
prebuild verb check python version D:\Python27\python.EXE -c "import platform; print(platform.python_version());" returned: "2.7.11\r\n"
prebuild verb get node dir no --target version specified, falling back to host node version: 5.2.0
prebuild verb command install [ '5.2.0' ]
prebuild verb install input version string "5.2.0"
prebuild verb install installing version: 5.2.0
prebuild verb install --ensure was passed, so won't reinstall if already installed
prebuild verb install version is already installed, need to check "installVersion"
prebuild verb got "installVersion" 9
prebuild verb needs "installVersion" 9
prebuild verb install version is good
prebuild verb get node dir target node version installed: 5.2.0
prebuild verb build dir attempting to create "build" dir: D:\nodeworkspace\vision\node_modules\leveldown\build
prebuild verb build dir "build" dir needed to be created? D:\nodeworkspace\vision\node_modules\leveldown\build
prebuild verb build/config.gypi creating config file
prebuild verb build/config.gypi writing out config file: D:\nodeworkspace\vision\node_modules\leveldown\build\config.gypi
prebuild verb config.gypi checking for gypi file: D:\nodeworkspace\vision\node_modules\leveldown\config.gypi
prebuild verb common.gypi checking for gypi file: D:\nodeworkspace\vision\node_modules\leveldown\common.gypi
prebuild verb gyp gyp format was not specified; forcing "msvs"
prebuild info spawn D:\Python27\python.EXE
prebuild info spawn args [ 'D:\nodeworkspace\vision\node_modules\node-gyp\gyp\gyp_main.py',
prebuild info spawn args 'binding.gyp',
prebuild info spawn args '-f',
prebuild info spawn args 'msvs',
prebuild info spawn args '-G',
prebuild info spawn args 'msvs_version=auto',
prebuild info spawn args '-I',
prebuild info spawn args 'D:\nodeworkspace\vision\node_modules\leveldown\build\config.gypi',
prebuild info spawn args '-I',
prebuild info spawn args 'D:\nodeworkspace\vision\node_modules\node-gyp\addon.gypi',
prebuild info spawn args '-I',
prebuild info spawn args 'C:\Users\evevision.node-gyp\5.2.0\include\node\common.gypi',
prebuild info spawn args '-Dlibrary=shared_library',
prebuild info spawn args '-Dvisibility=default',
prebuild info spawn args '-Dnode_root_dir=C:\Users\evevision.node-gyp\5.2.0',
prebuild info spawn args '-Dnode_gyp_dir=D:\nodeworkspace\vision\node_modules\node-gyp',
prebuild info spawn args '-Dnode_lib_file=node.lib',
prebuild info spawn args '-Dmodule_root_dir=D:\nodeworkspace\vision\node_modules\leveldown',
prebuild info spawn args '--depth=.',
prebuild info spawn args '--no-parallel',
prebuild info spawn args '--generator-output',
prebuild info spawn args 'D:\nodeworkspace\vision\node_modules\leveldown\build',
prebuild info spawn args '-Goutput_dir=.' ]
prebuild verb ok
prebuild verb command build []
prebuild verb build type Release
prebuild verb architecture x64
prebuild verb node dev dir C:\Users\evevision.node-gyp\5.2.0
prebuild verb found first Solution file build/binding.sln
prebuild verb could not find "msbuild.exe" in PATH - finding location in registry
prebuild verb "Release" dir needed to be created? null
prebuild verb copying "node.lib" for x64 C:\Users\evevision.node-gyp\5.2.0\Release\node.lib
prebuild info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
prebuild info spawn args [ 'build/binding.sln',
prebuild info spawn args '/nologo',
prebuild info spawn args '/p:Configuration=Release;Platform=x64' ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
生成启动时间为 2015/12/24 14:52:21。
节点 1 上的项目“D:\nodeworkspace\vision\node_modules\leveldown\build\binding.sln”(默认目标)。
ValidateSolutionConfiguration:
正在生成解决方案配置“Release|x64”。
项目中不存在 BeforeTargets 特性中的“C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets (186,61)”位置列出的目标“Befor
eGenerateProjectPriFile”,将忽略该目标。
项目“D:\nodeworkspace\vision\node_modules\leveldown\build\binding.sln”(1)正在节点 1 上生成“D:\nodeworkspace\vision\node_modules
leveldown\deps\leveldb\leveldb.vcxproj”(2) (默认目标)。
PrepareForBuild:
正在创建目录“Release\obj\leveldb\”。
正在创建目录“D:\nodeworkspace\vision\node_modules\leveldown\build\Release\”。
正在创建目录“Release\obj\leveldb\leveldb.tlog\”。
InitializeBuildStatus:
正在创建“Release\obj\leveldb\leveldb.tlog\unsuccessfulbuild”,因为已指定“AlwaysCreate”。
ClCompile:
E:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\CL.exe /c /I"C:\Users\evevision.node-gyp\5.2.0\incl
ude\node" /I"C:\Users\evevision.node-gyp\5.2.0\src" /I"C:\Users\evevision.node-gyp\5.2.0\deps\uv\include" /I"C:\Use
rs\evevision.node-gyp\5.2.0\deps\v8\include" /I"leveldb-1.18.0" /I"leveldb-1.18.0\include" /I"port-libuv" /I"..\snap
py\snappy-1.1.1" /Zi /nologo /W3 /WX- /Ox /Ob2 /Oi /Ot /Oy /GL /D NODE_GYP_MODULE_NAME=leveldb /D WIN32 /D _CRT_SECUR
E_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _HAS_EXCEPTIONS=0 /D BUILDING_V8_SHARED=1 /D BUILDING_UV_SHARED=1 /D S
NAPPY=1 /D LEVELDB_PLATFORM_UV=1 /D NOMINMAX=1 /GF /Gm- /EHa /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inl
ine /GR- /Fo"Release\obj\leveldb" /Fd"Release\obj\leveldb\leveldb.pdb" /Gd /TP /wd4355 /wd4530 /wd4267 /wd4244 /wd4
351 /wd4355 /wd4800 /wd4251 /errorReport:queue /MP "leveldb-1.18.0\db\builder.cc" "leveldb-1.18.0\db\db_impl.cc" "lev
eldb-1.18.0\db\db_iter.cc" "leveldb-1.18.0\db\filename.cc" "leveldb-1.18.0\db\dbformat.cc" "leveldb-1.18.0\db\leveldb
_main.cc" "leveldb-1.18.0\db\log_reader.cc" "leveldb-1.18.0\db\log_writer.cc" "leveldb-1.18.0\db\memtable.cc" "leveld
b-1.18.0\db\repair.cc" "leveldb-1.18.0\db\table_cache.cc" "leveldb-1.18.0\db\version_edit.cc" "leveldb-1.18.0\db\vers
ion_set.cc" "leveldb-1.18.0\db\write_batch.cc" "leveldb-1.18.0\helpers\memenv\memenv.cc" "leveldb-1.18.0\table\block.
cc" "leveldb-1.18.0\table\block_builder.cc" "leveldb-1.18.0\table\filter_block.cc" "leveldb-1.18.0\table\format.cc" "
leveldb-1.18.0\table\iterator.cc" "leveldb-1.18.0\table\merger.cc" "leveldb-1.18.0\table\table.cc" "leveldb-1.18.0\ta
ble\table_builder.cc" "leveldb-1.18.0\table\two_level_iterator.cc" "leveldb-1.18.0\util\arena.cc" "leveldb-1.18.0\uti
l\bloom.cc" "leveldb-1.18.0\util\cache.cc" "leveldb-1.18.0\util\coding.cc" "leveldb-1.18.0\util\comparator.cc" "level
db-1.18.0\util\crc32c.cc" "leveldb-1.18.0\util\env.cc" "leveldb-1.18.0\util\filter_policy.cc" "leveldb-1.18.0\util\ha
sh.cc" "leveldb-1.18.0\util\logging.cc" "leveldb-1.18.0\util\options.cc" "leveldb-1.18.0\util\status.cc" "port-libuv
port_uv.cc" "port-libuv\env_win.cc" "port-libuv\win_logger.cc"
db_impl.cc
builder.cc
db_iter.cc
filename.cc
d:\nodeworkspace\vision\node_modules\leveldown\deps\leveldb\port-libuv\stdint-msvc2008.h(105): error C2371: “int_fast16
_t”: 重定义;不同的基类型 (编译源文件 leveldb-1.18.0\db\filename.cc)d:\nodeworkspace\vision\node_modules\leveldown\deps\leveldb\port-l
ibuv\stdint-msvc2008.h(105): error C2371: “int_fast16_t”: 重定义;不同的基类型 (编译源文件 leveldb-1.18.0\db\db_impl.cc)d:\nodeworkspa
ce\vision\node_modules\leveldown\deps\leveldb\port-libuv\stdint-msvc2008.h(105): error C2371: “int_fast16_t”: 重定义;不同的基类
型 (编译源文件 leveldb-1.18.0\db\builder.cc) [D:\nodeworkspace\vision\node_modules\leveldown\deps\leveldb\leveldb.vcxproj]

@ralphtheninja
Copy link
Member

It seems there is a problem with leveldown-v1.4.3-node-v47-win32-x64.tar.gz which does exist. The error we get is unexpected end of file.

@No9 Any idea what's going on?

@BrokenR3C0RD
Copy link

I have the same problem as Raymens, but I'm on x86. My problem seems to arise because of no ia32 build existing. Pretty sure you could just use the x86 compilation, just have a copy named leveldown-v1.4.3-node-v47-win32-ia32.tar.gz
_EDIT:_ There is no ia32 or x86 build for 1.4.3 it seems. Is this on purpose?

@ralphtheninja
Copy link
Member

I have the same problem as Raymens, but I'm on x86. My problem seems to arise because of no ia32 build existing. Pretty sure you could just use the x86 compilation, just have a copy named leveldown-v1.4.3-node-v47-win32-ia32.tar.gz
EDIT: There is no ia32 or x86 build for 1.4.3 it seems. Is this on purpose?

The only purpose is that it was never built

@BrokenR3C0RD
Copy link

I have the same problem as Raymens, but I'm on x86. My problem seems to arise because of no ia32 build existing. Pretty sure you could just use the x86 compilation, just have a copy named leveldown-v1.4.3-node-v47-win32-ia32.tar.gz
EDIT: There is no ia32 or x86 build for 1.4.3 it seems. Is this on purpose?

The only purpose is that it was never built

Well, will this bug be fixed soon?

@ralphtheninja
Copy link
Member

Well, will this bug be fixed soon?

Technically it's not a bug since you can compile the code yourself (assuming your environment is setup for this).

@No9 @mafintosh We had ia32 builds for 1.4.2 but it seems they aren't available for 1.4.3. Can anyone of you fix this?

@No9
Copy link
Contributor

No9 commented Jan 3, 2016

Sorry @ralphtheninja long story but my 32 builder has died and I won't have another win machine for a while.

@ralphtheninja
Copy link
Member

Sorry @ralphtheninja long story but my 32 builder has died and I won't have another win machine for a while.

Ok! No worries :) Anyone that would like to help out with this?

@realjesset
Copy link

Having the same problems as others here, whenever I try npm install leveldown it gives me the same error which was showed by @raymens

@obastemur
Copy link
Contributor

Sorry, somehow missed this one. I'm on it

obastemur added a commit to obastemur/leveldown that referenced this issue Jan 24, 2016
Most probably also fixes Level#213
obastemur added a commit to obastemur/leveldown that referenced this issue Jan 24, 2016
Most probably also fixes Level#213
@obastemur obastemur mentioned this issue Jan 24, 2016
@ralphtheninja
Copy link
Member

@kde99 @thunder7553 @barbalex @raymens @TheGoGlider

Can you guys make sure you can compile the code now?

@raymens
Copy link

raymens commented Jan 25, 2016

@ralphtheninja @obastemur yes, I've just compiled Leveldown@1.4.1. Thanks!

@ralphtheninja
Copy link
Member

Released in 1.4.4

@raymens
Copy link

raymens commented Jan 25, 2016

Oops, my bad. It is indeed 1.4.4 :)

@kraihn
Copy link

kraihn commented Jan 25, 2016

@ralphtheninja, I'm not sure who to contact, but the win32 prebuilt files haven't been uploaded to the release for 1.4.4 in GitHub. I'm having issues on my build server because it can't download non-existent files.

@ralphtheninja
Copy link
Member

@kraihn I just built them. Try again please.

@kraihn
Copy link

kraihn commented Jan 25, 2016

@ralphtheninja, it's working again. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.