zone117x / node-cryptonote-pool

Mining pool for CryptoNote based coins such as Bytecoin and Monero
GNU General Public License v2.0
825 stars 1.14k forks source link

error: value-initialization of incomplete type 'crypto::rs_comm::<anonymous struct> #175

Open takenek opened 7 years ago

takenek commented 7 years ago

root@monero:~/pool# npm update

cryptonote-util@0.0.3 install /root/pool/node_modules/cryptonote-util node-gyp rebuild

make: Entering directory '/root/pool/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:114: 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 '/root/pool/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 (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276: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-3-amd64 gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /root/pool/node_modules/cryptonote-util gyp ERR! node -v v6.11.1 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok cryptonote-pool@0.0.1 /root/pool └── multi-hashing@0.0.9 (git://github.com/zone117x/node-multi-hashing.git#73996fe77104108f2d66ef750b3e1bce42e4d8f0)

npm ERR! Linux 4.9.0-3-amd64 npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "update" npm ERR! node v6.11.1 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE

npm ERR! cryptonote-util@0.0.3 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the cryptonote-util@0.0.3 install script 'node-gyp rebuild'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the cryptonote-util package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs cryptonote-util npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls cryptonote-util npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /root/pool/npm-debug.log

ghost commented 7 years ago

I'm also having this same problem. Any updates up to now?

takenek commented 7 years ago

No. I just stop using this... almost month waiting and noone answer from developers... maybe someone else find where is problem...

mhejek commented 7 years ago

its been on everywhere.its caused by wrong node version.use node 0.10.29

ghost commented 7 years ago

I found the solution to this problem. It was related to the gcc version on the dependency "node-cryptonote-util"

Plutoniumn commented 7 years ago

@FabioNevesRezende I've tried also other node versions and gcc versions but no result. Anyone else some ideas?

ghost commented 6 years ago

The error, for me, was gcc-[6-7] and the older node 6 pulled in via the installer script. First, install node 7 with this ppa: https://www.ubuntuupdates.org/ppa/nodejs_7.x

Then: apt-get install gcc-5 g++-5 -y && \ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5

and: update-alternatives --config gcc to select gcc-5 as default.

Skipping the sudo passwordless stuff and installer script, I cloned the git repository and "npm install" inside xmr-node-proxy works, thus, "npm install cryptonote-util" does too.

It's late, I'm tired, hope this makes sense :-) If not post your errors...

Plutoniumn commented 6 years ago

@Annabelle75 The first part worked. The I've tried to install the second; "apt-get install gcc-5 g++-5 -y && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5" but ubuntu and debian give the message: DEBIAN: "Package g++-5 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: gcc-6-test-results"

UBUNTU: Reading state information... Done E: Unable to locate package gcc-5 E: Unable to locate package g++-5 E: Couldn't find any package by regex 'g++-5'

I also updated and edited my repositories.. Any idea?

ghost commented 6 years ago

You're on debian? Ubuntu 16 and 17 have it available, what do: apt-cache madison gcc-5 and lsb_release -a and update-alternatives --config gcc say?

I have used gcc-5 | 5.4.1-2ubuntu1~16.04 | http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main amd64 Packages from the toolchain-r ppa, easy enough to get on ubuntu:

apt-get update && \ apt-get install build-essential software-properties-common -y && \ add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ apt-get update && \ apt-get install gcc-snapshot -y && \ apt-get update && \ apt-get install gcc-5 g++-5

Plutoniumn commented 6 years ago

@Annabelle75 I am on both, and on both I get the same error. At Debian I get the following if I try your first rule "apt-cache madison gcc-5"

Ubuntu worked, but at the end I recieved the following: WARNING: The following packages cannot be authenticated! libisl10 gcc-snapshot E: There were unauthenticated packages and -y was used without --allow-unauthenticated I guess this message is not important at all?

So I tried npm update again from the pool folder, I've got the following errors.

npm ERR! 404 'cryptonote-util' is not in the npm registry. npm ERR! 404 You should bug the author to publish it npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, or http url, or git url.

npm ERR! System Linux 4.9.0-3-amd64 npm ERR! command "/home/miguel/.nvm/v0.10.10/bin/node" "/home/miguel/.nvm/v0.10.10/bin/npm" "update" npm ERR! cwd /home/miguel/pool npm ERR! node -v v0.10.10 npm ERR! npm -v 1.2.25 npm ERR! code E404 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/miguel/pool/npm-debug.log npm ERR! not ok code 0

ghost commented 6 years ago

Not sure of your setup, perhaps behind some type of firewall? apt-keys update apt-get update apt-get upgrade should solve it. Regardless, did you get everything built?

Plutoniumn commented 6 years ago

@Annabelle75 Well, we've followed this guide: https://github.com/zone117x/node-cryptonote-pool So if you've downloaded everything you need to run "npm update". That is where the errors came from. I also updated the machine but still no result. There are less errors then before.. but still errors.

npm ERR! 404 'cryptonote-util' is not in the npm registry. npm ERR! 404 You should bug the author to publish it npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, or http url, or git url.

npm ERR! System Linux 4.9.0-3-amd64 npm ERR! command "/home/miguel/.nvm/v0.10.10/bin/node" "/home/miguel/.nvm/v0.10.10/bin/npm" "update" npm ERR! cwd /home/miguel/pool npm ERR! node -v v0.10.10 npm ERR! npm -v 1.2.25 npm ERR! code E404 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/miguel/pool/npm-debug.log npm ERR! not ok code 0

ghost commented 6 years ago

Your node and npm version are very, very old. If you want it to install easily you need to switch to ubuntu 16.04 LTS...

Plutoniumn commented 6 years ago

@Annabelle75 I have two machines. One is Ubuntu 16.04 and the other is Debian 4.9.30 If I read some manuals all the people are using node v0.10.10 and npm as default (the new one). In the last URL I've send you you will find the guide we've used. On these two machines I get different errors. They are like the ones I post.' Any idea or can you look with us?

TheBrones commented 6 years ago

@Plutoniumn @Annabelle75 @takenek I have the same problem on the latest Ubuntu Server. I tried all kind of npm and node versions Using NVM. I can find a lot of the same problems on Github but no real answer.

ghost commented 6 years ago

I'm configuring a new miner with a fresh install of ubuntu 16.04.3 LTS server, so I'll write down the steps... ...more later. :-)

