Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Boost 1.47 for Windows CE

There is actually a bit of information out there about people trying to build the Boost libraries for Windows CE, but no one has reported success or even given the steps required to do so. With the two latest releases (1.46 and 1.47) the release notes have mentioned that one of their test compilers was "Visual C++, Windows Mobile 5, with STLport: 9.0," which seems to imply that success has been achieved (as a side note the compiler given is interesting since the latest STLPort I've been able to download is 5.2.1. Am I missing something?).

The posts I've found seem to revolve around the file contained here: http://www.boost.org/development/tests/trunk/VeecoFTC.html. The thing is, I honestly don't know how to use it. I was able to build STLPort for Windows CE, but following the Boost Getting Started guide ( http://www.boost.org/doc/libs/1_47_0/more/getting_started/windows.html) I get stuck at the Boost.Build stage. Do I need to configure at this point to compile for CE? I just don't know what steps to take and would appreciate some guidance.

These are the steps I have followed so far:

  1. Compile STLPort for Windows CE (documentation was pretty decent, this didn't prove too difficult).
  2. Install Boost.Build according to Getting Started Guide. I'm a little shaky on this step, since the bootstrap.bat file seems to be specific to "ntx86" and "ntx86_64." Have I already screwed up?

At this point, assuming I've done things correctly, I need to run b2 with something like

b2 --build-dir=build-directory toolset=toolset-name --build-type=complete stage

I assume my build directory is the prefix I used for Boost.Build, the build type and stage will remain as given, but I don't know what toolset name to use. The VeecoFTC file has multiple entries for msvc and stlport. I removed the two entries that DIDN'T relate to "wm5," but when I compile with the following command

b2 --build-dir=C:\boost-build toolset=msvc --build-type=complete stage

I get a bunch of errors like:

compile-c-c++ C:\boost-build\boost\bin.v2\libs\regex\build\msvc-9.0~wm5~stlport5.2\debug\threading-multi\has_icu_test.obj
The system cannot find the path specified.

Indeed, that file does not exist, but has_icu_test.obj.rsp exists there. Am I missing something? Am I even on the right track?

UPDATE:

Since I can't get Boost.Build to work and am getting no love on the Boost.Build mailing list, I've moved on to trying the CMake build system for Boost: http://gitorious.org/boost/cmake . I'm using this in conjunction with CEgcc (I'm much more familiar with Linux than Windows) and I'm running into the following error:

boost/config/requires_threads.hpp:47:5: error: #error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"

-mthreads is part of the C and CXX flags-- the problem is that BOOST_PLATFORM_CONFIG is not defined by boost/config/select_platform_config.hpp. What should this be defined to for Windows CE? I figured it should be boost/config/platform/win32.hpp (which would then define BOOST_HAS_WINTHREADS, which would solve the above error). How can the release notes claim this works when select_platform_config.hpp doesn't seem to handle Windows CE cases? If BOOST_PLATFORM_CONFIG does indeed need to be boost/config/platform/win32.hpp, then I need to define either _WIN32, WIN32, or WIN32. My first reaction is that none of these should be used for compiling for CE. Also, the VeecoFTC file doesn't contain any of these. How does IT work?

like image 734
kyrofa Avatar asked Sep 06 '11 13:09

kyrofa


People also ask

Do I need to compile Boost?

Nothing to Build? Most Boost libraries are header-only: they consist entirely of header files containing templates and inline functions, and require no separately-compiled library binaries or special treatment when linking. The only Boost libraries that must be built separately are: Boost.

Does Boost support C ++ 20?

Boost. Operators is currently incompatible with C++20 compilers, which in some cases may manifest as an infinite recursion or infinite loop in runtime when a comparison operator is called.

Does Boost work with C?

Boost can't be used with C as it uses OOP features from C++. It may be technically possible to develop a wrapper for it.


1 Answers

You don't actually have to use boost build to build boost. I built part of boost using an SCons script for a project where I needed more control over the build options. It worked quite well. It went something like this:

import os

env = Environment()

boost_source = os.environ.get('BOOST_SOURCE', None)
if not boost_source:
    raise Exception, 'BOOST_SOURCE not set'

env.Append(CPPPATH = [boost_source])

if env['PLATFORM'] == 'win32':
    env.Append(CPPDEFINES = ['BOOST_ALL_NO_LIB'])


VariantDir('build', boost_source + '/libs')

import glob
import re

for lib in ['iostreams', 'filesystem', 'system', 'regex', 'thread',
            'serialization']:
    src = []
    path = boost_source + '/libs/%s/src' % lib

    if lib == 'thread':
        if env['PLATFORM'] == 'win32':
            src.append(path + '/tss_null.cpp')
            path += '/win32'
            env.Append(CPPDEFINES = ['BOOST_HAS_WINTHREADS',
                                     'BOOST_THREAD_BUILD_LIB'])
        else: path += '/pthread'

    src += glob.glob(path + '/*.cpp')

    src = map(lambda x: re.sub(re.escape(boost_source + '/libs'), 'build', x),
              src)

    libname = 'boost_%s' % lib
    if env['PLATFORM'] == 'win32': libname = 'lib' + libname
    lib = env.Library('lib/' + libname, src)

Clean(lib, 'build')
Clean(lib, 'lib')

This SCons script just searches for the source files in the listed boost modules and compiles with the default compiler. I pass in the path to the boost source directory via the BOOST_SOURCE environment variable.

This could work for Windows CE as it would give you more control over the build process. You could also do something similar with make or nmake.

The moral of the story is that building boost with out using bjam/BoostBuild is not that hard.

like image 177
jcoffland Avatar answered Oct 05 '22 07:10

jcoffland