MoneroOcean / node-cryptoforknote-util

NodeJS wrappers for Cryptonode/Forknote coins
11 stars 83 forks source link

Compilation errors to install cryptoforknote-util #20

Open happysmash27 opened 2 years ago

happysmash27 commented 2 years ago

When trying to install cryptoforknote-util using normal means, https://github.com/nodejs/node-gyp/issues/2638 occurs:

 % npm install cryptoforknote-util
npm WARN skipping integrity check for git dependency ssh://git@github.com/MoneroOcean/bitcoinjs-lib.git
npm ERR! code 1
npm ERR! path /home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util
npm ERR! command failed
npm ERR! command sh /tmp/install-fecd0894.sh
npm ERR! make: Entering directory '/home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util/build'
npm ERR!   CXX(target) Release/obj.target/cryptoforknote/src/main.o
npm ERR! make: Leaving directory '/home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.17.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.5 found at "/usr/lib/python-exec/python3.10/python3"
npm ERR! gyp info spawn /usr/lib/python-exec/python3.10/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/minilaroqrl/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/minilaroqrl/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/minilaroqrl/.cache/node-gyp/16.17.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/minilaroqrl/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/minilaroqrl/.cache/node-gyp/16.17.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from /home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/v8.h:30,
npm ERR!                  from /home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/node.h:73,
npm ERR!                  from ../src/main.cc:2:
npm ERR! /home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
npm ERR! /home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/v8-internal.h:492:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
npm ERR!   492 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR!       |                                      ^~~~~~~~~~~
npm ERR!       |                                      remove_cv
npm ERR! /home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/v8-internal.h:492:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
npm ERR!   492 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR!       |                                      ^~~~~~~~~~~
npm ERR!       |                                      remove_cv
npm ERR! /home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/v8-internal.h:492:50: error: template argument 2 is invalid
npm ERR!   492 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR!       |                                                  ^
npm ERR! /home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/v8-internal.h:492:63: error: ‘::Perform’ has not been declared
npm ERR!   492 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR!       |                                                               ^~~~~~~
npm ERR! In file included from ../src/cryptonote_core/cryptonote_basic.h:16,
npm ERR!                  from ../src/main.cc:8:
npm ERR! ../src/serialization/binary_archive.h: In constructor ‘binary_archive<false>::binary_archive(binary_archive_base<std::basic_istream<char>, false>::stream_type&)’:
npm ERR! ../src/serialization/binary_archive.h:51:28: warning: ‘std::ios_base::streampos’ is deprecated: use 'std::streampos' instead [-Wdeprecated-declarations]
npm ERR!    51 |     stream_type::streampos pos = stream_.tellg();
npm ERR!       |                            ^~~
npm ERR! In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/streambuf:41,
npm ERR!                  from /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/streambuf_iterator.h:35,
npm ERR!                  from /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/iterator:66,
npm ERR!                  from /usr/include/boost/container_hash/hash.hpp:21,
npm ERR!                  from /usr/include/boost/functional/hash/hash.hpp:6,
npm ERR!                  from ../src/cryptonote_core/cryptonote_basic.h:8,
npm ERR!                  from ../src/main.cc:8:
npm ERR! /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/ios_base.h:499:28: note: declared here
npm ERR!   499 |     typedef std::streampos streampos
npm ERR!       |                            ^~~~~~~~~
npm ERR! In file included from ../src/serialization/crypto.h:10,
npm ERR!                  from ../src/cryptonote_core/cryptonote_basic.h:17,
npm ERR!                  from ../src/main.cc:8:
npm ERR! ../src/crypto/chacha8.h: In function ‘void crypto::generate_chacha8_key(std::string, crypto::chacha8_key&)’:
npm ERR! ../src/crypto/chacha8.h:51:11: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of non-trivially copyable type ‘struct crypto::chacha8_key’; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
npm ERR!    51 |     memcpy(&key, pwd_hash, sizeof(key));
npm ERR!       |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../src/crypto/chacha8.h:26:10: note: ‘struct crypto::chacha8_key’ declared here
npm ERR!    26 |   struct chacha8_key {
npm ERR!       |          ^~~~~~~~~~~
npm ERR! In file included from ../src/main.cc:2:
npm ERR! ../src/main.cc: At global scope:
npm ERR! /home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/node.h:859:7: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
npm ERR!   859 |       (node::addon_register_func) (regfunc),                          \
npm ERR!       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/node.h:893:3: note: in expansion of macro ‘NODE_MODULE_X’
npm ERR!   893 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
npm ERR!       |   ^~~~~~~~~~~~~
npm ERR! ../src/main.cc:392:1: note: in expansion of macro ‘NODE_MODULE’
npm ERR!   392 | NODE_MODULE(cryptoforknote, init)
npm ERR!       | ^~~~~~~~~~~
npm ERR! make: *** [cryptoforknote.target.mk:132: Release/obj.target/cryptoforknote/src/main.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/home/minilaroqrl/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.19.3-gentoo
npm ERR! gyp ERR! command "/home/minilaroqrl/.nvm/versions/node/v16.17.0/bin/node" "/home/minilaroqrl/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util
npm ERR! gyp ERR! node -v v16.17.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/minilaroqrl/.npm/_logs/2022-09-18T21_05_50_071Z-debug-0.log

When trying to install it using the suggested workaround of CXXFLAGS="-std=c++17", a different compilation error occurs:

 % CXXFLAGS="-std=c++17" npm install cryptoforknote-util
npm WARN skipping integrity check for git dependency ssh://git@github.com/MoneroOcean/bitcoinjs-lib.git
npm ERR! code 1
npm ERR! path /home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util
npm ERR! command failed
npm ERR! command sh /tmp/install-14e3a5df.sh
npm ERR! make: Entering directory '/home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util/build'
npm ERR!   CXX(target) Release/obj.target/cryptoforknote/src/main.o
npm ERR! make: Leaving directory '/home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.17.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.5 found at "/usr/lib/python-exec/python3.10/python3"
npm ERR! gyp info spawn /usr/lib/python-exec/python3.10/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/minilaroqrl/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/minilaroqrl/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/minilaroqrl/.cache/node-gyp/16.17.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/minilaroqrl/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/minilaroqrl/.cache/node-gyp/16.17.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/cryptonote_core/cryptonote_basic.h:16,
npm ERR!                  from ../src/main.cc:8:
npm ERR! ../src/serialization/binary_archive.h: In constructor ‘binary_archive<false>::binary_archive(binary_archive_base<std::basic_istream<char>, false>::stream_type&)’:
npm ERR! ../src/serialization/binary_archive.h:51:18: error: ‘streampos’ is not a member of ‘binary_archive_base<std::basic_istream<char>, false>::stream_type’ {aka ‘std::basic_istream<char>’}
npm ERR!    51 |     stream_type::streampos pos = stream_.tellg();
npm ERR!       |                  ^~~~~~~~~
npm ERR! ../src/serialization/binary_archive.h:54:19: error: ‘pos’ was not declared in this scope; did you mean ‘pow’?
npm ERR!    54 |     stream_.seekg(pos);
npm ERR!       |                   ^~~
npm ERR!       |                   pow
npm ERR! In file included from ../src/serialization/crypto.h:10,
npm ERR!                  from ../src/cryptonote_core/cryptonote_basic.h:17,
npm ERR!                  from ../src/main.cc:8:
npm ERR! ../src/crypto/chacha8.h: In function ‘void crypto::generate_chacha8_key(std::string, crypto::chacha8_key&)’:
npm ERR! ../src/crypto/chacha8.h:51:11: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of non-trivially copyable type ‘struct crypto::chacha8_key’; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
npm ERR!    51 |     memcpy(&key, pwd_hash, sizeof(key));
npm ERR!       |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../src/crypto/chacha8.h:26:10: note: ‘struct crypto::chacha8_key’ declared here
npm ERR!    26 |   struct chacha8_key {
npm ERR!       |          ^~~~~~~~~~~
npm ERR! In file included from ../src/main.cc:2:
npm ERR! ../src/main.cc: At global scope:
npm ERR! /home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/node.h:859:7: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
npm ERR!   859 |       (node::addon_register_func) (regfunc),                          \
npm ERR!       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/minilaroqrl/.cache/node-gyp/16.17.0/include/node/node.h:893:3: note: in expansion of macro ‘NODE_MODULE_X’
npm ERR!   893 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
npm ERR!       |   ^~~~~~~~~~~~~
npm ERR! ../src/main.cc:392:1: note: in expansion of macro ‘NODE_MODULE’
npm ERR!   392 | NODE_MODULE(cryptoforknote, init)
npm ERR!       | ^~~~~~~~~~~
npm ERR! make: *** [cryptoforknote.target.mk:138: Release/obj.target/cryptoforknote/src/main.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/home/minilaroqrl/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.19.3-gentoo
npm ERR! gyp ERR! command "/home/minilaroqrl/.nvm/versions/node/v16.17.0/bin/node" "/home/minilaroqrl/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/minilaroqrl/cryptonote-nodejs-pool_16/node_modules/cryptoforknote-util
npm ERR! gyp ERR! node -v v16.17.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/minilaroqrl/.npm/_logs/2022-09-18T21_07_12_792Z-debug-0.log
happysmash27 commented 2 years ago

Such an issue does not seem to have happened on my node 11 installation, but Node 11 is not giving another issue where bitcoinjs-lib, a requirement of this library, is requiring node 16+.