libbitcoin / libbitcoin-system

Bitcoin Cross-Platform C++ Development Toolkit

Home Page:https://libbitcoin.info/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to compile with build boost option

anthonycastellano opened this issue · comments

When attempting to compile the version3 branch of the repo with the install.sh script as so:

sudo ./install.sh --prefix=/home/me/libbitcoin --build-boost

The installation fails on the download + build Boost step with the following error:

In file included from /usr/include/pthread.h:33,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr.h:148,
                 from /usr/include/c++/11/ext/atomicity.h:35,
                 from /usr/include/c++/11/bits/basic_string.h:39,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/locale:39,
                 from ./boost/locale/collator.hpp:16,
                 from libs/locale/src/icu/collator.cpp:9:
./boost/thread/pthread/thread_data.hpp:60:5: error: missing binary operator before token "("
   60 | #if PTHREAD_STACK_MIN > 0
      |     ^~~~~~~~~~~~~~~~~
In file included from /usr/include/pthread.h:33,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr.h:148,
                 from /usr/include/c++/11/ext/atomicity.h:35,
                 from /usr/include/c++/11/bits/basic_string.h:39,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/locale:39,
                 from ./boost/locale/date_time_facet.hpp:18,
                 from libs/locale/src/icu/date_time.cpp:9:
./boost/thread/pthread/thread_data.hpp:60:5: error: missing binary operator before token "("
   60 | #if PTHREAD_STACK_MIN > 0
      |     ^~~~~~~~~~~~~~~~~
In file included from /usr/include/pthread.h:33,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr.h:148,
                 from /usr/include/c++/11/ext/atomicity.h:35,
                 from /usr/include/c++/11/bits/basic_string.h:39,
                 from /usr/include/c++/11/string:55,
                 from ./boost/locale/time_zone.hpp:17,
                 from ./boost/locale/formatting.hpp:17,
                 from libs/locale/src/icu/formatter.cpp:9:
./boost/thread/pthread/thread_data.hpp:60:5: error: missing binary operator before token "("
   60 | #if PTHREAD_STACK_MIN > 0
      |     ^~~~~~~~~~~~~~~~~
In file included from /usr/include/pthread.h:33,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr.h:148,
                 from /usr/include/c++/11/ext/atomicity.h:35,
                 from /usr/include/c++/11/bits/basic_string.h:39,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/locale:39,
                 from libs/locale/src/icu/numeric.cpp:9:
./boost/thread/pthread/thread_data.hpp:60:5: error: missing binary operator before token "("
   60 | #if PTHREAD_STACK_MIN > 0
      |     ^~~~~~~~~~~~~~~~~
...failed updating 4 targets...

real    0m29.704s
user    1m7.927s
sys     0m5.324s

I tried manually modifying the version of Boost downloaded/installed to 1.76.0 in install.sh which did result in a successful build of Boost; however, the subsequent secp256k1 build then failed.

OS: Ubuntu 22.04.2 LTS (WSL2)
g++ version: 11.4.0

Any suggestions?

This is a boost break on select systems including Ubuntu 22. Modification of the referenced line is required due to platforms not defining PTHREAD_STACK_MIN when the value would have been zero previously. My understanding had previously been that boost 1.76 did not resolve this issue. Additional information would be required to provide any meaningful advice regarding secp256k1.

Verified by examining tagged releases that the pthread issue is fixed in 1.73 and beyond. Will attempt verification and reproduction of any subsequent issues. If nothing else arises it becomes an open question as to whether the dependency version should be bumped due to a platform/compiler issue.

Results from Github Actions indicate success between all installation scripts in the tested configurations while varying between Ubuntu 20.04 and 22.04 and boost between 1.73 to 1.76.

  • Ubuntu 20.04 uses clang++ 11.0.0, g++ 9.4.0
  • Ubuntu 22.04 uses clang++ 14.0.0, g++ 11.4.0

Additionally, Ubuntu 20.04 succeeds utilizing boost 1.72 and is the currently targeted environment for testing of version3.

@anthonycastellano Your workaround was along the lines of the way I would approach the initial problem. The above suggests that the environment as described should succeed with the modifications described. Please provide additional details regarding secp256k1 failures.

@evoskuil The initial failure has been previously encountered, but was not related to the current test environment. We should discuss the extent to which version3 should be updated.

Let’s add to agenda for next weekly meeting.

I've just resolved the secp256k1 compile time error - it turns out that WSL2 capped VM memory utilization at 16GB (50% of the 32GB on my system) with 4GB of swap, producing the following error: g++: fatal error: Killed signal terminated program cc1plus. Per the solution here, I created a .wslconfig at C:\Users\user containing:

[wsl2]
memory=24GB

All sources are now successfully compiled - thanks @pmienk @evoskuil.

Thanks for taking the time to resolve and give us the feedback!

Resolved by increasing the minimum required version of boost to 1.73.0 and providing this version via the --build-boost argument in #1372