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

Install fails on Windows/MSVC #63

Open
iatzmon opened this issue Aug 10, 2021 · 4 comments · May be fixed by #65
Open

Install fails on Windows/MSVC #63

iatzmon opened this issue Aug 10, 2021 · 4 comments · May be fixed by #65
Labels
enhancement New feature or request

Comments

@iatzmon
Copy link

iatzmon commented Aug 10, 2021

Running npm install in an empty project yields the following output:

C:\dev\jsonnet-test>npm install @hanazuki/node-jsonnet

> @hanazuki/[email protected] install C:\dev\jsonnet-test\node_modules\@hanazuki\node-jsonnet
> cmake-js build --CDCMAKE_EXPORT_COMPILE_COMMANDS=1

[
  'C:\\Program Files\\nodejs\\node.exe',
  'C:\\dev\\jsonnet-test\\node_modules\\cmake-js\\bin\\cmake-js',
  'build',
  '--CDCMAKE_EXPORT_COMPILE_COMMANDS=1'
]
info TOOL Using Visual Studio 16 2019 generator.
info CMD CONFIGURE
info RUN [
info RUN   'cmake',
info RUN   'C:\\dev\\jsonnet-test\\node_modules\\@hanazuki\\node-jsonnet',
info RUN   '--no-warn-unused-cli',
info RUN   '-G',
info RUN   'Visual Studio 16 2019',
info RUN   '-A',
info RUN   'x64',
info RUN   '-DCMAKE_JS_VERSION=6.2.1',
info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=C:\\dev\\jsonnet-test\\node_modules\\@hanazuki\\node-jsonnet\\build',
info RUN   '-DCMAKE_JS_INC=<REDACTED>\\.cmake-js\\node-x64\\v14.17.0\\include\\node',
info RUN   '-DCMAKE_JS_SRC=C:/dev/jsonnet-test/node_modules/cmake-js/lib/cpp/win_delay_load_hook.cc',
info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=14.17.0',
info RUN   '-DNODE_ARCH=x64',
info RUN   '-DCMAKE_JS_LIB=<REDACTED>\\.cmake-js\\node-x64\\v14.17.0\\win-x64\\node.lib',
info RUN   '-DCMAKE_EXPORT_COMPILE_COMMANDS=1',
info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=/DELAYLOAD:NODE.EXE'
info RUN ]
Not searching for unused variables given on the command line.
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.29.30040.0
-- The CXX compiler identification is MSVC 19.29.30040.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at third_party/jsonnet/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Error at third_party/jsonnet/CMakeLists.txt:43 (message):
  Compiler MSVC not supported


-- Configuring incomplete, errors occurred!
See also "C:/dev/jsonnet-test/node_modules/@hanazuki/node-jsonnet/build/CMakeFiles/CMakeOutput.log".
ERR! OMG Process terminated: 1
npm WARN @hanazuki/[email protected] requires a peer of @types/node@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @hanazuki/[email protected] install: `cmake-js build --CDCMAKE_EXPORT_COMPILE_COMMANDS=1`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @hanazuki/[email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     <REDACTED>\AppData\Roaming\npm-cache\_logs\2021-08-10T14_14_02_481Z-debug.log
@hanazuki
Copy link
Owner

hanazuki commented Aug 11, 2021

Thanks for your report. This library currently does not support Windows build as our dependency libjsonnet does not so.
They have an open issue for Windows support that you might help resolve: google/jsonnet#734

@hanazuki
Copy link
Owner

That error comes from this line https://github.com/google/jsonnet/blob/108e5d7ba7de3dfa42468461acbb3b1385aed629/CMakeLists.txt#L42 and I think the expected fix is only to set up the compiler-specific command line options for MSVC.

@hanazuki hanazuki linked a pull request Aug 11, 2021 that will close this issue
@hanazuki
Copy link
Owner

hanazuki commented Aug 11, 2021

Started some trial and error at #65. It would be appreciated if you could help debug it :)

@iatzmon
Copy link
Author

iatzmon commented Aug 11, 2021

Thanks for the quick response, much appreciated!

The build succeeds now when installing the package but when I try to use it I get the following error:

Error: The specified module could not be found.
\\?\C:\Users\itama\dev\jsonnet-test\node_modules\@hanazuki\node-jsonnet\build\Release\node-jsonnet.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1131:18)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at bindings (C:\Users\itama\dev\jsonnet-test\node_modules\bindings\bindings.js:112:48)
    at Object.<anonymous> (C:\Users\itama\dev\jsonnet-test\node_modules\@hanazuki\node-jsonnet\lib\index.js:2:36)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)

The node-jsonnet.node file does exist in the module's folder

I uploaded my test repo to https://github.com/Osherg/jsonnet-test

@hanazuki hanazuki changed the title Install fails on Windows 10 Install fails on Windows/MSVC Aug 20, 2021
@hanazuki hanazuki added the enhancement New feature or request label Dec 1, 2021
@hanazuki hanazuki linked a pull request Dec 2, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants