blackberry / Boost

The Boost C++ Libraries
Boost Software License 1.0
230 stars 122 forks source link

blackberry/Boost does not build on Windows #6

Open LawrenceGunn opened 11 years ago

LawrenceGunn commented 11 years ago

I could not get the blackberry port of Boost to build. It seemed to be an issue related to shell scripts.

nesteruk commented 11 years ago

Same here - you cannot run Bash scripts in windows (well, maybe with Cygwin).

LawrenceGunn commented 11 years ago

I did have Cygwin (or similar, it was bundled with an app) and the scripts did start but errors happened part way through the scripts.

nesteruk commented 11 years ago

You also need Python installed, I think. At any rate, it would be much better if we had a CSscript for Windows.

tvaneerd commented 11 years ago

Here's how I build 1.52 and/or 1.53, which build almost "out of the box" (search boost's trac system for any qnx fixes that have yet to be upstreamed)

run bjam like the following:

b2 %* install --prefix=C:\boost\ --user-config=blackberry-config.jam --layout=system toolset=qcc target-os=qnxnto

with this blackberry-config.jam file:

import os ;

QNX_TARGET_ARCH = [ os.environ QNX_TARGET_ARCH ] ;
QNX_TARGET = [ os.environ QNX_TARGET ] ;
QNX_HOST = [ os.environ QNX_HOST ] ;

if ! $(QNX_TARGET) || ! $(QNX_HOST)
{
    ECHO error: ;
    ECHO error: BlackBerry build of Boost requires QNX_TARGET and QNX_HOST env variables.  Did you forget to run bbndk-env.bat? ;
    ECHO error: ;
    EXIT ;
}

# _cpp uses dinkumware, _gpp uses gnu std::
if $(QNX_TARGET_ARCH) = x86
{
    dashVOpt = gcc_ntox86_cpp ;
    linkArchDir = x86 ;
}
else
{
    dashVOpt = gcc_ntoarmv7le_cpp ;
    linkArchDir = armle-v7 ;
}

# python is tricky:
# - need python.exe to run the build system
# - need python include and libs to build Boost.Python
# the above are 2 very separate things! Particularly for cross-compiling!
#   the second needs to be the correct python for the target platform.
# Where can you get a port of python for blackberry10??? or QNX in general?
# I don't really know. A *nix variant  should mostly work.
#
if [ os.name ] = "NT"
{
   using python : 2.7 : C:\\Python27
     : C:\\code\\Python-2.7\\armle-v7\\usr\\include\\python2.7
     : C:\\code\\Python-2.7\\armle-v7\\usr\\lib\\python2.7
     : ;
}
else
{
   using python : 2.7 : /usr/lib/python2.7
     : ~/code/Python-2.7/armle-v7/usr/include/python2.7
     : ~/code/Python-2.7/armle-v7/usr/lib/python2.7
     : ;
}

using qcc
# Version
    :

# C++-compile-command
    : $(QNX_HOST)/usr/bin/QCC -V$(dashVOpt)

# Compiler options
    : <compileflags>"-D__QNX__"
        <compileflags>"-D__QNXNTO__"

    # Add -D__USE_ISOC99 for rounding control mechanism (boost/numeric/interval/hw_rounding.hpp)
        <compileflags>"-D__USE_ISOC99"
        <compileflags>"-I$(QNX_TARGET)/usr/include"

    # Prevent this from being output: "note: the mangling of 'va_list' has changed in GCC 4.4"
        <compileflags>"-Wno-psabi"

    # Add -fPIC to link without error to LibTestNativeLibTuTest.o (for statechart tests)
        <compileflags>"-fPIC"

    # Requested by BBM team
        <compileflags>"-fno-strict-aliasing"

    # Functions like sync_val_compare_and_swap and sync_fetch_and_add aren't available
        <compileflags>"-DBOOST_SP_NO_SYNC"

        <linkflags>"-L$(QNX_TARGET)/$(linkArchDir)/usr/lib -L$(QNX_TARGET)/$(linkArchDir)/lib"
    ;

import option ;
option.set keep-going : false ;