Unable to build Boost with STLport library

北慕城南 提交于 2019-12-22 05:07:33

问题


I'm building boost 1.48.0 with STLport 5.2.1 on Windows using MSVC 7.1 and here is the command line I run:

b2 toolset=msvc link=shared threading=multi runtime-link=shared variant=debug stdlib=stlport --layout=tagged stage

My user-config.jam is setup like so:

using msvc : 7.1 ;
using stlport : 5.2.1 : C:/Code/third_party_source/STLport-5.2.1/stlport : C:/Code/third_party_source/STLport-5.2.1/lib ;

I get several linker errors relating to STLport. One of them looks like this:

path.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall stlpd
_std::basic_string<wchar_t,class stlpd_std::char_traits<wchar_t>,class stlpd_std::allocator<wchar_t>
 >::basic_string<wchar_t,class stlpd_std::char_traits<wchar_t>,class stlpd_std::allocator<wchar_t> >
(class stlpd_std::basic_string<wchar_t,class stlpd_std::char_traits<wchar_t>,class stlpd_std::alloca
tor<wchar_t> > const &)" (__imp_??0?$basic_string@_WV?$char_traits@_W@stlpd_std@@V?$allocator@_W@2@@
stlpd_std@@QAE@ABV01@@Z)

Why can't I get Boost building with STLport?


回答1:


With the help of a few people on the Boost mailing list, I was able to get boost building with STLport. Below are some instructions I wrote up for anyone else that has run into this problem:

First make sure you have compiled STLport for your respective compiler. Then go to the tools/build/v2 directory and edit the file user-config.jam to the following:

using msvc : 8.0 ;
using stlport : 5.2.1 : C:/Code/third_party_source/STLport-5.2.1/stlport : C:/Code/third_party_source/STLport-5.2.1/lib-vc8 ;

Above, make sure you use the appropriate version of MSVC and correct absolute path to STLport. In this example I'm using MSVC8, but change it to your version per the following table:

Visual Studio .NET 2003        -- 7.1
Visual Studio 2005             -- 8.0
Visual Studio 2008             -- 9.0
Visual Studio 2010             -- 10.0
Visual Studio 11               -- 11.0

Similarly, for the using stlport line, make sure you specify the appropriate version of STLport. Here I am using version 5.2.1. The next parameter is the path to the stlport include directory (change accordingly) and the third and final parameter is the path to the STLport libraries that are COMPILED FOR THE SAME VERSION OF MSVC.

Once the user config file is setup, now you can build boost by invoking the following commands.

For DEBUG:

b2 toolset=msvc link=shared threading=multi runtime-link=shared variant=debug stdlib=stlport define=_STLP_DEBUG --layout=tagged stage

For RELEASE:

b2 toolset=msvc link=shared threading=multi runtime-link=shared variant=release stdlib=stlport --layout=tagged stage

The important change I was missing was the define=_STLP_DEBUG option during invocation of b2.




回答2:


Your using stlport line is missing a version specifier. Change it to:

using stlport : 5.2.1 : C:/Code/work/rdailey-t510/depot/dev/gfe-dev/server/external/stlport/WINNT5.0_OPT.OBJ/stlport : C:/Code/work/rdailey-t510/depot/dev/gfe-dev/server/external/stlport/WINNT5.0_OPT.OBJ/lib ;

Then, when you invoke bjam/b2, specify the feature with the version included, i.e.

stdlib=stlport-5.2.1

(Of course, for versions of STLPort other than 5.2.1, substitute the correct version numbers.)



来源:https://stackoverflow.com/questions/7641030/unable-to-build-boost-with-stlport-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!