[sldev] Compiling boost for 1.23 and above

Thomas Shikami thomas.shikami at online.de
Tue Jun 23 17:18:23 PDT 2009


Since LL changed from static runtime libraries to shared runtime dlls, 
new libraries are needed. One of them is boost, and compiling it oneself 
and using it caused 0xbaadf00d for me in signals. I finally found out 
how to compile boost specifically for 1.23.4. Here's the full 
instructons so far for VS2005: (for VS2008 replace msvc-8.0 with 
msvc-9.0 and vs80 with vs90)

    * Download & extract boost_1_36_0.7z source for win32 into an empty
      folder (ex. "boost-source").
    * Copy the "boost_1_36_0\boost" folder to "libraries\include\".

NOTE: the Boost Wiki says to use the Visual Studio command prompt 
instead of the regular command prompt.

    * Open the visual studio command prompt
    * Change Directory into "boost_1_36_0\tools\jam\src"
    * Run "build.bat"
    * Change Directory back to "boost_1_36_0" ( cd ..\..\.. )
    * Copy "boost_1_36_0\tools\jam\src\bin.ntx86\bjam.exe" to
      "boost_1_36_0\"
    * Using the command prompt, build the static libraries: (inside
      boost_1_36_0, if you have python 2.6 installed)
          o set PYTHON_ROOT=C:\Python26
          o set PYTHON_VERSION=2.6
          o bjam --build-dir=..\boost-build --toolset=msvc-8.0
            --with-signals --with-program_options --with-regex
            --with-python variant=release link=static threading=multi
            runtime-link=shared define="_SECURE_SCL=0,_SECURE_STL=0" stage
          o bjam --build-dir=..\boost-build --toolset=msvc-8.0
            --with-signals --with-program_options --with-regex
            --with-python variant=debug link=static threading=multi
            runtime-link=shared define="_SECURE_SCL=0,_SECURE_STL=0" stage
    * copy
      "boost_1_36_0\stage\lib\libboost_program_options-vc80-mt-1_36.lib"
      to "\libraries\i686-win32\lib\release\"
    * copy
      "boost_1_36_0\stage\lib\libboost_program_options-vc80-mt-gd-1_36.lib"
      to "\libraries\i686-win32\lib\debug\"
    * copy "boost_1_36_0\stage\lib\libboost_regex-vc80-mt-1_36.lib" to
      "\libraries\i686-win32\lib\release\"
    * copy "boost_1_36_0\stage\lib\libboost_regex-vc80-mt-gd-1_36.lib"
      to "\libraries\i686-win32\lib\debug\"
    * copy "boost_1_36_0\stage\lib\libboost_python-vc80-mt-1_36.lib" to
      "\libraries\i686-win32\lib\release\"
    * copy "boost_1_36_0\stage\lib\libboost_python-vc80-mt-gd-1_36.lib"
      to "\libraries\i686-win32\lib\debug\"
    * copy "boost_1_36_0\stage\lib\libboost_signals-vc80-mt-1_36.lib" to
      "\libraries\i686-win32\lib\release\"
    * copy "boost_1_36_0\stage\lib\libboost_signals-vc80-mt-gd-1_36.lib"
      to "\libraries\i686-win32\lib\debug\"

The problem lies with deactivating secure SCL and secure STL in the 
viewer compiles. Libraries that are mixed between secure and non-secure 
seem to clash and cause weird crashing behaviour.
Same can be done with VS2008 as well, resulting into a libraries package 
for boost, that works with both VS2005 and VS2008. Change Boost.cmake 
accordingly:

# -*- cmake -*-
include(Prebuilt)

set(Boost_FIND_QUIETLY ON)
set(Boost_FIND_REQUIRED ON)

if (STANDALONE)
  include(FindBoost)

  set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
  set(BOOST_REGEX_LIBRARY boost_regex-mt)
  set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
else (STANDALONE)
  use_prebuilt_binary(boost)
  set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)

  if (WINDOWS)
    set(BOOST_VERSION 1_36)
    if (MSVC71)
      set(BOOST_PROGRAM_OPTIONS_LIBRARY
          optimized libboost_program_options-vc71-mt-${BOOST_VERSION}
          debug libboost_program_options-vc71-mt-gd-${BOOST_VERSION})
      set(BOOST_REGEX_LIBRARY
          optimized libboost_regex-vc71-mt-${BOOST_VERSION}
          debug libboost_regex-vc71-mt-gd-${BOOST_VERSION})
      set(BOOST_SIGNALS_LIBRARY
          optimized libboost_signals-vc71-mt-${BOOST_VERSION}
          debug libboost_signals-vc71-mt-gd-${BOOST_VERSION})
    elseif (MSVC80)
      set(BOOST_PROGRAM_OPTIONS_LIBRARY
          optimized libboost_program_options-vc80-mt-${BOOST_VERSION}
          debug libboost_program_options-vc80-mt-gd-${BOOST_VERSION})
      set(BOOST_REGEX_LIBRARY
          optimized libboost_regex-vc80-mt-${BOOST_VERSION}
          debug libboost_regex-vc80-mt-gd-${BOOST_VERSION})
      set(BOOST_SIGNALS_LIBRARY
          optimized libboost_signals-vc80-mt-${BOOST_VERSION}
          debug libboost_signals-vc80-mt-gd-${BOOST_VERSION})
    elseif (MSVC90)
      set(BOOST_PROGRAM_OPTIONS_LIBRARY
          optimized libboost_program_options-vc90-mt-${BOOST_VERSION}
          debug libboost_program_options-vc90-mt-gd-${BOOST_VERSION})
      set(BOOST_REGEX_LIBRARY
          optimized libboost_regex-vc90-mt-${BOOST_VERSION}
          debug libboost_regex-vc90-mt-gd-${BOOST_VERSION})
      set(BOOST_SIGNALS_LIBRARY
          optimized libboost_signals-vc90-mt-${BOOST_VERSION}
          debug libboost_signals-vc90-mt-gd-${BOOST_VERSION})
    endif (MSVC71)
  elseif (DARWIN)
    set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
    set(BOOST_REGEX_LIBRARY boost_regex-mt)
    set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
  elseif (LINUX)
    set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
    set(BOOST_REGEX_LIBRARY boost_regex-mt)
    set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
  endif (WINDOWS)
endif (STANDALONE)



More information about the SLDev mailing list