staticially linked STLport and Boost
I've compiled STLport for vc6, and can compile Boost with this: bjam "-sTOOLS=msvc-stlport" "-sBUILD=debug <stlport-iostream>on" So far so good, but when I try to compile a simple Boost.Python example (why I got Boost) I get a heap of link errors because Boost has linked with the DLL version of STLport, and I want it statically linked. I thought it's meant to default to static, but I can only guess that STLport is detecting otherwise. So, in order to force Boost to use the static verion, I tried: bjam "-sTOOLS=msvc-stlport" "-sBUILD=debug <stlport-iostream>on <define>_STLP_USE_STATIC_LIB" But now I get errors like: vc-Link libs\python\build\bin\boost_python.dll\msvc-stlport\debug\runtime-link-dynamic\stlport-cstd-namespace-std\stlport-iostream-on\stlport-version-4.5.3\boost_python_debug.dll libs\python\build\bin\boost_python.dll\msvc-stlport\debug\runtime-link-dynamic\stlport-cstd-namespace-std\stlport-iostream-on\stlport-version-4.5.3\boost_python_debug.lib msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::bad_alloc::bad_alloc(char const *)" (??0bad_alloc@std@@QAE@PBD@Z) already defined in stlport_vc6_stldebug_static.lib(dll_main.obj) LIBCMTD.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already defined in MSVCRTD.lib(MSVCRTD.dll) LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in MSVCRTD.lib(MSVCRTD.dll) ...lots more errors... This isn't just a problem with Boost.Python. Anything else that builds a dll or exe has the same errors. The first error seems really strange, because I can't understand how std::bad_alloc should exist in stlport_vc6_stldebug_static.lib(dll_main.obj). STLport does define it's own bad_alloc, but it also #defines std to _STL so there should be no 'std'. When I use bad_alloc in my own programs I don't have any problems, so I can only assume it's Boost. I've wasted so much time trying to work this out, but I don't know much about the Boost build process. What's going wrong?
hh10k wrote:
But now I get errors like: LIBCMTD.lib MSVCRTD.lib(MSVCRTD.dll)
You can't mix and match the run-time libraries. Everything linked together needs to be compiled using the same option /MT or /MD or which ever you are using. I'm not knowledgeable about STLport and bjam (I only use things implemented in headers from Boost), but I'm pretty sure your problem stems from the C++ runtimes you are using. Jason
"hh10k"
I've compiled STLport for vc6, and can compile Boost with this:
bjam "-sTOOLS=msvc-stlport" "-sBUILD=debug <stlport-iostream>on"
So far so good, but when I try to compile a simple Boost.Python example (why I got Boost) I get a heap of link errors because Boost has linked with the DLL version of STLport, and I want it statically linked. I thought it's meant to default to static, but I can only guess that STLport is detecting otherwise.
So, in order to force Boost to use the static verion, I tried:
bjam "-sTOOLS=msvc-stlport" "-sBUILD=debug <stlport-iostream>on <define>_STLP_USE_STATIC_LIB"
try bjam "-sTOOLS=msvc-stlport" "-sBUILD=debug <runtime-link>static <stlport-iostream>on" ^^^^^^^^^^^^^^^^^^^^ -- Dave Abrahams Boost Consulting www.boost-consulting.com
try
bjam "-sTOOLS=msvc-stlport" "-sBUILD=debug <runtime-link>static <stlport-iostream>on"
The default Boost.Python settings seem to conflict with <runtime-link>static, but after some fiddling I worked out how to fix it. I thought it wouldn't need this, but I also needed to force "<threading>multi" to get it passed the final set of linking problems. Of course, it seems to work at the moment, and I'll probably be back here if/when I start getting strange crashes :) Thanks for the pointer in the right direction :)
participants (3)
-
David Abrahams
-
hh10k
-
Jason Winnebeck