STLPort 5.1.5 and VS2008 and x64

| 2 Comments

I've been meaning to build STLPort for Visual Studio 2008 for some time now but as the STL support that ships with Visual Studio has been improved the urgency to be able to use an alternative has reduced. Unfortunately STLPort 5.1.5 doesn't build for VS2008 out of the box so it wasn't simply a case of downloading it and building it.

Anyway, I asked a question about it on StackOverflow and got an answer which linked to a blog posting from someone who had hacked the VC8 build to work with VC9.

Fixing the build properly isn't much harder than the VC8 hack, so I decided to do that instead. The fix to define _STLP_STATIC_CONST_INIT_BUG should really be made in stlport\stl\config\_msvc.h line 98, change the # if (_STLP_MSVC <= 1401) to # if (_STLP_MSVC <= 1501) to include the fix for VS2008 as well as all other MS compilers.

Since the compiler option /Wp64 is deprecated on VS2008 I decided to create a set of VC9 make files which are pretty much the same as the VC8 ones except that the names are changed and the deprecated compiler option is removed. After editing build\lib\configure.bat, build\lib\msvc.mak and build\Makefiles\targets.mak to add support for msvc9 it was simply a case of incorporating my 'side by side' library build changes from 2007 and I was done.

Next on my list of things to do was to investigate x64 support in STLPort. Although there are no explicit build configurations for x64 things 'just work' if you set your tools environment up for the x64 tool chain (run \Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat rather than `\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat).

Unfortunately this builds x64 versions of the libraries with the same names as the x86 versions, so some more changes are required to get these to sit side by side. I expect there's a better way to do this, but it seems to work ok for me. I added two new compiler options to build\lib\configure.bat, then changed build\lib\Makefile.inc to include an optional ARCHITECHURE_LIB_PREFIX and then made a similar change to stlport\stl\config\_auto_link.h. There's probably something that can be done in build\Makefiles\targets.mak to build the x64 objects somewhere different to the x86 ones but I don't need this as I do a clean before each build.

The changes I made for the VS2008 support are here.

The changes I made for side by side compiler and x64 support are here.

You need to have installed STLPort 5.1.5 first and then simply unzip these files over the top. The VS2008 support is completely separate to the side by side support, but the side by side support requires the VS2008 support if you want to select either of the VS2008 compiler options. As always, comments, suggestions and bug fixes welcome.

2 Comments

Thanks for the Patch.
rya.

Thank you for the tip on compiling STLPort for x64. It was exactly what I was looking for.

Leave a comment

About this Entry

Alternative call stack capturing was the previous entry in this blog.

Asynchronous SChannel Servers is the next entry in this blog.

I usually write about C++ development on Windows platforms, but I often ramble on about other less technical stuff...

Find recent content on the main index or look in the archives to find all content.

I have other blogs...

Subscribe to feed The Server Framework - high performance server development
Subscribe to feed Lock Explorer - deadlock detection and multi-threaded performance tools
Subscribe to feed l'Hexapod - embedded electronics and robotics
Subscribe to feed MegèveSki - skiing