Search code examples
boostboost-asiowindows-embedded-compact

Compiling boost library for Windows Embedded Compact 7


I'm programming for an embedded device with a NVIDIA Tegra 2 running Windows Embedded Compact 7. My development environment is Microsoft Visual Studio 2008. The boost library and especially the boost-asio package seems to be very helpfull for my needs. Unfortunately I was not able to find a good guide on how to get boost running on Windows Embedded Compact 7. I'd prefere to get .lib files which I can link statically into my application.


Solution

  • It appears that the documentation on this process is sparse, because it requires non-trivial updates to the build process to get working with Windows CE. The most comprehensive tutorial to this problem appears to be here.

    Since you explicitly tagged this boost-asio, I also looked into that component of Boost specifically. Here's a thread from the Boost mailing list that covers this library in detail, including potential failure cases you may experience, JAM file modifications, and a batch file to help you with the build.*

    For those reading this: please share your experiences once you get this working. Despite various concerns that Boost is too memory-heavy for embedded applications, Boost provides the ability to use separate packages to meet your needs. I expect other users on SO will be very interested in your experiences getting this working.


     * Because people have been expressing problems with the referenced batch file disappearing when Nabble links expire, here's a pastedump for posterity:

    @SET VCINSTALLDIR=%VS9INSTALLDIR%\VC 
    @if "%VS9INSTALLDIR%"=="" goto error_no_VSINSTALLDIR 
    @if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR 
    
    @echo Setting environment for using Microsoft Visual Studio 2008 tools for WM5. 
    @set TARGETCPU=X86 
    
    @call :GetWindowsSdkDir 
    
    @if not "%WindowsSdkDir%" == "" ( 
            set "PATH=%WindowsSdkDir%bin;%PATH%" 
    ) 
    
    @rem 
    @rem Root of Visual Studio IDE installed files. 
    @rem 
    @set DevEnvDir=%VS9INSTALLDIR%\Common7\IDE 
    
    @set PATH=%VCINSTALLDIR%\CE\bin\x86_arm;%VCINSTALLDIR%\bin;%VS9INSTALLDIR%\Common7\Tools;%DevEnvDir%;%VS9INSTALLDIR%\Common\Tools;%VS9INSTALLDIR%\Common\IDE;%VS9INSTALLDIR%;%PATH% 
    @set INCLUDE=%STLPORT_PATH%\STLPort-5.2.1\stlport;%VCINSTALLDIR%\ce\include;%CETOOLS%\Windows Mobile 5.0 Pocket PC SDK\include\ARMV4I;%CETOOLS%\Windows Mobile 5.0 Pocket PC SDK\include;%VCINSTALLDIR%\ce\atlmfc\include 
    @set LIB=%STLPORT_PATH%\STLPort-5.2.1\lib\evc9-arm;%CETOOLS%\Windows Mobile 5.0 Pocket PC SDK\lib\ARMV4I;%VCINSTALLDIR%\ce\ATLMFC\LIB\ARMV4I;%VCINSTALLDIR%\ce\LIB\ARMV4I 
    @set LIBPATH= 
    
    @goto end 
    
    :GetWindowsSdkDir 
    @call :GetWindowsSdkDirHelper HKLM > nul 2>&1 
    @if errorlevel 1 call :GetWindowsSdkDirHelper HKCU > nul 2>&1 
    @if errorlevel 1 set WindowsSdkDir=%VCINSTALLDIR%\PlatformSDK\ 
    @exit /B 0 
    
    :GetWindowsSdkDirHelper 
    @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"') DO ( 
            if "%%i"=="CurrentInstallFolder" ( 
                    SET "WindowsSdkDir=%%k" 
            ) 
    ) 
    @if "%WindowsSdkDir%"=="" exit /B 1 
    @exit /B 0 
    
    
    :error_no_VSINSTALLDIR 
    @echo ERROR: VS9INSTALLDIR variable is not set. 
    @goto end 
    
    :error_no_VCINSTALLDIR 
    @echo ERROR: VCINSTALLDIR variable is not set. 
    @goto end 
    
    :end 
    
    @SET VCINSTALLDIR=%VS9INSTALLDIR%\VC 
    @SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework 
    @SET FrameworkVersion=v2.0.50727 
    @SET Framework35Version=v3.5 
    @if "%VS9INSTALLDIR%"=="" goto error_no_VSINSTALLDIR 
    @if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR 
    
    @echo Setting environment for using Microsoft Visual Studio 2008 x86 tools with STLport-5.2.1. 
    
    @call :GetWindowsSdkDir 
    
    @if not "%WindowsSdkDir%" == "" ( 
            set "PATH=%WindowsSdkDir%bin;%PATH%" 
            set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%" 
            set "LIB=%WindowsSdkDir%lib;%LIB%" 
    ) 
    
    
    @rem 
    @rem Root of Visual Studio IDE installed files. 
    @rem 
    @set DevEnvDir=%VS9INSTALLDIR%\Common7\IDE 
    
    @set PATH=%DevEnvDir%;%VCINSTALLDIR%\BIN;%VS9INSTALLDIR%\Common7\Tools;%FrameworkDir%\%Framework35Version%;%FrameworkDir%\%FrameworkVersion%;%VCINSTALLDIR%\VCPackages;%PATH% 
    @set INCLUDE=%STLPORT_PATH%\STLport-5.2.1\stlport;%VCINSTALLDIR%\ATLMFC\INCLUDE;%VCINSTALLDIR%\INCLUDE;%INCLUDE% 
    @set LIB=%STLPORT_PATH%\STLport-5.2.1\lib\vc9;%VCINSTALLDIR%\ATLMFC\LIB;%VCINSTALLDIR%\LIB;%LIB% 
    @set LIBPATH=%FrameworkDir%\%Framework35Version%;%FrameworkDir%\%FrameworkVersion%;%VCINSTALLDIR%\ATLMFC\LIB;%VCINSTALLDIR%\LIB;%LIBPATH% 
    
    @goto end 
    
    :GetWindowsSdkDir 
    @call :GetWindowsSdkDirHelper HKLM > nul 2>&1 
    @if errorlevel 1 call :GetWindowsSdkDirHelper HKCU > nul 2>&1 
    @if errorlevel 1 set WindowsSdkDir=%VCINSTALLDIR%\PlatformSDK\ 
    @exit /B 0 
    
    :GetWindowsSdkDirHelper 
    @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"') DO ( 
            if "%%i"=="CurrentInstallFolder" ( 
                    SET "WindowsSdkDir=%%k" 
            ) 
    ) 
    @if "%WindowsSdkDir%"=="" exit /B 1 
    @exit /B 0 
    
    :error_no_VSINSTALLDIR 
    @echo ERROR: VSINSTALLDIR variable is not set. 
    @goto end 
    
    :error_no_VCINSTALLDIR 
    @echo ERROR: VCINSTALLDIR variable is not set. 
    @goto end 
    
    :end