The difficult part is using the (non-default) gcc-3.4 instead of the (default) gcc (which is at version 3.3) and really getting STLport and Boost to work together. Additionally I normaly want to link statically to STLport and Boost to reduce the number of external dependencies.
stlport/stl/_site_config.h
changing the native include path defines (don't forget to remove the comments :-) )#undef _STLP_NATIVE_INCLUDE_PATH #define _STLP_NATIVE_INCLUDE_PATH ../include #undef _STLP_NATIVE_CPP_C_INCLUDE_PATH #define _STLP_NATIVE_CPP_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH/c++/__GNUC__.__GNUC_MINOR__ #undef _STLP_NATIVE_C_INCLUDE_PATH #define _STLP_NATIVE_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH #undef _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH #define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH _STLP_NATIVE_CPP_C_INCLUDE_PATH
# make -C build/lib -f gcc.mak CC=gcc-3.4 CXX=g++-3.4 all release-static dbg-static stldbg-static # make -C build/lib -f gcc.mak CC=gcc-3.4 CXX=g++-3.4 install
stlport
and the lib
directories to some globally accessible place on the system:# sudo mkdir -p /usr/local/STLport-5/lib # sudo cp -r stlport /usr/local/STLport-5 # sudo cp -r lib /usr/local/STLport-5/lib/dynamic # sudo cp $(find -name "*.a") /usr/local/STLport-5/lib
When linking against this Version of STLport, you need to add /usr/local/STLport-5
to the front of the include and library path (-I
and -L
options)
Building boost is now almost straight forward. Only the multithreading enabled and static version is built since thats the only version of the STLport lib built above (I have not found out how to build several versions of STLport with and without mt etc.)
# bjam \ "-sTOOLS=gcc-stlport" \ "-sBUILD=debug release <threading>multi <runtime-link>static" \ "-sSTLPORT_5_PATH=/usr/local/STLport-5" \ "-sSTLPORT_VERSION=5" \ "-sGXX=g++-3.4" \ "-sGCC=gcc-3.4" \ stage
Now boost can be copied to some central location:
# sudo mkdir -p /usr/local/Boost/lib/dynamic # sudo cp -d boost stage/lib/*.a /usr/local/Boost/lib # sudo cp -d boost stage/lib/*.so* /usr/local/Boost/lib/dynamic
Of course you have to add the correct include/libarary dirs. However there are some other pitfalls:
_REENTRANT
when using STLport, otherwise all the symbols will reside in the wrong namespace. This forces me to link against -lpthread
-ansi
when using int64_t
from cstdint
(which is valid even under -ansi
though long long
is not)