Snipa22 / xmr-node-proxy

220 stars 208 forks source link

cryptonote-util build error (dependency) #150

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi

I have common build error inside cryptonote-util that I cannot find a fix to. It is preventing install/run proxy:

cryptonote-util@0.0.3 install /home/xmrproxy/xmr-node-proxy/node_modules/cryptonote-util node-gyp rebuild

make: Entering directory '/home/xmrproxy/xmr-node-proxy/node_modules/cryptonote-util/build' CXX(target) Release/obj.target/cryptonote/src/main.o CXX(target) Release/obj.target/cryptonote/src/cryptonote_core/cryptonote_format_utils.o ../src/cryptonote_core/cryptonote_format_utils.cpp: In function ‘bool cryptonote::check_proof_of_work(const cryptonote::block&, cryptonote::difficulty_type, crypto::hash&)’: ../src/cryptonote_core/cryptonote_format_utils.cpp:938:3: warning: no return statement in function returning non-void [-Wreturn-type] } ^ CC(target) Release/obj.target/cryptonote/src/crypto/tree-hash.o CXX(target) Release/obj.target/cryptonote/src/crypto/crypto.o ../src/crypto/crypto.cpp: In function ‘std::size_t crypto::rs_comm_size(std::size_t)’: ../src/crypto/crypto.cpp:224:58: error: value-initialization of incomplete type ‘crypto::rs_comm:: []’ return sizeof(rs_comm) + pubs_count * sizeof(rs_comm().ab[0]); ^ cryptonote.target.mk:104: recipe for target 'Release/obj.target/cryptonote/src/crypto/crypto.o' failed make: *** [Release/obj.target/cryptonote/src/crypto/crypto.o] Error 1 make: Leaving directory '/home/xmrproxy/xmr-node-proxy/node_modules/cryptonote-util/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/xmrproxy/.nvm/v0.10.13/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12) gyp ERR! System Linux 4.9.0-6-amd64 gyp ERR! command "node" "/home/xmrproxy/.nvm/v0.10.13/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/xmrproxy/xmr-node-proxy/node_modules/cryptonote-util gyp ERR! node -v v0.10.13 gyp ERR! node-gyp -v v0.10.2 gyp ERR! not ok unbuild cryptonote-util@0.0.3 npm WARN optional dep failed, continuing cryptonote-util@0.0.3

This is an error inside one of the dependancies, cryptonote-util v0.0.3 it prevents installation/startup of proxy

I have tried node.js 0.10.13

Please help thanks

ghost commented 6 years ago

It took me a while to figure out the node-gyp thing before I could even try manually fixing the problem and recompiling.

I have applied this patch here https://github.com/monero-project/monero/commit/0f7956d0e4d811941cebfa088113e28452ec6d5c

Now I have gotten past that error and the new error when compiling node-cryptonote-utils is:

xmrproxy@pizone:~/xmr-node-proxy/node_modules/cryptonote-util$ node-gyp rebuild gyp info it worked if it ends with ok gyp info using node-gyp@3.7.0 gyp info using node@6.9.2 | linux | x64 gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR gyp info spawn /usr/bin/python2 gyp info spawn args [ '/home/xmrproxy/.nvm/versions/node/v6.9.2/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 '/home/xmrproxy/xmr-node-proxy/node_modules/cryptonote-util/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/home/xmrproxy/.nvm/versions/node/v6.9.2/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/home/xmrproxy/.node-gyp/6.9.2/include/node/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/home/xmrproxy/.node-gyp/6.9.2', gyp info spawn args '-Dnode_gyp_dir=/home/xmrproxy/.nvm/versions/node/v6.9.2/lib/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/home/xmrproxy/.node-gyp/6.9.2/<(target_arch)/node.lib', gyp info spawn args '-Dmodule_root_dir=/home/xmrproxy/xmr-node-proxy/node_modules/cryptonote-util', 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 WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] make: Entering directory '/home/xmrproxy/xmr-node-proxy/node_modules/cryptonote-util/build' CXX(target) Release/obj.target/cryptonote/src/main.o CXX(target) Release/obj.target/cryptonote/src/cryptonote_core/cryptonote_format_utils.o ../src/cryptonote_core/cryptonote_format_utils.cpp: In function ‘bool cryptonote::check_proof_of_work(const cryptonote::block&, cryptonote::difficulty_type, crypto::hash&)’: ../src/cryptonote_core/cryptonote_format_utils.cpp:938:3: warning: no return statement in function returning non-void [-Wreturn-type] } ^ CC(target) Release/obj.target/cryptonote/src/crypto/tree-hash.o CXX(target) Release/obj.target/cryptonote/src/crypto/crypto.o ../src/crypto/crypto.cpp: In function ‘std::size_t crypto::rs_comm_size(std::size_t)’: ../src/crypto/crypto.cpp:224:58: error: value-initialization of incomplete type ‘crypto::rs_comm:: []’ return sizeof(rs_comm) + pubs_count * sizeof(rs_comm().ab[0]); ^ cryptonote.target.mk:120: recipe for target 'Release/obj.target/cryptonote/src/crypto/crypto.o' failed make: *** [Release/obj.target/cryptonote/src/crypto/crypto.o] Error 1 make: Leaving directory '/home/xmrproxy/xmr-node-proxy/node_modules/cryptonote-util/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/xmrproxy/.nvm/versions/node/v6.9.2/lib/node_modules/node-gyp/lib/build.js:262:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Linux 4.9.0-6-amd64 gyp ERR! command "/home/xmrproxy/.nvm/versions/node/v6.9.2/bin/node" "/home/xmrproxy/.nvm/versions/node/v6.9.2/bin/node-gyp" "rebuild" gyp ERR! cwd /home/xmrproxy/xmr-node-proxy/node_modules/cryptonote-util gyp ERR! node -v v6.9.2 gyp ERR! node-gyp -v v3.7.0 gyp ERR! not ok

I am looking for fixes to this error now....

ghost commented 6 years ago

So I have been testing out different fixes for this specific error (the second one) and I think the fix for this error was to update to Node v10.6.0

To be clear the whole fix was:

  1. Go through the installer, if you have not, let it finish - it will appear it works except pm2 status will show the "ERROR" state. Everything except cryptonote-utils is working. We will now manually build and compile it :)
  2. apt install nvm if you do not have nvm installed
  3. nvm install v10.6.0 to install node.js v10.6.0
  4. nvm use v10.6.0 to use node.js v10.6.0
  5. npm update
  6. npm install node-gyp
  7. source ~/bashrc to activate new bashrc
  8. cd node_modules
  9. git clone -b xmr-Nan-2.0 https://github.com/lucasjones/node-cryptonote-util.git cryptonote-util
  10. cd cryptonote-util
  11. nano src/crypto/crypto.cpp
  12. replace around line 224 - 275: return sizeof(rs_comm) + pubs_count sizeof(rs_comm().ab[0]); with return sizeof(rs_comm) + pubs_count 2 * sizeof(ec_point);
  13. node-gyp rebuild
  14. pm2 restart NAME_OF_APP app name found on pm2 status page ex: "pm2 restart proxy"
  15. pm2 status should show the app is now "ONLINE" and not "ERROR"

I am pretty sure those commands are the right ones in order but feel free to correct me.

Finally got it compiled :)

ghost commented 6 years ago

Nevermind....

It shows ok in pm2 status but pm2 log shows:

1|proxy | 2018-07-04 21:00 -04:00: Error: Cannot find module 'cryptonote-util' 1|proxy | at Function.Module._resolveFilename (module.js:469:15) 1|proxy | at Function.Module._load (module.js:417:25) 1|proxy | at Module.require (module.js:497:17) 1|proxy | at require (internal/module.js:20:19) 1|proxy | at Object. (/home/xmrproxy/xmr-node-proxy/lib/xmr.js:3:16) 1|proxy | at Module._compile (module.js:570:32) 1|proxy | at Object.Module._extensions..js (module.js:579:10) 1|proxy | at Module.load (module.js:487:32) 1|proxy | at tryModuleLoad (module.js:446:12) 1|proxy | at Function.Module._load (module.js:438:3)

bobbieltd commented 6 years ago

Please go to https://github.com/MoneroOcean/xmr-node-proxy