bitcoin-abc: ./amount.h:76:63: error: can't initialize friend function 'operator*'
I’m trying to build the client with the latest github checkout, using the following commands:
./autogen.sh
./configure --enable-cxx --disable-shared --with-pic --prefix=/opt/bitcoin-cash-build PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig LIBS=-Wl,-rpath,/opt/openssl/lib
make
The result of make is:
Making all in src
make[1]: Entering directory `/opt/bitcoin-cash/src'
make[2]: Entering directory `/opt/bitcoin-cash/src'
CXX consensus/libbitcoinconsensus_la-merkle.lo
In file included from ./primitives/transaction.h:9:0,
from ./primitives/block.h:9,
from consensus/merkle.h:11,
from consensus/merkle.cpp:5:
./amount.h:76:63: error: can't initialize friend function 'operator*'
friend Amount operator*(const double a, const Amount b) = delete;
^
make[2]: *** [consensus/libbitcoinconsensus_la-merkle.lo] Error 1
make[2]: Leaving directory `/opt/bitcoin-cash/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/bitcoin-cash/src'
make: *** [all-recursive] Error 1
This is on OEL. I previously did this without issue at the time of the fork using the same process.
I have no local changes (this is a fresh clone).
I’m afraid I’m not familiar with the code, so I may have overlooked something obvious.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 28 (15 by maintainers)
Commits related to this issue
- Switch to GCC 7 on Travis, disable currently non-functional ARM + Windows builds Summary: Use of deleted function declaration broke older C++11 compilers. (https://github.com/Bitcoin-ABC/bitcoin-abc/... — committed to cculianu/bitcoin-abc by ftrader 7 years ago
- Make Travis work (g++7) See https://github.com/Bitcoin-ABC/bitcoin-abc/issues/98 + https://reviews.bitcoinabc.org/rABC31b68eb0b59ba2721d31b9668831de6fc226da03 — committed to owstack/bitcoin-abc by karelbilek 7 years ago
- Make Travis work (g++7) See https://github.com/Bitcoin-ABC/bitcoin-abc/issues/98 + https://reviews.bitcoinabc.org/rABC31b68eb0b59ba2721d31b9668831de6fc226da03 — committed to owstack/bitcoin-abc by karelbilek 7 years ago
In centos I upgrade gcc from 4.8.5 to gcc 7.2.1 and disable test compile
This fixed it for me: sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-7 sudo apt-get install g+±7 ./configure CC=gcc-7 CXX=g+±7 make
Note the “-” before the 7 - that is missing from some of the comments above. Guess someone should update build instructions…
Just for the record, this is the mentioned bug in GCC, which got fixed in GCC 5.1.
The fix for Travis is already in the upstream, but hasn’t been pushed to GH yet.
https://reviews.bitcoinabc.org/rABC31b68eb0b59ba2721d31b9668831de6fc226da03
Unfortunately some Travis functionality is lost due to moving to modern C++ features. It’s very likely that Travis CI will be dropped in ABC in favor of a solution which can be better maintained.
@sparsecloud : We’ve noticed several C++ compiler versions having problems with this declaration which has been put in for defensive programming purposes.
You can safely comment out that line for your build without affecting the functioning of the software.