Build error on Mac when building tests #5064

issue pnagurny opened this issue on October 8, 2014
  1. pnagurny commented at 7:31 PM on October 8, 2014: none

    Everything compiles and links properly, except for test_bitcoin:

    ........ CXX test/test_test_bitcoin-util_tests.o CXX test/test_test_bitcoin-scriptnum_tests.o CXX test/test_test_bitcoin-sighash_tests.o CXX test/test_test_bitcoin-accounting_tests.o CXX test/test_test_bitcoin-wallet_tests.o CXX test/test_test_bitcoin-rpc_wallet_tests.o CXXLD test/test_bitcoin clang: warning: argument unused during compilation: '-pthread' clang: warning: argument unused during compilation: '-pie' clang: warning: argument unused during compilation: '-pthread' ld: entry point (_main) undefined. for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [test/test_bitcoin] Error 1 make: *** [all-recursive] Error 1

  2. theuni commented at 7:39 PM on October 8, 2014: member

    How was boost built?

  3. pnagurny commented at 8:00 PM on October 8, 2014: none

    I installed boost via brew (1.55.0_2). I ran ./configure --with-boost=/usr/local/Cellar/boost/1.55.0_2 to ensure this version of boost was used. I get the same error if I use the boost in /usr/local/include. (Not sure which version of boost that one is.)

  4. laanwj commented at 12:12 PM on October 9, 2014: member

    Strange. Have you tried restarting from a clean tree?

  5. pnagurny commented at 4:18 PM on October 9, 2014: none

    Yeah I blew away the whole directory and cloned from github.

  6. theuni commented at 4:23 PM on October 9, 2014: member

    @pnagurny Could you please pastebin a config.log? The only think I can think of is a weird boost setup, a log should point to what's different.

  7. pnagurny commented at 4:33 PM on October 9, 2014: none
  8. theuni commented at 5:10 PM on October 9, 2014: member

    Thanks. I think I might've spotted the issue. Please give this a try:

    diff --git a/configure.ac b/configure.ac
    index abf9f39..2668006 100644
    --- a/configure.ac
    +++ b/configure.ac
    @@ -519,7 +519,7 @@ if test x$use_tests = xyes; then
       dnl Determine if -DBOOST_TEST_DYN_LINK is needed
       AC_MSG_CHECKING([for dynamic linked boost test])
       TEMP_LIBS="$LIBS"
    -  LIBS="$LIBS $BOOST_UNIT_TEST_FRAMEWORK_LIB"
    +  LIBS="$BOOST_LDFLAGS $LIBS $BOOST_UNIT_TEST_FRAMEWORK_LIB"
       TEMP_CPPFLAGS="$CPPFLAGS"
       CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
       AC_LINK_IFELSE([AC_LANG_SOURCE([
    

    After applying that, run ./autogen.sh and configure as usual. If that fixes, I'll PR this or something similar to master.

  9. pnagurny commented at 6:04 PM on October 9, 2014: none

    Well that solved test_bitcoin not linking - I didn't realize from before, but there was also an issue with bitcoin-qt linking:

    CXX test/test_test_bitcoin-wallet_tests.o CXX test/test_test_bitcoin-rpc_wallet_tests.o CXXLD test/test_bitcoin clang: warning: argument unused during compilation: '-pthread' clang: warning: argument unused during compilation: '-pie' clang: warning: argument unused during compilation: '-pthread' CXX qt/qt_bitcoin_qt-bitcoin.o OBJCXX qt/qt_bitcoin_qt-macdockiconhandler.o OBJCXX qt/qt_bitcoin_qt-macnotificationhandler.o OBJCXXLD qt/bitcoin-qt libtool: link: unable to infer tagged configuration libtool: link: specify a tag with `--tag' make[1]: *** [qt/bitcoin-qt] Error 1 make: *** [all-recursive] Error 1

  10. theuni commented at 6:14 PM on October 9, 2014: member

    We've seen this before. Good odds your env is poisoned from some other dev. Assuming it's the same issue as last time, I'd like to know more about it so that we can possibly work around it.

    Can you check your env for exported CC/CXX/etc which may be interfering ?

  11. pnagurny commented at 6:19 PM on October 9, 2014: none

    Here are the relevant variables in my env:

    CPP=cpp CXX=clang++ CC=clang

  12. theuni commented at 6:24 PM on October 9, 2014: member

    Ok, thank you. For now, please unset those. configure checks and stashes them so there's no need to have them exported. Now that I have something to test with, I'll see if I can come up with a real fix.

  13. pnagurny commented at 6:30 PM on October 9, 2014: none

    That got me farther. Now I'm getting this:

    Making all in src OBJCXXLD qt/bitcoin-qt clang: warning: argument unused during compilation: '-pthread' clang: warning: argument unused during compilation: '-pie' clang: warning: argument unused during compilation: '-pthread' CXX qt/test/qt_test_test_bitcoin_qt-test_main.o In file included from qt/test/test_main.cpp:12: In file included from qt/test/paymentservertests.h:8: In file included from qt/test/../paymentserver.h:34: In file included from ./qt/paymentrequestplus.h:8: ./qt/paymentrequest.pb.h:9:10: fatal error: 'google/protobuf/stubs/common.h' file not found #include <google/protobuf/stubs/common.h> ^ 1 error generated. make[1]: *** [qt/test/qt_test_test_bitcoin_qt-test_main.o] Error 1 make: *** [all-recursive] Error 1

    I have the file here: /usr/local/Cellar/protobuf/2.5.0/include/google/protobuf/stubs/common.h

    src/Makefile has: PROTOBUF_CFLAGS = -D_THREAD_SAFE -I/usr/local/Cellar/protobuf/2.5.0/include PROTOBUF_LIBS = -L/usr/local/Cellar/protobuf/2.5.0/lib -lprotobuf -D_THREAD_SAFE

  14. theuni commented at 6:46 PM on October 9, 2014: member

    Ok. See patch below. FYI, it seems that most (all?) of your homebrew packages are keg-only. There's nothing wrong with that and it should work (I'm hoping this last one is all it takes), but it seems you're the first to be doing it that way. Sorry for the extra hassle.

    diff --git a/src/Makefile.qttest.include b/src/Makefile.qttest.include
    index 2cba5b7..23375be 100644
    --- a/src/Makefile.qttest.include
    +++ b/src/Makefile.qttest.include
    @@ -13,7 +13,7 @@ TEST_QT_H = \
       qt/test/paymentservertests.h
    
     qt_test_test_bitcoin_qt_CPPFLAGS = $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
    -  $(QT_INCLUDES) $(QT_TEST_INCLUDES)
    +  $(QT_INCLUDES) $(QT_TEST_INCLUDES) $(PROTOBUF_CFLAGS)
    
     qt_test_test_bitcoin_qt_SOURCES = \
       qt/test/test_main.cpp \
    
  15. pnagurny commented at 7:01 PM on October 9, 2014: none

    Well that fixes everything - the build completes now. It seems like protobuf for whatever reason does not create a symlink in /usr/local/include when I do brew link protobuf. Other kegs have (boost, leveldb, and more).

    Thanks a lot for your help!

  16. theuni commented at 7:07 PM on October 9, 2014: member

    Thanks for your patience. I'll submit those two as fixes. As for the environment, I'm not sure if that's our problem to fix, I'll need to look into it more.

  17. laanwj closed this on Oct 11, 2014

  18. bernied commented at 1:21 AM on January 26, 2015: none

    I cloned the latest repository, checked out tag v0.9.4 and attempted to build and had this exact same (first) error. I added the the $BOOST_LDFLAGS as recommended by theuni and I was able to build everything no problem. Claims this is merged, but I assumed not into v0.9.4?

  19. skaht commented at 2:47 AM on February 9, 2015: none

    FBSA,

    I second the observation above for OSX 10.10 environment, the configure.ac for v0.9.4, the last stable configuration, did not have its configure.ac file updated with the following delta mentioned above:

    • LIBS="$LIBS $BOOST_UNIT_TEST_FRAMEWORK_LIB"
    • LIBS="$BOOST_LDFLAGS $LIBS $BOOST_UNIT_TEST_FRAMEWORK_LIB"

    This change, mentioned above, made the difference between getting Bitcoin to compile or seeing the following error message:

    CXX test_bitcoin-accounting_tests.o CXX test_bitcoin-wallet_tests.o CXX test_bitcoin-rpc_wallet_tests.o CXXLD test_bitcoin clang: warning: argument unused during compilation: '-pie' ld: entry point (_main) undefined. for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[4]: *** [test_bitcoin] Error 1 make[3]: *** [all] Error 2 make[2]: *** [all-recursive] Error 1 make[1]: *** [all] Error 2 make: *** [all-recursive] Error 1

  20. skaht commented at 3:42 AM on February 23, 2015: none

    Please update the tag v0.9.4 configure.ac file to reflect the trivial build bug fix, see https://github.com/skaht/bitcoin/commit/8c7af534c336b6dccd201274eef74c34fd7e8311.

    I'm very new to using git. For whatever reason, Github web pages are not allowing me to complete a pull-request. Hence, the followup here.

    Base fork: bitcoin/bitcoin ; Base: v0.9.4 Head fork: skaht/bitcoin ; Compare: build/v0.9.4/pr-5064

  21. fanquake commented at 4:37 AM on February 23, 2015: member

    @skaht It has already been backported to the 0.9 branch in #5780

  22. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me