I have these versions:

[jetfighter] (anna): npm -v 4.2.0 (/root) [jetfighter] (anna): node -v v7.10.1

ghost commented 6 years ago

I need cryponote-util for xmr-node-proxy -- this is a similar issue, been meaning to cross-link it back to there... anyway, this works on a clean ubuntu 16.04.3 server install. The gcc [6-7] stuff is extraneous and not needed unless you're developing, but I suspect the latest gcc-5 from the toolchain ppa is what gets this to compile. And if you install gcc 5,6 + 7 you can easily switch back and forth to see what will and will not compile. These are the steps to get cryptonote-util installed:

Starting with a fresh ubuntu 16.04.3 server would be a good idea. Then -- and don't skip any steps! --

apt-get update apt-get install build-essential software-properties-common -y add-apt-repository ppa:ubuntu-toolchain-r/test -y apt-get update apt-get install gcc-snapshot -y apt-get update apt-get install gcc-5 g++-5 -y update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5 apt-get install gcc-6 g++-6 -y update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 apt-get install gcc-7 g++-7 -y update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7

apt-get -y install \ libstdc++6 ocl-icd-opencl-dev libmicrohttpd-dev libssl-dev cmake \ build-essential libhwloc-dev git python-virtualenv python3-virtualenv \ curl ntp build-essential screen cmake pkg-config libboost-all-dev \ libevent-dev libunbound-dev libminiupnpc-dev libunwind8-dev liblzma-dev \ libldns-dev libexpat1-dev libgtest-dev libzmq3-dev

