Boost.config not recognize threading support enabled?

[Please ignore exemplar in previous missive. I can't seem to cancel it.] Apologies in advance if this belongs on the boost-users@lists.boost.org list. After my posting vast quantities of [probably worthless] example output on jamboost@yahoogroups.com, Vladimir Prus provided [I added the -Is] this example and suggested I post it here where the Boost.config maintainers might be able to help. OS is Fedora3 on x86. We have empirically confirmed the cross-compiler being used supports pthreads. ALL the rest of the boost libs compiled successfully (with only the occasional warning). I'm only 13 targets from home. <exemplar apologies=worthless-line-wrapping> Program file test.cpp contains only the following line: #include <boost/thread/condition.hpp> [root@mycomputer boost_1_32_0]# "/opt/crosstool/arm-softfloat-linux-gnu/gcc-3.3.3-glibc-2.3.2/bin/arm-so ftfloat-linux-gnu-c++" \ -I/usr/local/boost_1_32_0 \ -I/opt/crosstool/arm-softfloat-linux-gnu/gcc-3.3.3-glibc-2.3.2/include/c ++/3.3.3/ \ -I/opt/crosstool/arm-softfloat-linux-gnu/gcc-3.3.3-glibc-2.3.2/include/c ++/3.3.3/arm-softfloat-linux-gnu/bits/ \ -pthread test.cpp In file included from /usr/local/boost_1_32_0/boost/thread/detail/config.hpp:18, from /usr/local/boost_1_32_0/boost/thread/condition.hpp:15, from test.cpp:1: /usr/local/boost_1_32_0/boost/config/requires_threads.hpp:47:5: #error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" [root@mycomputer boost_1_32_0]# </exemplar> I tried working my way through the config headers and got TOTALLY lost. I tried -H, -E and #warning before I gave up and submitted this missive. Even if you can provide the answer "off the top of your head", would you mind providing a pointer or two toward the correct path to finding the problem? I'd appreciate that at least as much as the solution itself. Sincere thanks in advance, Dick Bridges "For every complex problem, there is a solution that is simple, neat, and wrong." H.L. Mencken

I tried working my way through the config headers and got TOTALLY lost. I tried -H, -E and #warning before I gave up and submitted this missive. Even if you can provide the answer "off the top of your head", would you mind providing a pointer or two toward the correct path to finding the problem? I'd appreciate that at least as much as the solution itself.
If you look at the line that triggers the #error, you will see it is within a block scoped by: #elif !defined(BOOST_HAS_THREADS) so the error is triggered by BOOST_HAS_THREADS not being defined. If you now grep through the boost/config headers you will see: In suffix.hpp: #if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \ || defined(_PTHREADS)) && !defined(BOOST_HAS_THREADS) # define BOOST_HAS_THREADS #endif Which is the catch-all case - for gcc on linux, if threading support has been enabled in the compiler then _REENTRANT is usually defined, clearly it's not in your case, unless that is BOOST_HAS_THREADS is being #undef'ed later on by: #if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\ && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS)\ && !defined(BOOST_HAS_MPTASKS) # undef BOOST_HAS_THREADS #endif Which is there in case the config system doesn't know what kind of threading support the platform uses (pthreads win32 threads mptasks etc). If this is the case it's probably because unistd.h doesn't advertise pthread support with _POSIX_THREADS. Also note: for OS'es that are not linux, threading support may get turned on unconditionally in gcc.hpp (I don't think this is relevant here), also for gcc 3.4 and later, threading support is turned on or else forced off in libstdc++.hpp depending on how your std lib was built. To find out which of the above is the cause the easiest way I find is to through some #errors in the preprocessor branches you think may be taken and then see if the #error is triggered or not (this is much easier than preprocessing the code IMO). To help you more we probably need: The gcc version. The command line that produced the above error. The output from the config_info program (cd into libs/config/test then "bjam -sBUILD="<threading>multi" config_info", then look for output the program generated somewhere under boost-path/bin/boost/libs/config/test/config_info/ ...some directories... /*.output Hope this gets you further forward. John.
participants (2)
-
BRIDGES Dick
-
John Maddock