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

How to force the usage of $C $CXX environment when building, or else to specify compilers manually from command line? #2316

Closed
Animeshz opened this issue Jan 25, 2021 · 3 comments

Comments

@Animeshz
Copy link

  • Node Version: 14.15.4
  • Platform: Linux ccff68f8f312 4.19.128-microsoft-standard Make 0.6.x work #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 GNU/Linux
  • Compiler: The one issue is created for, cc -v -> 6.3.0, while $CXX -> 10.2.0
  • Module: node-addon-api
Verbose output (from npm or node-gyp):
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 3.5.3 found at "/usr/bin/python3"
gyp http GET https://nodejs.org/download/release/v14.15.4/node-v14.15.4-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v14.15.4/node-v14.15.4-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v14.15.4/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v14.15.4/SHASUMS256.txt
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/work/project/keyboard-kt/src/jsMain/cpp/windows/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.cache/node-gyp/14.15.4/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/14.15.4',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/14.15.4/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/work/project/keyboard-kt/src/jsMain/cpp/windows',
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   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Warning: File 'KeyboardKtWindowsX64.target.mk' has modification time 0.34 s in the future
make: Entering directory '/work/project/keyboard-kt/src/jsMain/cpp/windows/build'
  CXX(target) Release/obj.target/KeyboardKtWindowsX64/JsKeyboardHandler.o
In file included from /work/support-files/headers/node-addon-api/napi.h:2636,
                 from ../JsKeyboardHandler.cpp:1:
/work/support-files/headers/node-addon-api/napi-inl.h: In instantiation of 'static void Napi::details::ThreadSafeFinalize<ContextType, Finalizer, FinalizerDataType>::FinalizeFinalizeWrapperWithDataAndContext(napi_env, void*, void*) [with ContextType = std::nullptr_t; Finalizer = long long int; FinalizerDataType = void; napi_env = napi_env__*]':
/work/support-files/headers/node-addon-api/napi-inl.h:4661:11:   required from 'static Napi::TypedThreadSafeFunction<ContextType, DataType, CallJs> Napi::TypedThreadSafeFunction<ContextType, DataType, CallJs>::New(napi_env, const Napi::Function&, ResourceString, size_t, size_t, ContextType*, Finalizer, FinalizerDataType*) [with ResourceString = const char*; Finalizer = long long int; FinalizerDataType = void; ContextType = std::nullptr_t; DataType = EventData; void (* CallJs)(Napi::Env, Napi::Function, ContextType*, DataType*) = EmitEventToJs; napi_env = napi_env__*; size_t = long long unsigned int]'
../JsKeyboardHandler.cpp:68:102:   required from here
/work/support-files/headers/node-addon-api/napi-inl.h:255:27: error: expression cannot be used as a function
  255 |     finalizeData->callback(Env(env), finalizeData->data,
      |     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  256 |         static_cast<ContextType*>(rawContext));
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /work/support-files/headers/node-addon-api/napi.h:2636,
                 from ../JsKeyboardHandler.cpp:1:
/work/support-files/headers/node-addon-api/napi-inl.h: In instantiation of 'static Napi::Value Napi::details::vf_fallback<T>::From(napi_env, const T&) [with T = void (*)(const Napi::CallbackInfo&); napi_env = napi_env__*]':
/work/support-files/headers/node-addon-api/napi-inl.h:1079:22:   required from 'static Napi::Value Napi::Value::From(napi_env, const T&) [with T = void (*)(const Napi::CallbackInfo&); napi_env = napi_env__*]'
/work/support-files/headers/node-addon-api/napi-inl.h:1253:66:   required from 'void Napi::Object::Set(const char*, const ValueType&) [with ValueType = void (*)(const Napi::CallbackInfo&)]'
../JsKeyboardHandler.cpp:77:30:   required from here
/work/support-files/headers/node-addon-api/napi-inl.h:1050:12: error: no matching function for call to 'Napi::Value::Value(napi_env__*&, void 
(* const&)(const Napi::CallbackInfo&))'
 1050 |     return Value(env, value);
      |            ^~~~~~~~~~~~~~~~~
