addaleax / lzma-native

Node.js interface to the native liblzma compression library (.xz file format, among others)
MIT License
105 stars 37 forks source link

Issue building for electron on windows #51

Closed njanke96 closed 6 years ago

njanke96 commented 6 years ago

I can't seem to get this module to build on windows. I'm being told 'lib.exe' is not found.

An unhandled error occurred inside electron-rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@8.2.0 | win32 | x64
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10\\<(target_arch)\\iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  build
  'lib.exe' is not recognized as an internal or external command,
  operable program or batch file.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\lzma-native\build\liblzma.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1.7.10" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=lzma_native" "--module_path=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\binding-v3.0.4-electron-v1.7-win32-x64" "--host=https://node-pre-gyp.addaleax.net" "--remote_path=./lzma-native/"
gyp ERR! cwd C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\lzma-native
gyp ERR! node -v v8.2.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

Failed with exit code: 1

Error: gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@8.2.0 | win32 | x64
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10\\<(target_arch)\\iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  build
  'lib.exe' is not recognized as an internal or external command,
  operable program or batch file.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\lzma-native\build\liblzma.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1.7.10" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=lzma_native" "--module_path=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\binding-v3.0.4-electron-v1.7-win32-x64" "--host=https://node-pre-gyp.addaleax.net" "--remote_path=./lzma-native/"
gyp ERR! cwd C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\lzma-native
gyp ERR! node -v v8.2.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

Failed with exit code: 1
    at SafeSubscriber._error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\spawn-rx\lib\src\index.js:277:84)
    at SafeSubscriber.__tryOrUnsub (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:239:16)
    at SafeSubscriber.error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:198:26)
    at Subscriber._error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:129:26)
    at Subscriber.error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:103:18)
    at MapSubscriber.Subscriber._error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:129:26)
    at MapSubscriber.Subscriber.error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:103:18)
    at SafeSubscriber._next (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\spawn-rx\lib\src\index.js:251:65)
    at SafeSubscriber.__tryOrUnsub (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:239:16)
    at SafeSubscriber.next (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:186:22)
addaleax commented 6 years ago

Hm – This might be happening because you don’t have a compiler toolchain installed? Does https://www.npmjs.com/package/windows-build-tools help you?

njanke96 commented 6 years ago

I installed Windows build tools before and the error was something along the lines of 'Windoes 8.1 SDK not found' so I installed that and the error became this. When installing the SDK I selected all available features so I'm not sure how an executable could be missing..

addaleax commented 6 years ago

Weird … I’m sorry, I’m not usually a Windows developer, but I’ll give my best to help.

Have you tried something along the lines of downloading Visual Studio Community edition & installing the Desktop C++ Development package? (https://www.visualstudio.com/downloads/) That would be my next attempt :/

The error here says lib.exe wasn’t found but that should really be something that is included in a compiler toolchain for Windows…

njanke96 commented 6 years ago

Me neither actually, and I had no problems getting the module to build on linux, unfortunately I need to support windows in my app.

I have a lot of visual studio/build/windows sdk crap installed, I'll try removing everything and installing the latest visual studio, as well as other things until I get it to work. I'll update this thread.

njanke96 commented 6 years ago

I removed everything and only installed VS2017 with the desktop c++ package and it worked, guess my environment was just too bloated... Thanks for the help!