Building boost 1.51 with MSVC for Windows with debug symbol

by Nick September. 07, 12 01 Comment

This post is just a quick “note to self” for future reference. We wanted to update our boost source to the latest version, so I started building it with the usual “bjam –build-type=complete debug-symbols=on debug-store=database”. For some reason, however, there were a lot of .pdbs in the boost root folder and many libraries could’t be built as DLLs. For example, building boost::thread failed with “…failed compile-c-c++ bin.v2libsthreadbuildmsvc-10.0debugdebug-store-databasethreading-multiwin32thread.obj…” and many others like this.

I tried building the 1.49 version and everything was fine, so I started digging in the jam files, specifically the one for MSVC – toolsbuildv2toolsmsvc.jam. After a lot of wasted time, I was able to locate the problem – in the rule “compile-c-c++”, “PDB_NAME on $(<) = $(<:S=.pdb) ;” (that’s line 383 in the file) was behaving strangely. Reading the boost build guide ( I worked out that $(<) means the first argument, $(<:S)M/sapn> selects the suffix, and $(<:S=.pdb) would replace the suffix with “.pdb” – exactly what we want.

However, for some strange reason the replacement converted “bin.v2libsthreadbuildmsvc-10.0debugdebug-store-databasethreading-multiwin32thread.obj” into “win32thread.pdb”. $(<) was the whole string, but the replacement trimmed the beginning. There was no “win32” folder in the root boost directory, so when bjam tried to output some file it failed.

I played around a little with the jam file but didn’t get any results, so I took the easy way out and just created all the folders that are needed. Here’s the full list:

I also couldn’t build boost::python with the error message “No python installation configured and autoconfiguration failed”, yet my python was conveniently placed in C:Python27. I didn’t want to spend a lot of time on figuring this out, so I tried a solution I found in this thread and it worked so I didn’t dig deeper. This is supposed to fix paths that have whitespace, however it apprarently breaks paths that don’t. So, just locate the line “python-cmd = “$(python-cmd)” ;” in the “if [ version.check-jam-version 3 1 17 ] || ( [ ] != NT )” section in the file toolsbuildv2toolspython.jam and comment it with # in the beginning.


Follow Nick on Twitter: @Nikxio

Social Shares

Related Articles


Leave Reply

Leave a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.