7

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?

void.pointer
  • 24,859
  • 31
  • 132
  • 243

2 Answers2

4

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.

void.pointer
  • 24,859
  • 31
  • 132
  • 243
3

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.)

ildjarn
  • 62,044
  • 9
  • 127
  • 211
  • This worked perfectly. Looks like the user-config.jam documentation (comments) need to be updated to reflect this. – void.pointer Oct 03 '11 at 22:47
  • Actually it failed again with a bunch of linker error, unresolved symbols from STLport... so not sure if boost is trying to link in the LIB. – void.pointer Oct 03 '11 at 22:52
  • @RobertDailey : You can pass `-n` to bjam/b2 to see the compiler and linker commands instead of executing them; if you do so, do you see the directories you specified in your `using stlport` being used at all? – ildjarn Oct 03 '11 at 22:56
  • Yes, I do see the lib path. Here is the command being output: ........ `link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /subsystem:console /out:"bin.v2\libs\graph\build\msvc-7.1\debug\stdlib-stlport-5.1\threading-multi\boost_graph-vc71-mt-gdp-1_47.dll" /IMPLIB:"bin.v2\libs\graph \build\msvc-7.1\debug\stdlib-stlport-5.1\threading-multi\boost_graph-vc71-mt-gdp-1_47.lib" /LIBPATH:"C:\Code\work\rdailey-t510\depot\dev\gfe-dev\server\external\stlport\WINNT5.0_OPT.OBJ\lib" @"bin.v 2\libs\graph\build\msvc-7.1\debug\stdlib-stlport-5.1\threading-multi\boost_graph-vc71-mt-gdp-1_47.dll.rsp"` – void.pointer Oct 04 '11 at 15:30
  • @RobertDailey : It appears that it's adding the lib path correctly but not actually attempting to link to the object files themselves. Try adding `library=` to your bjam/b2 invocation command line. – ildjarn Oct 04 '11 at 16:17
  • I tried `stdlib=stlport.5.1`, which is the name of my STLport lib, and it errors saying: `error: "stlport.5.1" is not a known value of feature error: legal values: "native" "stlport"`. What else can I try? Thanks for your help so far btw. – void.pointer Oct 04 '11 at 17:50
  • @RobertDailey : Use `-` to separate the value from the version, i.e. `stdlib=stlport-5.1`. – ildjarn Oct 04 '11 at 17:57
  • That's what I originally tried, based on your initial answer. Although it is accepted, the linker errors still occur. I tried `stlport.5.1` since that's what my library name is. I also renamed my library to `stlport-5.1`, but it still didn't link it in. – void.pointer Oct 04 '11 at 18:00
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/4003/discussion-between-robert-dailey-and-ildjarn) – void.pointer Oct 04 '11 at 18:01
  • I tried the following command, still get linker errors from missing STLport symbols: `b2 toolset=msvc link=shared threading=multi stdlib=stlport-5.1 library=C:\Code\work\rdailey-t510\depot\dev\gfe-dev\server\external\stlport\WINNT5.0_OPT.OBJ\lib\stlport.5.1.lib --build-type=complete stage` – void.pointer Oct 05 '11 at 17:32
  • @RobertDailey : Try it with `-n`, and make sure the invocations to link.exe somehow involve `stlport.5.1.lib`. – ildjarn Oct 05 '11 at 18:28
  • 1
    I had to unmark this as NOT the answer, because despite all of the extremely great help ildjarn has provided, I still cannot get boost to build with STLport 5.2.1 – void.pointer Feb 08 '12 at 23:55