Link errors using Boost & STLPort with VC8
I am attempting to compile and link a small test application using STLPort_5.1.3, boost_1_34_1 and MSVC8 sp1. Everything works fine when I don't have to link against any boost libraries. To test linking against the boost static libraries I wrote a simple little test app that used the boost::regex library and ran into errors. I am not completely sure that this is a boost issue but since I can compile and link programs without any problems that don't use boost binaries I wasn't sure of who else to turn to. The linker error I am getting is: 1>LINK : fatal error LNK1104: cannot open file 'stlportstld_x.5.1.lib' The problem is that all of the stlport libraries are named stlportstld.5.1.lib or similar. I did try to just rename the library to make it match but, of course, I got a boat load of unresolved external linker errors pointing to names such as "stlpdx_std::basic_string." Looking at a dumpbin output of the actual regex library it is linking against, libboost_regex-vc80-mt-sgdp-1_34_1.lib, I found linker directives of the form: /DEFAULTLIB:"stlportstld_x.5.1.lib" /DEFAULTLIB:"libcpmtd" /DEFAULTLIB:"LIBCMTD" /DEFAULTLIB:"OLDNAMES" I couldn't find anywhere that boost had put those directives in the libraries but I could be missing something so I also did a dumpbin of one of the stlport libraries, stlportd_static.5.1.lib, and only found the following linker directives: /DEFAULTLIB:"LIBCMTD" /DEFAULTLIB:"OLDNAMES" I have to believe there are at least a few companies out there who have replaced the shipping MSVC STL for testing purposes, if for no other reason, and are also using Boost so hopefully I'm just missing something obvious. Below are the steps I followed to compile both sets of libraries and the test application. Let me know if anything appears to be off or if there is simply a better/easier way. Thanks, Jason Ivey Open command prompt and run: "%VS80COMNTOOLS%\vsvars32.bat" STLPort_5.1.3 build\lib\configure -c msvc8 nmake /fmsvc.mak install Boost_1_34_1 edit tools\build\v2\user-config.jam added line 45 with using stlport : : d:\\build\\stlport\\stlport d:\\build\\stlport\\lib ; bjam --toolset=msvc stdlib=stlport --with-regex stage Build Test Application set include=d:\build\stlport\stlport;D:\build\boost_1_34_1;%include% set lib=d:\build\stlport\lib;D:\build\boost_1_34_1\stage\lib;%lib% call "%VS80COMNTOOLS%\..\IDE\devenv.exe" /useenv
I am attempting to compile and link a small test application using STLPort_5.1.3, boost_1_34_1 and MSVC8 sp1. Everything works fine when I don't have to link against any boost libraries. To test linking against
A couple of other hints...
I was compiling this test application for debug mode and ran into the linker
error. When I compiled and linked the application in release mode it worked
without any problems at all.
When I tried forcing the application to link against the library I renamed
it came back with a long list of unresolved externals pointing towards
objects in the "stlpx_std" namespace. I found that this namespace is
getting defined in debug mode when the symbol
_STLP_USING_CROSS_NATIVE_RUNTIME_LIB is set in
stlport/stl/config/features.h. Then the auto linking is forcing to link
against the library, stlportstld_x.5.1.lib, mentioned in my last message in
the file stlport/stl/config/_auto_link.h again because of the symbol
_STLP_USING_CROSS_NATIVE_RUNTIME_LIB is defined. The symbol looks to be
initially defined in the file stlport/stl/config/_detect_dll_or_lib.h.
My question now is why when I compile STLPort is this symbol not defined,
but later when I compile Boost specifying stdlib=stlport does it end up
defining this symbol?
Thanks again,
Jason
"Jason Ivey"
boost static libraries I wrote a simple little test app that used the boost::regex library and ran into errors. I am not completely sure that this is a boost issue but since I can compile and link programs without any problems that don't use boost binaries I wasn't sure of who else to turn to. The linker error I am getting is:
1>LINK : fatal error LNK1104: cannot open file 'stlportstld_x.5.1.lib'
The problem is that all of the stlport libraries are named stlportstld.5.1.lib or similar. I did try to just rename the library to make it match but, of course, I got a boat load of unresolved external linker errors pointing to names such as "stlpdx_std::basic_string." Looking at a dumpbin output of the actual regex library it is linking against, libboost_regex-vc80-mt-sgdp-1_34_1.lib, I found linker directives of the form:
/DEFAULTLIB:"stlportstld_x.5.1.lib" /DEFAULTLIB:"libcpmtd" /DEFAULTLIB:"LIBCMTD" /DEFAULTLIB:"OLDNAMES"
I couldn't find anywhere that boost had put those directives in the libraries but I could be missing something so I also did a dumpbin of one of the stlport libraries, stlportd_static.5.1.lib, and only found the following linker directives:
/DEFAULTLIB:"LIBCMTD" /DEFAULTLIB:"OLDNAMES"
I have to believe there are at least a few companies out there who have replaced the shipping MSVC STL for testing purposes, if for no other reason, and are also using Boost so hopefully I'm just missing something obvious. Below are the steps I followed to compile both sets of libraries and the test application. Let me know if anything appears to be off or if there is simply a better/easier way.
Thanks,
Jason Ivey
Open command prompt and run: "%VS80COMNTOOLS%\vsvars32.bat"
STLPort_5.1.3 build\lib\configure -c msvc8 nmake /fmsvc.mak install
Boost_1_34_1 edit tools\build\v2\user-config.jam added line 45 with using stlport : : d:\\build\\stlport\\stlport d:\\build\\stlport\\lib ; bjam --toolset=msvc stdlib=stlport --with-regex stage
Build Test Application set include=d:\build\stlport\stlport;D:\build\boost_1_34_1;%include% set lib=d:\build\stlport\lib;D:\build\boost_1_34_1\stage\lib;%lib% call "%VS80COMNTOOLS%\..\IDE\devenv.exe" /useenv
Jason Ivey wrote:
1>LINK : fatal error LNK1104: cannot open file 'stlportstld_x.5.1.lib'
The problem is that all of the stlport libraries are named stlportstld.5.1.lib or similar. I did try to just rename the library to make it match but, of course, I got a boat load of unresolved external linker errors pointing to names such as "stlpdx_std::basic_string." Looking at a dumpbin output of the actual regex library it is linking against, libboost_regex-vc80-mt-sgdp-1_34_1.lib, I found linker directives of the form:
Not sure, but I believe the debug versions of Boost lib's built against STLPort are built with __STL_DEBUG defined, so you will need to do likewise when building your application. Also don't forget that Boost.Regex is "Just a bunch of sources" so you could turn auto-linking off (define BOOST_REGEX_NO_LIB or BOOST_ALL_NO_LIB) and link against your own build of the regex sources (just build all of libs/regex/src/*.cpp into a static lib). HTH, John.
participants (2)
-
Jason Ivey
-
John Maddock