how to link libraries in Jamroot?
Hello, I am not very experienced with boost. I try to learn how to use the boost.thread library. After early bjam compilation errors (undefined references, because the boost_thread library was not linked), I found that this Jamroot creates my executable successfully: exe threadtest : threadtest.cpp : <library>/usr/lib/libboost_thread-gcc42-mt-1_34_1.so.1.34.1 ; Is it possible to simplify the <library> parameter to something like "boost_thread"? The reason is that I am developing on different systems with different boost versions, so that I don't want to hardcode the library version in the Jamroot. I thought that the boost.build system should be smart enough that it finds the appropriate library file if you only tell it "use the thread library please". How can I make the Jamroot independent from the boost installation and, more importantly, from the operation system? Best wishes, A. Kalaghan
AMDG Arne Kalaghan wrote:
I am not very experienced with boost. I try to learn how to use the boost.thread library. After early bjam compilation errors (undefined references, because the boost_thread library was not linked), I found that this Jamroot creates my executable successfully:
exe threadtest : threadtest.cpp : <library>/usr/lib/libboost_thread-gcc42-mt-1_34_1.so.1.34.1 ;
Is it possible to simplify the <library> parameter to something like "boost_thread"? The reason is that I am developing on different systems with different boost versions, so that I don't want to hardcode the library version in the Jamroot. I thought that the boost.build system should be smart enough that it finds the appropriate library file if you only tell it "use the thread library please".
How can I make the Jamroot independent from the boost installation and, more importantly, from the operation system?
You can use the boost module. For documentation run bjam --help boost In Christ, Steven Watanabe
Arne Kalaghan wrote:
Hello, I am not very experienced with boost. I try to learn how to use the boost.thread library. After early bjam compilation errors (undefined references, because the boost_thread library was not linked), I found that this Jamroot creates my executable successfully:
exe threadtest : threadtest.cpp : <library>/usr/lib/libboost_thread-gcc42-mt-1_34_1.so.1.34.1 ;
Is it possible to simplify the <library> parameter to something like "boost_thread"? The reason is that I am developing on different systems with different boost versions, so that I don't want to hardcode the library version in the Jamroot. I thought that the boost.build system should be smart enough that it finds the appropriate library file if you only tell it "use the thread library please".
How can I make the Jamroot independent from the boost installation and, more importantly, from the operation system?
It depends on whether you plan to have Boost source tree available around, or not. If yes, then you can have: use-project /boost : <path-to-boost> ; and then: <library>/boost//boost_thread whenever you need it. If you want to link against system-wide Boost, you probably should be using searched-lib boost_thread ; and then use 'boost_thread' somewhere. Unfortunately, many Linux distros ship binaries with full decoration, it's a bit hard to deal with. See contrib/boost.jam for one possible solution. - Volodya
participants (3)
-
Arne Kalaghan
-
Steven Watanabe
-
Vladimir Prus