Select gcc-5

update-alternatives --config gcc

curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - sh -c "echo deb https://deb.nodesource.com/node_7.x zesty main \

/etc/apt/sources.list.d/nodesource.list" apt-get update apt-get install nodejs

You'll need pm2 later, it's awesome:

npm install -g pm2

useradd -d /home/nodeproxy -m -s /bin/bash nodeproxy passwd nodeproxy su - nodeproxy

git clone https://github.com/Snipa22/xmr-node-proxy.git cd xmr-node-proxy npm install (cryptonote-util doesn't compile/install from the xmr-node-proxy pull, so just do it manually) npm install cryptonote-util openssl req -subj "/C=IT/ST=Pool/L=Daemon/O=Mining Pool/CN=mining.proxy" \ -newkey rsa:2048 -nodes -keyout cert.key -x509 -out cert.pem -days 36500

Test with

node proxy.js

That's it, worked the first time :-)

Plutoniumn commented 6 years ago

@Annabelle75 Which versions of npm and node do you use? I've tried a few "recommended" versions but they all give different errors.. Is it possible to provide some help?

ghost commented 6 years ago

See above for versions. If you need help I'd suggest a clean VPS install and going from there. My email is on my profile page...

ghost commented 6 years ago

The difficulty here is node-gyp rebuilding, it can be install and worked around with npm's ignore-scripts, but the the pared-down final solution is getting up to gcc version 5.4.1 20160904 (Ubuntu 5.4.1-2ubuntu1~16.04) via the gcc installs above and using update-alternatives to select that version (my 16.04 ubuntu had gcc-4.5.3 stock, not sure what the new .iso ships with, so do the gcc installs anyway). Some of the programs (multi-hashing, for instance) won't compile with older g++ versions. So, to install this on ubuntu 16.04, follow the steps above, and as a non-root user, clone this git repository, cd into it and:

sudo update-alternatives --config gcc (select gcc-5) rm -rf ~/.node-gyp rm -rf ~/.nvm rm -rf ~/.nvp curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.3/install.sh | bash nvm install 0.10.25 npm install

Note that this drops you down to really old versions of node/npm so PM2 doesn't fully work, while it can be installed in another env and used to start and monitor the node, just use screen.

FWIW, once running, this node is really easy to configure and work with :-)

Hope this helps, and best of luck!

basvandervlies commented 6 years ago

Same problem in Debian 9 (stretch):

npm ERR! Linux 4.9.0-3-amd64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "update"
npm ERR! node v6.12.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
DelphinusQuercus commented 6 years ago

Probably the easiest way to solve this problem is to change the cryptonote-util/src/crypto/crypto.cpp line which calculates the full rs_comm size:

//    return sizeof(rs_comm) + pubs_count * sizeof(rs_comm().ab[0]);
    return sizeof(rs_comm) + pubs_count * 2 * sizeof(ec_point); /* BEWARE: Dependent on rs_comm definition above! */

The rs_comm struct is defined several lines above, and the anonymous struct ab[] consists of two ec_points. This will work properly with gcc-6 (and any other, as this is very simple C formulation).

LetUsFsck commented 6 years ago

Quick alternative is this excellent commit by @FabioNevesRezende https://github.com/Snipa22/node-cryptonote-util/pull/2/commits

nfriacowboy commented 6 years ago

tryed the sugestion of @Annabelle75 @ 13 Sep 2017 on a fresh install of ubuntu 18.04 to solve the error:

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::<unnamed struct> []’
     return sizeof(rs_comm) + pubs_count * sizeof(rs_comm().ab[0]);
                                                          ^
cryptonote.target.mk:111: recipe for target 'Release/obj.target/cryptonote/src/crypto/crypto.o' failed
make: *** [Release/obj.target/cryptonote/src/crypto/crypto.o] Error 1

still with nodejs 0.10.48 and is working.

Thanks @Annabelle75