/work/support-files/headers/node-addon-api/napi-inl.h:492:8: note: candidate: 'Napi::Value::Value(napi_env, napi_value)'
  492 | inline Value::Value(napi_env env, napi_value value) : _env(env), _value(value) {
      |        ^~~~~
/work/support-files/headers/node-addon-api/napi-inl.h:492:46: note:   no known conversion for argument 2 from 'void (* const)(const Napi::CallbackInfo&)' to 'napi_value' {aka 'napi_value__*'}
  492 | inline Value::Value(napi_env env, napi_value value) : _env(env), _value(value) {
      |                                   ~~~~~~~~~~~^~~~~
/work/support-files/headers/node-addon-api/napi-inl.h:489:8: note: candidate: 'Napi::Value::Value()'
  489 | inline Value::Value() : _env(nullptr), _value(nullptr) {
      |        ^~~~~
/work/support-files/headers/node-addon-api/napi-inl.h:489:8: note:   candidate expects 0 arguments, 2 provided
In file included from ../JsKeyboardHandler.cpp:1:
/work/support-files/headers/node-addon-api/napi.h:222:9: note: candidate: 'constexpr Napi::Value::Value(const Napi::Value&)'
  222 |   class Value {
      |         ^~~~~
/work/support-files/headers/node-addon-api/napi.h:222:9: note:   candidate expects 1 argument, 2 provided
/work/support-files/headers/node-addon-api/napi.h:222:9: note: candidate: 'constexpr Napi::Value::Value(Napi::Value&&)'
/work/support-files/headers/node-addon-api/napi.h:222:9: note:   candidate expects 1 argument, 2 provided
In file included from /work/support-files/headers/node-addon-api/napi.h:2636,
                 from ../JsKeyboardHandler.cpp:1:
/work/support-files/headers/node-addon-api/napi-inl.h: In instantiation of 'static Napi::Value Napi::details::vf_fallback<T>::From(napi_env, const T&) [with T = Napi::Value (*)(const Napi::CallbackInfo&); napi_env = napi_env__*]':
/work/support-files/headers/node-addon-api/napi-inl.h:1079:22:   required from 'static Napi::Value Napi::Value::From(napi_env, const T&) [with T = Napi::Value (*)(const Napi::CallbackInfo&); napi_env = napi_env__*]'
/work/support-files/headers/node-addon-api/napi-inl.h:1253:66:   required from 'void Napi::Object::Set(const char*, const ValueType&) [with ValueType = Napi::Value (*)(const Napi::CallbackInfo&)]'
../JsKeyboardHandler.cpp:78:40:   required from here
/work/support-files/headers/node-addon-api/napi-inl.h:1050:12: error: no matching function for call to 'Napi::Value::Value(napi_env__*&, Napi::Value (* const&)(const Napi::CallbackInfo&))'
 1050 |     return Value(env, value);
      |            ^~~~~~~~~~~~~~~~~
/work/support-files/headers/node-addon-api/napi-inl.h:492:8: note: candidate: 'Napi::Value::Value(napi_env, napi_value)'
  492 | inline Value::Value(napi_env env, napi_value value) : _env(env), _value(value) {
      |        ^~~~~
/work/support-files/headers/node-addon-api/napi-inl.h:492:46: note:   no known conversion for argument 2 from 'Napi::Value (* const)(const Napi::CallbackInfo&)' to 'napi_value' {aka 'napi_value__*'}
  492 | inline Value::Value(napi_env env, napi_value value) : _env(env), _value(value) {
      |                                   ~~~~~~~~~~~^~~~~
/work/support-files/headers/node-addon-api/napi-inl.h:489:8: note: candidate: 'Napi::Value::Value()'
  489 | inline Value::Value() : _env(nullptr), _value(nullptr) {
      |        ^~~~~
/work/support-files/headers/node-addon-api/napi-inl.h:489:8: note:   candidate expects 0 arguments, 2 provided
In file included from ../JsKeyboardHandler.cpp:1:
/work/support-files/headers/node-addon-api/napi.h:222:9: note: candidate: 'constexpr Napi::Value::Value(const Napi::Value&)'
  222 |   class Value {
      |         ^~~~~
/work/support-files/headers/node-addon-api/napi.h:222:9: note:   candidate expects 1 argument, 2 provided
/work/support-files/headers/node-addon-api/napi.h:222:9: note: candidate: 'constexpr Napi::Value::Value(Napi::Value&&)'
/work/support-files/headers/node-addon-api/napi.h:222:9: note:   candidate expects 1 argument, 2 provided
make: *** [Release/obj.target/KeyboardKtWindowsX64/JsKeyboardHandler.o] Error 1
KeyboardKtWindowsX64.target.mk:119: recipe for target 'Release/obj.target/KeyboardKtWindowsX64/JsKeyboardHandler.o' failed
make: Leaving directory '/work/project/keyboard-kt/src/jsMain/cpp/windows/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 4.19.128-microsoft-standard
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "build"
gyp ERR! cwd /work/project/keyboard-kt/src/jsMain/cpp/windows
gyp ERR! node -v v14.15.4
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok

I guess due to outdated compiler pick, the build is failing. I wanna specify them manually, tried searching in docs, didn't found any :(

@Animeshz
Copy link
Author

Seems like a similar issue #838 was closed without resolution.

@Animeshz
Copy link
Author

Similar issue #63 closed without resolution.

@Animeshz
Copy link
Author

Oh, it wasn't the issue of the node-gyp it was using the compilers in the environment variables. It was actually me, doing wrong things that was failing the compilation.

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

No branches or pull requests

1 participant