Boost libraries and QtCreator on OSX - all together now
After first contact with the Boost libraries I faced first obstacles, sorted them out and tried to use them with QtCreator. Upon subsequent reading some mails and forum entries this problem is not uncommon, but nobody provided a solution. So I used this journey to figure it out on my own.
Here is a follow up with the concentrated insight.
- prepare the build process (this time all libraries)
export build=~/devtools # or wherever you'd like to build
cd $build/boost_1_53_0
# remove traces from the last time
./b2 --clean-all
rm project-config.jam*
# prepare
./bootstrap.sh
#output
-n Building Boost.Build engine with toolset darwin...
tools/build/v2/engine/bin.macosxx86_64/b2
-n Detecting Python version...
2.7
-n Detecting Python root...
/System/Library/Frameworks/Python.framework/Versions/2.7
-n Unicode/ICU support for Boost.Regex?...
not found.
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
./b2
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html
- Boost.Build documentation:
http://www.boost.org/boost-build2/doc/html/index.html
- build
./b2
#output
Building the Boost C++ Libraries.
Performing configuration checks
- 32-bit : no
- 64-bit : yes
- x86 : yes
- has_icu builds : no
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam
- iconv (libc) : no
- iconv (separate) : yes
- icu : no
- icu (lib64) : no
- gcc visibility : yes
- long double support : yes
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
Component configuration:
- atomic : building
- chrono : building
- context : building
- date_time : building
- exception : building
- filesystem : building
- graph : building
- graph_parallel : building
- iostreams : building
- locale : building
- math : building
- mpi : building
- program_options : building
- python : building
- random : building
- regex : building
- serialization : building
- signals : building
- system : building
- test : building
- thread : building
- timer : building
- wave : building
# many, many lines of comments
# felt like 5 minutes compile time
...updated 748 targets...
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
/Users/sven/devtools/boost_1_53_0
The following directory should be added to linker library paths:
/Users/sven/devtools/boost_1_53_0/stage/lib
- Change the
install_name
in all libraries
cd $build/boost_1_53_0/stage/lib
for DYNLIB in $(ls libboost*.dylib);do install_name_tool -id "$(pwd)/${DYNLIB}" "$(pwd)/${DYNLIB}";done
for OUTER in $(ls libboost*.dylib);do for INNER in $(ls libboost*.dylib);do install_name_tool -change "${INNER}" "@loader_path/${INNER}" ${OUTER};done;done
- check one of them
otool -L $build/boost_1_53_0/stage/lib/libboost_filesystem.dylib /Users/sven/devtools/boost_1_53_0/stage/lib/libboost_filesystem.dylib:
/Users/sven/devtools/boost_1_53_0/stage/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)
@loader_path/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
- configure usage in
.PRO
file of QtCreator
QMAKE_POST_LINK += ;/Developer/Tools/Qt/macdeployqt $${OUT_PWD}/$${TARGET}.app -no-strip
Done :-)