0

I tried to compile 1.55 boost libraries using Ubuntu 12.04. The compiled boost libraries does not allow me to use boost::thread or boost::mutex.

When I look inside the boost/thread/mutex.hpp, the preprocessor fall into:

#error "Boost threads unavailable on this platform"

The same go to boost/thread/thread_only.hpp.

I followed the default compilation option from 1.55 boost.

$ ./bootstrap.sh --prefix=ubu_linux
$ ./b2 install

I also tried clang. Same result. My gcc -v result following:

gcc version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~12.04)

But I noticed that boost build itself using gcc-4.6. I not sure if this cause the problem or not. Which step I missed out that cause my boost do not build the boost::thread library properly? I also moved my boost include folder into /usr/include/, same result. However, I noticed that the ubuntu repo boost libraries, does not have the same problem.

Anyone can correct me how to compile this boost library with thread properly? I want to compile myself and use the latest boost library.

4
  • Do you get this error when compiling Boost or your own program?
    – Igor R.
    Commented Feb 27, 2014 at 13:02
  • I do not get this error on my own program. But I got the error type type boost::thread could not be resolved from Eclipse CDT IDE even though I had included the header <boost/thread.hpp>. I used the same program but using the ubuntu boost library. I don't get this error however, ubuntu boost library is not latest I need the latest boost::thread.
    – Sany Liew
    Commented Feb 27, 2014 at 13:17
  • Sorry, I'm unable to understand how this comment is related to your OP. Anywyay, the issue you describe in the OP might appear with very old Boost versions, but should not arise with the recent ones. Make sure that you've set correct Boost paths for compiler, linker and IDE facilities.
    – Igor R.
    Commented Feb 27, 2014 at 13:26
  • I grab the latest download from boost.org. And I am sure I am using the 1.55 to compile. I faced the type boost::thread not resolve, then I troubleshooted further into my compiled include files, which I saw it fall into "Boost threads unavailable on this platform". The correct preprocessor should be "#include <boost/thread/pthread/thread_data.hpp>". I know it is the correct preprocessor because I checked it with the ubuntu repo boost include folder.
    – Sany Liew
    Commented Feb 27, 2014 at 13:33

0

Your Answer

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

Browse other questions tagged or ask your own question.