"No working boost sleep implementation" libpthread required by librt #3274

issue fryx opened this issue on November 17, 2013
  1. fryx commented at 9:20 PM on November 17, 2013: none

    libpthread not getting linked, required by librt. is this a librt problem?

    full config.log at https://gist.github.com/fryx/bdf3bee728b8cbbac18a

    configure:11734: $? = 0 configure:11748: result: yes configure:11886: g++ -o conftest -I/usr/local/BerkeleyDB.4.8/include -L/usr/local/BerkeleyDB.4.8/lib/ -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -fPIE -fno-stack-protector -fstack-protector-all -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -Wl,-z,now conftest.cpp -L/usr/lib -lboost_system-mt -lboost_filesystem-mt -lboost_program_options-mt -lboost_thread-mt -lboost_chrono-mt >&5 /usr/lib/gcc/x86_64-alpine-linux-uclibc/4.7.3/../../../../x86_64-alpine-linux-uclibc/bin/ld: /lib/librt.so.0.9.32: undefined reference to symbol 'pthread_cancel' /usr/lib/gcc/x86_64-alpine-linux-uclibc/4.7.3/../../../../x86_64-alpine-linux-uclibc/bin/ld: note: 'pthread_cancel' is defined in DSO /lib/libpthread.so.0.9.32 so try adding it to the linker command line /lib/libpthread.so.0.9.32: could not read symbols: Invalid operation collect2: error: ld returned 1 exit status configure:11886: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "Bitcoin" | #define PACKAGE_TARNAME "bitcoin"

  2. laanwj commented at 4:10 PM on January 17, 2014: member

    The problem here is that the BOOST_CPPFLAGS aren't passed when doing the sleep test. Should be fixed by: https://github.com/laanwj/bitcoin/commit/714cdecb0398a075e80e2263a09b9fb3a4fe70ea (part of #2704)

  3. basicecon commented at 4:43 AM on September 11, 2014: none

    the updated version of configure.ac has the fix. still have the same issue. config.log at https://gist.github.com/aa6779337bcbb4ae8943.git

  4. laanwj commented at 6:36 AM on September 11, 2014: member

    @kathy007 that gist link doesn't work (shows as empty here)

  5. basicecon commented at 12:27 PM on September 11, 2014: none
  6. laanwj commented at 1:06 PM on September 11, 2014: member

    Curious - both test programs fail to link.

    configure:23587: g++ -o conftest -L/usr/local/include -Wstack-protector -fstack-protector-all -fPIE -fvisibility=hidden -I/bitcoin/db4/include/ -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -pthread -I/usr/include -L/bitcoin/db4/lib/ -Wl,-z,relro -Wl,-z,now -pie conftest.cpp -L/usr/lib -lboost_system -lboost_filesystem -lboost_program_options-mt -lboost_thread -lboost_chrono-mt -lminiupnpc -lminiupnpc -lminiupnpc -lminiupnpc -lrt -lanl >&5
    /tmp/ccgxbg06.o: In function `boost::this_thread::sleep_for(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&)':
    conftest.cpp:(.text._ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE[_ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE]+0x4d): undefined reference to `boost::this_thread::hiden::sleep_for(timespec const&)'
    collect2: error: ld returned 1 exit status
    
    configure:23627: g++ -o conftest -L/usr/local/include -Wstack-protector -fstack-protector-all -fPIE -fvisibility=hidden -I/bitcoin/db4/include/ -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -pthread -I/usr/include -L/bitcoin/db4/lib/ -Wl,-z,relro -Wl,-z,now -pie conftest.cpp -L/usr/lib -lboost_system -lboost_filesystem -lboost_program_options-mt -lboost_thread -lminiupnpc -lminiupnpc -lminiupnpc -lminiupnpc -lrt -lanl >&5
    /tmp/ccIBP6Rb.o: In function `boost::this_thread::sleep(boost::posix_time::ptime const&)':
    conftest.cpp:(.text._ZN5boost11this_thread5sleepERKNS_10posix_time5ptimeE[_ZN5boost11this_thread5sleepERKNS_10posix_time5ptimeE]+0x4d): undefined reference to `boost::this_thread::hiden::sleep_until(timespec const&)'
    collect2: error: ld returned 1 exit status
    

    Very strange. This could be a conflict between two sets of boost libraries. @theuni do you have any idea what could cause this? I'm especially wondering at the -lboost_system -lboost_filesystem -lboost_program_options-mt -lboost_thread part. Some of the libraries have -mt, some do not, which seems to suggest it is mixing two sets of libraries. What platform is this, and which boost version?

  7. basicecon commented at 1:08 PM on September 11, 2014: none

    I'm using debian 7.6 and boost1.56.0

  8. laanwj commented at 1:23 PM on September 11, 2014: member

    Did you compile boost from source, or are you using the distro-provided dev packages?

  9. basicecon commented at 1:26 PM on September 11, 2014: none

    I didn't use the package, just followed build-unix.md.

  10. theuni commented at 8:30 PM on September 11, 2014: member

    You didn't give a --with-boost option to point to the one you compiled, so it's finding the ones on your system (which are presumably borked, which is why you're building your own). Use something like ./configure --with-boost=/usr/local, where /usr/local is the prefix where boost was installed.

  11. basicecon commented at 9:54 PM on September 11, 2014: none

    Hi Thanks @theuni for your help! I think that solves the "sleep implementation problem" but I'm getting another problem : configure: error: pkg-config not found. (I updated the gist)

  12. theuni commented at 10:08 PM on September 11, 2014: member

    apt-get install pkg-config. Is that not listed in the required packages?

  13. basicecon commented at 10:24 PM on September 11, 2014: none

    it works. Thank you so much for your help!

  14. laanwj closed this on Nov 25, 2014

  15. transonly commented at 10:44 PM on December 11, 2016: none

    On Debian 8 with all the dependencies required for the install i'm still getting this result.

        ./configure CPPFLAGS="-I/usr/local/BerkeleyDB.4.8/include -O2" LDFLAGS="-L/usr/local/BerkeleyDB.4.8/lib" CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768" --with-boost="/usr/include/boost" --with-boost-libdir="/usr/lib/x86_64-linux-gnu"
  16. Giszmo commented at 6:42 PM on March 17, 2017: none

    On ubuntu I was running into this after no error with sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev. sudo apt-get install libboost-all-dev fixed it.

  17. laanwj commented at 11:15 AM on March 18, 2017: member

    What ubuntu version?

  18. Bushstar referenced this in commit 26fb682e91 on Apr 8, 2020
  19. MarcoFalke 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-17 18:15 UTC

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