33

i have some problem with my boost library. i m using freebsd and installed my boost using ports. Boost version is : 1.45 and i use g++47 as compiler. Also i have never defined BOOST DISABLE THREADS at there : /usr/local/include/boost/config/user.hpp .Also exactly my error is :

 /usr/local/include/boost/config/requires_threads.hpp:29:4: error: #error "Threading    support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS" 

explicitly but where ?? And my compile command;

 g++47 -O3 -Wall -std=c++0x   -I. -Iinclude -I../include -I/usr/local/include   -c -o     Application.o src/Application.cpp

Thanks

2 Answers 2

44

The experimental GCC version 4.7 disables Boost.Threads. See: https://svn.boost.org/trac/boost/ticket/6165

Edit: It should be noted that as of the release version of GCC 4.7, and Boost higher than 1.48 (Boost_1_48_0 is still not working), threads works again.

5
  • 12
    GCC doesn't "disable" anything, Boost.Threads 1.47 failed to correctly detect thread support in the compiler, because the undocumented implementation detail that Boost relied on changed. This is also nothing to do with experimental vs release versions, the same applies to all versions of 4.7 Commented Feb 19, 2013 at 16:44
  • 2
    Interesting, I have this same problem with gcc 4.8.1 and boost 1.55 - is there any solution other than backing up to 4.7?
    – Arunas
    Commented Dec 13, 2013 at 22:33
  • GCC 4.8.1 + Boost 1_47 same error. Apparently it's boost using an undocumented feature to detect something, that no longer works on later GCC versions...?
    – Mike
    Commented Jan 31, 2014 at 16:56
  • Just upgraded Boost. GCC 4.8.1 + Boost 1_55, again same error.
    – Mike
    Commented Jan 31, 2014 at 17:40
  • 2
    @Mike: See the ticket 6165 mentioned above by Joachim: To define 'threads' support, GCC <= 4.6 defines '_GLIBCXX__PTHREADS', whereas GCC >= 4.7 defines '_GLIBCXX_HAS_GTHREADS'. So, in order to compile older Boosts using any GCC more recent than 4.6 you need the patch libstdcpp3.hpp.patch enclosed in that ticket. URL: svn.boost.org/trac/boost/attachment/ticket/6165/…
    – DrYak
    Commented Jun 25, 2014 at 16:23
9

See the ticket 6165 mentioned above by Joachim:
To define 'threads' support,

  • GCC <= 4.6 defines _GLIBCXX__PTHREADS
  • whereas GCC >= 4.7 defines _GLIBCXX_HAS_GTHREADS.
So, in order to compile older Boosts using any GCC more recent than 4.6 you need the patch libstdcpp3.hpp.patch enclosed in that ticket.

Another problem that could also prevent Boost on working with modern compiler is ticket 6940 (TIME_UTC has a special meanhing in C11, therefore Boost >= 1.50 use TIME_UTC_ instead)

1
  • This is such a helpful answer, saved me a ton of time, thanks!
    – JZL003
    Commented Apr 21, 2021 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.