net-p2p/bitcoin fails to build on amd64 10.1-RELEASE and 10.2-RELEASE With option HARDENING set: ar: warning: creating libleveldb.a gmake[5]: Leaving directory '/usr/ports/net-p2p/bitcoin/work/bitcoin-0.11.2/src/leveldb' gmake -C secp256k1 libsecp256k1.la gmake[5]: Entering directory '/usr/ports/net-p2p/bitcoin/work/bitcoin-0.11.2/src/secp256k1' /bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I./src -I./include -O2 -pipe -fstack-protector -fno-strict-aliasing -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -MT src/libsecp256k1_la-secp256k1.lo -MD -MP -MF src/.deps/libsecp256k1_la-secp256k1.Tpo -c -o src/libsecp256k1_la-secp256k1.lo `test -f 'src/secp256k1.c' || echo './'`src/secp256k1.c libtool: compile: cc -DHAVE_CONFIG_H -I. -I./src -I./include -O2 -pipe -fstack-protector -fno-strict-aliasing -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -MT src/libsecp256k1_la-secp256k1.lo -MD -MP -MF src/.deps/libsecp256k1_la-secp256k1.Tpo -c src/secp256k1.c -fPIC -DPIC -o src/libsecp256k1_la-secp256k1.o mv -f src/.deps/libsecp256k1_la-secp256k1.Tpo src/.deps/libsecp256k1_la-secp256k1.Plo /bin/sh ./libtool --tag=CC --mode=link cc -O2 -pipe -fstack-protector -fno-strict-aliasing -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fstack-protector -o libsecp256k1.la -rpath /usr/local/lib src/libsecp256k1_la-secp256k1.lo -L/usr/local/lib/db48 libtool: link: /usr/bin/ar cru .libs/libsecp256k1.a src/libsecp256k1_la-secp256k1.o libtool: link: /usr/bin/ranlib .libs/libsecp256k1.a libtool: link: ( cd ".libs" && rm -f "libsecp256k1.la" && ln -s "../libsecp256k1.la" "libsecp256k1.la" ) gmake[5]: Leaving directory '/usr/ports/net-p2p/bitcoin/work/bitcoin-0.11.2/src/secp256k1' /bin/sh ../libtool --tag CXX --mode=link g++ -O2 -pipe -fstack-protector -fno-strict-aliasing -I/usr/local/include/db48 -Wstack-protector -fstack-protector-all -fPIE -D_THREAD_SAFE -pthread -fstack-protector -Wl,-z,relro -Wl,-z,now -pie -o qt/bitcoin-qt qt/qt_bitcoin_qt-bitcoin.o qt/libbitcoinqt.a libbitcoin_server.a libbitcoin_wallet.a libbitcoin_cli.a libbitcoin_common.a libbitcoin_util.a crypto/libbitcoin_crypto.a univalue/libbitcoin_univalue.a ./leveldb/libleveldb.a ./leveldb/libmemenv.a -pthread -L/usr/local/lib -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -L/usr/local/lib/qt4 -lQtGui -lQtNetwork -lQtCore -L/usr/local/lib -lqrencode -lpthread -L/usr/local/lib -lprotobuf -D_THREAD_SAFE -pthread -lpthread -ldb_cxx-4.8 -L/usr/lib -lssl -L/usr/lib -lcrypto secp256k1/libsecp256k1.la -lcrypto -L/usr/local/lib/db48 libtool: link: g++ -O2 -pipe -fstack-protector -fno-strict-aliasing -I/usr/local/include/db48 -Wstack-protector -fstack-protector-all -fPIE -D_THREAD_SAFE -pthread -fstack-protector -Wl,-z -Wl,relro -Wl,-z -Wl,now -pie -o qt/bitcoin-qt qt/qt_bitcoin_qt-bitcoin.o -pthread -D_THREAD_SAFE -pthread qt/libbitcoinqt.a libbitcoin_server.a libbitcoin_wallet.a libbitcoin_cli.a libbitcoin_common.a libbitcoin_util.a crypto/libbitcoin_crypto.a univalue/libbitcoin_univalue.a ./leveldb/libleveldb.a ./leveldb/libmemenv.a -L/usr/local/lib -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -L/usr/local/lib/qt4 -lQtGui -lQtNetwork -lQtCore -lqrencode -lprotobuf -lpthread -ldb_cxx-4.8 -L/usr/lib -lssl secp256k1/.libs/libsecp256k1.a -L/usr/local/lib/db48 -lcrypto -pthread /usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against `_DYNAMIC' can not be used when making a shared object; recompile with -fPIC /usr/lib/crt1.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status Makefile:2628: recipe for target 'qt/bitcoin-qt' failed gmake[4]: *** [qt/bitcoin-qt] Error 1 gmake[4]: Leaving directory '/usr/ports/net-p2p/bitcoin/work/bitcoin-0.11.2/src' Makefile:6470: recipe for target 'all-recursive' failed With option HARDENING unset: ar: warning: creating libleveldb.a gmake[5]: Leaving directory '/usr/ports/net-p2p/bitcoin/work/bitcoin-0.11.2/src/leveldb' gmake -C secp256k1 libsecp256k1.la gmake[5]: Entering directory '/usr/ports/net-p2p/bitcoin/work/bitcoin-0.11.2/src/secp256k1' /bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I./src -I./include -O2 -pipe -fstack-protector -fno-strict-aliasing -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -MT src/libsecp256k1_la-secp256k1.lo -MD -MP -MF src/.deps/libsecp256k1_la-secp256k1.Tpo -c -o src/libsecp256k1_la-secp256k1.lo `test -f 'src/secp256k1.c' || echo './'`src/secp256k1.c libtool: compile: cc -DHAVE_CONFIG_H -I. -I./src -I./include -O2 -pipe -fstack-protector -fno-strict-aliasing -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -MT src/libsecp256k1_la-secp256k1.lo -MD -MP -MF src/.deps/libsecp256k1_la-secp256k1.Tpo -c src/secp256k1.c -fPIC -DPIC -o src/libsecp256k1_la-secp256k1.o mv -f src/.deps/libsecp256k1_la-secp256k1.Tpo src/.deps/libsecp256k1_la-secp256k1.Plo /bin/sh ./libtool --tag=CC --mode=link cc -O2 -pipe -fstack-protector -fno-strict-aliasing -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fstack-protector -o libsecp256k1.la -rpath /usr/local/lib src/libsecp256k1_la-secp256k1.lo -L/usr/local/lib/db48 libtool: link: /usr/bin/ar cru .libs/libsecp256k1.a src/libsecp256k1_la-secp256k1.o libtool: link: /usr/bin/ranlib .libs/libsecp256k1.a libtool: link: ( cd ".libs" && rm -f "libsecp256k1.la" && ln -s "../libsecp256k1.la" "libsecp256k1.la" ) gmake[5]: Leaving directory '/usr/ports/net-p2p/bitcoin/work/bitcoin-0.11.2/src/secp256k1' /bin/sh ../libtool --tag CXX --mode=link g++ -D_THREAD_SAFE -pthread -fstack-protector -o qt/bitcoin-qt qt/qt_bitcoin_qt-bitcoin.o qt/libbitcoinqt.a libbitcoin_server.a libbitcoin_wallet.a libbitcoin_cli.a libbitcoin_common.a libbitcoin_util.a crypto/libbitcoin_crypto.a univalue/libbitcoin_univalue.a ./leveldb/libleveldb.a ./leveldb/libmemenv.a -pthread -L/usr/local/lib -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -L/usr/local/lib/qt4 -lQtGui -lQtNetwork -lQtCore -L/usr/local/lib -lqrencode -lpthread -L/usr/local/lib -lprotobuf -D_THREAD_SAFE -pthread -lpthread -ldb_cxx-4.8 -L/usr/lib -lssl -L/usr/lib -lcrypto secp256k1/libsecp256k1.la -lcrypto -L/usr/local/lib/db48 libtool: link: g++ -D_THREAD_SAFE -pthread -fstack-protector -o qt/bitcoin-qt qt/qt_bitcoin_qt-bitcoin.o -pthread -D_THREAD_SAFE -pthread qt/libbitcoinqt.a libbitcoin_server.a libbitcoin_wallet.a libbitcoin_cli.a libbitcoin_common.a libbitcoin_util.a crypto/libbitcoin_crypto.a univalue/libbitcoin_univalue.a ./leveldb/libleveldb.a ./leveldb/libmemenv.a -L/usr/local/lib -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -L/usr/local/lib/qt4 -lQtGui -lQtNetwork -lQtCore -lqrencode -lprotobuf -lpthread -ldb_cxx-4.8 -L/usr/lib -lssl secp256k1/.libs/libsecp256k1.a -L/usr/local/lib/db48 -lcrypto -pthread /usr/local/bin/ld: qt/qt_bitcoin_qt-bitcoin.o: undefined reference to symbol '_ZNSt3__18ios_base5clearEj' //usr/lib/libc++.so.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Makefile:2628: recipe for target 'qt/bitcoin-qt' failed gmake[4]: *** [qt/bitcoin-qt] Error 1 gmake[4]: Leaving directory '/usr/ports/net-p2p/bitcoin/work/bitcoin-0.11.2/src' The other options do not affect the result
I cannot confirm this error. The port builds fine for me on 10.1, both with and without hardening set. Note that, in both of your build snippets, with and without HARDENING, the build fails, all be it with different errors. As far as I can see, this is a problem with your local configuration, although nothing in either of your partial build outputs tells me what. I'll have to leave this issue here until someone else has the same problem, or you find what is the local cause of your issue. I suggest rebuilding all required ports and trying again, making sure to run 'make clean', in case there is a missing or corrupted file.
(In reply to robbak from comment #1) I can confirm this error as occurring on 10.2. I will try rebuilding all dependent ports as robbak suggests.
(In reply to robbak from comment #1) Before commit bug report, i was trying to rebuild the dependency and checked build on a second system with a clean installation all ports ( sorry for my bad english, this is not my native language )
Trying it also failes (on 10-2 amd64) in the port, but builds with poudriere.
(In reply to w.schwarzenfeld from comment #4) OK, thanks. I don't at the moment have a 10.x system to build on, so I can't see the error. I'll have to fix that, or course. This is probably it pulling in a library etc. from your system instead of the bundled one. Could you confirm - is yours the failure with HARDENING, or the failure without? Or is it both? A full log of a failed build would help. Use script(1) to create a log file, and attach it to this bug report.
It failes with both. It is exactly the same as olexander.v.melnyk described.
Created attachment 166895 [details] bitcoin-hardening_off.log
Created attachment 166896 [details] bitcoin-hardening_on.log
Poudriere builds both, with HARDENING on or off.
(In reply to w.schwarzenfeld from comment #8) One thing I have noticed - you are using ccache. Any difference if you disable ccache? That is a clear difference between poudriere and other builds. Other reportees - are you using ccache? Can you try the build without it?
(In reply to robbak from comment #10) I do not use ccache.
(In reply to robbak from comment #10) On my system poudriere also uses ccache. Same error without ccache in the port.
Created attachment 166899 [details] log with HARDENING set
Created attachment 166900 [details] log with HARDENING unset
Created attachment 167171 [details] proposed patch for Makefile Not sure it's entirely correct patch, but it works for me.
It fails also for me, but with another error, related to libboost and the latest openssl: c++ -DHAVE_CONFIG_H -I. -I../src/config -I. -I./obj -pthread -I/usr/local/include -I./leveldb/include -I./leveldb/helpers/memenv -I/usr/local/include -I/usr/local/include -I./secp256k1/include -Qunused-arguments -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -O2 -pipe -march=corei7 -fstack-protector -fno-strict-aliasing -I/usr/local/include/db48 -Wstack-protector -fstack-protector-all -fPIE -MT libbitcoin_server_a-net.o -MD -MP -MF .deps/libbitcoin_server_a-net.Tpo -c -o libbitcoin_server_a-net.o `test -f 'net.cpp' || echo './'`net.cpp In file included from init.cpp:21: In file included from ./rpcserver.h:10: In file included from ./rpcprotocol.h:16: In file included from /usr/local/include/boost/asio/ssl.hpp:19: In file included from /usr/local/include/boost/asio/ssl/context.hpp:786: /usr/local/include/boost/asio/ssl/impl/context.ipp:91:31: error: no member named 'SSLv3_method' in the global namespace; did you mean 'SSLv23_method'? handle_ = ::SSL_CTX_new(::SSLv3_method()); ~~^~~~~~~~~~~~ SSLv23_method /usr/local/include/openssl/ssl.h:2360:19: note: 'SSLv23_method' declared here const SSL_METHOD *SSLv23_method(void); /* Negotiate highest available SSL/TLS
Since r411050, the previous error with SSLv23_method has been fixed, and but now it fails at linking: /bin/sh ../libtool --tag CXX --mode=link g++ -O2 -pipe -march=corei7 -fstack-protector -fno-strict-aliasing -I/usr/local/include/db48 -Wstack-protector -fstack-protector-all -fPIE -D_THREAD_SAFE -pthread -Wl,-rpath,/usr/local/lib -fstack-protector -Wl,-z,relro -Wl,-z,now -pie -o qt/bitcoin-qt qt/qt_bitcoin_qt-bitcoin.o qt/libbitcoinqt.a libbitcoin_server.a libbitcoin_wallet.a libbitcoin_cli.a libbitcoin_common.a libbitcoin_util.a crypto/libbitcoin_crypto.a univalue/libbitcoin_univalue.a ./leveldb/libleveldb.a ./leveldb/libmemenv.a -pthread -L/usr/local/lib -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -L/usr/local/lib/qt4 -lQtGui -lQtNetwork -lQtCore -L/usr/local/lib -lqrencode -pthread -L/usr/local/lib -lprotobuf -D_THREAD_SAFE -pthread -lpthread -ldb_cxx-4.8 -L/usr/local/lib -lssl -L/usr/local/lib -lcrypto secp256k1/libsecp256k1.la -lcrypto -L/usr/local/lib/db48 libtool: link: g++ -O2 -pipe -march=corei7 -fstack-protector -fno-strict-aliasing -I/usr/local/include/db48 -Wstack-protector -fstack-protector-all -fPIE -D_THREAD_SAFE -pthread -Wl,-rpath -Wl,/usr/local/lib -fstack-protector -Wl,-z -Wl,relro -Wl,-z -Wl,now -pie -o qt/bitcoin-qt qt/qt_bitcoin_qt-bitcoin.o -pthread -pthread -D_THREAD_SAFE -pthread qt/libbitcoinqt.a libbitcoin_server.a libbitcoin_wallet.a libbitcoin_cli.a libbitcoin_common.a libbitcoin_util.a crypto/libbitcoin_crypto.a univalue/libbitcoin_univalue.a ./leveldb/libleveldb.a ./leveldb/libmemenv.a -L/usr/local/lib -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -L/usr/local/lib/qt4 -lQtGui -lQtNetwork -lQtCore -lqrencode -lprotobuf -lpthread -ldb_cxx-4.8 -lssl secp256k1/.libs/libsecp256k1.a -L/usr/local/lib/db48 -lcrypto -pthread /usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against `_DYNAMIC' can not be used when making a shared object; recompile with -fPIC /usr/lib/crt1.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status I have not yet tried to recompile with -fPIC
> /usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against `_DYNAMIC' > can not be used when making a shared object; recompile with -fPIC Linker should use Scrt1.o for PIE binary (not crt1.o) > /bin/sh ../libtool --tag CXX --mode=link g++ > ... > /usr/local/bin/ld: qt/qt_bitcoin_qt-bitcoin.o: undefined reference to symbol > '_ZNSt3__18ios_base5clearEj' > //usr/lib/libc++.so.1: error adding symbols: DSO missing from command line Looks like you are trying to mix g++ compiled binary (bitcoin) with clang++ compiled one (boost-libs).
> qt/qt_bitcoin_qt-bitcoin.o not boost-libs. just one (at least?) object file
Try changing compiler:c++0x into compiler:c++11-lang in net-p2p/bitcoin/Makefile: -USES= autoreconf compiler:c++0x gmake libtool pkgconfig shebangfix +USES= autoreconf compiler:c++11-lang gmake libtool pkgconfig shebangfix
Created attachment 169846 [details] log with changing compiler builds fail without changes
(In reply to olexander.v.melnyk from comment #21) So configure does indeed look for an ObjC++ compiler and on your system it uses g++ for that. This is only used on Darwin to compile some files, but because automake detects that it can be used to compile files it generates a Makefile.in that also uses it to link the executable. Your original patch is correct, but I think it can be reduced to just this: +CONFIGURE_ENV+= OBJCXX="${CXX}" OBJCXXFLAGS="${CXXFLAGS}" Can you test this?
(In reply to Tijl Coosemans from comment #22) I checked and you're right, the patch may be reduced (without changing the compiler)
A commit references this bug: Author: tijl Date: Mon May 2 14:20:32 UTC 2016 New revision: 414450 URL: https://svnweb.freebsd.org/changeset/ports/414450 Log: Add OBJCXX and OBJCXXFLAGS to CONFIGURE_ENV. When compiled on Darwin bitcoin-qt needs two extra files that are written in ObjC++. These aren't needed on FreeBSD but because of this the ObjC++ compiler is used as linker instead of the C++ compiler. Without defining OBJCXX clang may be used as C++ compiler while g++ is used as ObjC++ compiler. This may cause link problems. PR: 207110 Submitted by: olexander.v.melnyk@gmail.com Approved by: robbak@robbak.com (maintainer, via email) Changes: head/net-p2p/bitcoin/Makefile