Compiling boost1.47 on Windows7 64bit with VC2013 x64

asked 2014-10-28 12:18:29 -0600

Eugene Simine gravatar image

I needed to compile boost1.47 in windows for win_ros so i decided to document what i did.

I tried different versions of boost but winros seems to only play nice with this one. If someone manages to compile winros with later version of boost that would be awesome and i’d like to know about it. But since we’re stuck with this boost version we need change a few things for it to compile under VC2013. Out of the box 1.47 doesn’t know about compilers later than VC2010, so we’ll teach it.

  1. In "boost_1_47_0\boost\signals\detail\named_slot_map.hpp" and "boost_1_47_0\libs\signals\src\named_slot_map.cpp" change BOOST_WORKAROUND(_MSC_VER, <= 1600) to BOOST_WORKAROUND(_MSC_VER, <= 1900)
  2. Run bootstrap.bat
  3. Now we need to modify some build files. All i did was to get the latest version of boost and copy the parts of of these files that deal with specifying settings for the latest compilers. So in "boost_1_47_0\tools\build\v2\engine\build.bat" replace

    if NOT "_%VS100COMNTOOLS%_" == "__" (
    with
        call :Clear_Error
        if NOT "_%VS140COMNTOOLS%_" == "__" (
            set "BOOST_JAM_TOOLSET=vc14"
            set "BOOST_JAM_TOOLSET_ROOT=%VS140COMNTOOLS%..\..\VC\"
            goto :eof) 
        call :Clear_Error 
        if EXIST "%ProgramFiles%\Microsoft Visual Studio 14.0\VC\VCVARSALL.BAT" (
            set "BOOST_JAM_TOOLSET=vc14"
            set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio 14.0\VC\"
            goto :eof) 
        call :Clear_Error
        if NOT "_%VS120COMNTOOLS%_" == "__" (
            set "BOOST_JAM_TOOLSET=vc12"
            set "BOOST_JAM_TOOLSET_ROOT=%VS120COMNTOOLS%..\..\VC\"
            goto :eof) 
        call :Clear_Error
        if EXIST "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\VCVARSALL.BAT" (
            set "BOOST_JAM_TOOLSET=vc12"
            set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio 12.0\VC\"
            goto :eof) 
        call :Clear_Error 
        if NOT "_%VS110COMNTOOLS%_" == "__" (
            set "BOOST_JAM_TOOLSET=vc11"
            set "BOOST_JAM_TOOLSET_ROOT=%VS110COMNTOOLS%..\..\VC\"
            goto :eof) 
        call :Clear_Error 
        if EXIST "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\VCVARSALL.BAT" (
            set "BOOST_JAM_TOOLSET=vc11"
            set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio 11.0\VC\"
            goto :eof) 
        call :Clear_Error 
        if NOT "_%VS100COMNTOOLS%_" == "__" (
         
    and later in the same file replace
    :Skip_VC10
    with
        :Skip_VC10
        if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc11_" goto Skip_VC11
        if NOT "_%VS110COMNTOOLS%_" == "__" (
            set "BOOST_JAM_TOOLSET_ROOT=%VS110COMNTOOLS%..\..\VC\"
            )
        if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS%
        if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
            if "_%VCINSTALLDIR%_" == "__" (
                set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
                ) )
        set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib"
        set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
        set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
        set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
        set "_known_=1"
        :Skip_VC11
        if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc12_" goto Skip_VC12
        if NOT "_%VS120COMNTOOLS%_" == "__" (
            set "BOOST_JAM_TOOLSET_ROOT=%VS120COMNTOOLS%..\..\VC\"
            )
        if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS%
        if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
            if "_%VCINSTALLDIR%_" == "__" (
                set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
                ) )
        set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib"
        set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
        set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
        set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
        set "_known_=1"
        :Skip_VC12
        if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc14_" goto Skip_VC14
        if NOT "_%VS140COMNTOOLS%_" == "__" (
            set "BOOST_JAM_TOOLSET_ROOT=%VS140COMNTOOLS ...
(more)
edit retag flag offensive close merge delete

Comments

Hi Eugene, thank you very much for your guide: it is really helpful. BTW, have you tried to compile win_ros with newer versions of Boost? Are you getting the following error in that case? rospack.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl boost::filesys

Atlancer gravatar image Atlancer  ( 2016-03-23 03:15:14 -0600 )edit

I was finally able to compile win_ros with Boost 1.56. The steps are described here: http://answers.ros.org/question/22992...

Atlancer gravatar image Atlancer  ( 2016-03-24 22:07:11 -0600 )edit