Giter Site home page Giter Site logo

boost-for-android's Introduction

Boost for Android Build Status: GitHub Actions

Boost for android is a set of tools to compile the main part of the Boost C++ Libraries for the Android platform.

Currently supported boost versions are 1.45.0, 1.48.0, 1.49.0, 1.53.0, 1.54.0, 1.55.0, 1.65.1, 1.66.0, 1.67.0, 1.68.0, 1.69.0, 1.70.0, 1.71.0, 1.73.0, 1.74.0, 1.76.0, 1.77.0, 1.78.0, 1.79.0, 1.80.0 and 1.82.0.

x86, mips, and 64-bit architectures are built with Boost 1.65.1 and NDK r16-beta2, this version uses clang toolchain with llvm libc++ STL library.

Other versions of Boost are built only for arm architecture, they are using gcc toolchain and gnustl library.

To compile Boost for Android you may use one of the following NDKs:

NDK / boost 1.45 1.48 1.49 1.53 1.65 1.66 1.67 1.68 1.69 1.70 1.71 1.73 1.74 1.76 1.77 1.78 1.79 1.80 1.82 1.83 1.84
r4 customized by Dmitry Moskalchuk aka CrystaX. x
r5 from the official android repository. x
r5 customized by CrystaX. x
r7 customized by CrystaX. x x x
r8 from the official android repository. x x x
r8b from the official android repository. x x
r8c from the official android repository. x
r8d from the official android repository. x x
r8e from the official android repository. x x
r10 from the official android repository. x x
r16 from the official android repository. x x x x x
r17b from the official android repository. x x x
r18 from the official android repository. x
r18b from the official android repository. x x x
r19 from the official android repository. x x x x x
r19b from the official android repository. x x x x x
r19c from the official android repository. x x x x x
r20 from the official android repository. x x x x x
r20b from the official android repository. x x x x x
r21 from the official android repository. x x x x x
r21b from the official android repository. x x x x x
r21c from the official android repository. x x x x x
r21d from the official android repository. x x x x x
r21e from the official android repository. x x x x x
r23 from the official android repository. x x x x x x x x x
r23b from the official android repository. x x x x x x x x x
r25 from the official android repository. x x x x x x x x x
r25b from the official android repository. x x x x x x x x x
r25c from the official android repository. x x x x x x x x x
r26 from the official android repository. x x x x x x x x x

For NDK from r4 to r10, GCC with gnustl_static runtime library is used, only ARM architecture is supported.

For NDK from r16 to r18b, clang with c++_static runtime library is used, all architectures are supported.

For NDK from r19 and up, clang with c++_shared runtime library is used, all architectures are supported.

Quick Start

Dependencies

Usage

Compiling

Linux.

./build-android.sh $(NDK_ROOT)

Windows:

build-android.bat $(NDK_ROOT)

NOTE: Do not forget to replace backslash with slashes in $(NDK_ROOT). For example set $(NDK_ROOT) to D:/android-ndk-r8e instead of D:\android-ndk-r8e

On windows you will need MSYS to be able to launch the corresponding bat files (http://www.mingw.org/wiki/MSYS).

This command will download and build boost against the NDK specified and output the final headers and libs in the build folder. Make sure to provide an absolute path the the NDK folder!

For more info about usage and available commands use --help.

Including

Now that you got Boost compiled you must add it to your Android.mk file. Locate the build folder and copy the include and lib folders over to your project's jni folder. A recommended path inside your project is /jni/boost/.

Add the following to your Android.mk (note that here we're using Boost 1.48 and have assumed that Boost resides inside /jni/boost):

LOCAL_CFLAGS += -I$(LOCAL_PATH)/boost/include/boost-1_48
LOCAL_LDLIBS += -L$(LOCAL_PATH)/boost/lib/ -lboost_system -lboost_...

LOCAL_CPPFLAGS += -fexceptions
LOCAL_CPPFLAGS += -frtti

Now use ndk-build to build and have fun with it!

Note that you should build your project and Boost with the same version of NDK as the C++ STL inside NDK r4 and NDK r5 are not compatible in some subtle details.

Contribute

The projects is split into two main branches, the master and devel. The master branch is where the current stable version lies and which should be used in most of the cases, the devel branch in turn is where development occurs. To contribute to the project make sure to use the devel branch which will make it easier to test changes and to merge incoming pull requests (PR).

Troubleshooting

In case you encounter bunch of linker errors when building your app with boost, this might help:

Building from a 64 bit machine (Linux)

Make sure you have installed the 32 bit libraries. Those are required to be able to use the NDK.

To install them just use the following

$ sudo apt-get install ia32-libs

NDK 7 (CrystaX)

Add -lgnustl_static AFTER all boost libraries to the LOCAL_LDLIBS line in Android.mk. Example:

LOCAL_LDLIBS += lboost_system-gcc-md lboost_thread-gcc-md -lgnustl_static

NDK 8 (official)

Do everything that is in the NDK 7 Crystax section, but also add full path to the gnustl_static library to the link paths. Example:

LOCAL_LDLIBS += lboost_system-gcc-md lboost_thread-gcc-md \
             -L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi \
             -lgnustl_static

NDK 17 (official)

Support for ARMv5 (armeabi), MIPS, and MIPS64 has been removed. Attempting to build any of these ABIs will result in an error. This project will exclude these architectures for compiling with NDK 17.

boost-for-android's People

Contributors

adesmier-sequans avatar apolukhin avatar arnaudd-fr avatar derkling avatar dragvs avatar hannesa2 avatar iitaku avatar inetic avatar j-jorge avatar jauhien avatar jhasse avatar justusranvier avatar kagetsuki avatar linqcan avatar lkalneus avatar madadam avatar moritz-wundke avatar naja1987 avatar nikreiman avatar o01eg avatar paleozogt avatar patrick-ru avatar pelya avatar rcdailey avatar rgpaul avatar rocka avatar sc-one avatar sh-zam avatar solodon4 avatar vgavro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

boost-for-android's Issues

boost_1_55_0 build problem, "armasm" not found

when use the config and patches to build boost_1_55_0 on window 7, there's problem with "armasm".
It shows that can't find "armasm" when build :

...failed Jamfile<D:\boost_for_android\boost_1_55_0\libs\context\build>.armasm midfiles\boost\bin.v2\libs\context\build\gcc-androidR8e\release\address-model-32\architecture-arm\link-static\runtime-link-static\target-os-linux\threading-multi\asm\make_arm_aapcs_pe_armasm.o...

Please give a solution, or I miss some thing on windows?

boost_1_56_0 build problem:libs/context/src/unsupported.cpp:7:2: error: #error "platform not supported"

common.mkdir bin.v2/libs/context/build
common.mkdir bin.v2/libs/context/build/gcc-androidR8e
common.mkdir bin.v2/libs/context/build/gcc-androidR8e/release
common.mkdir bin.v2/libs/context/build/gcc-androidR8e/release/link-static
common.mkdir bin.v2/libs/context/build/gcc-androidR8e/release/link-static/threading-multi
gcc.compile.c++ bin.v2/libs/context/build/gcc-androidR8e/release/link-static/threading-multi/unsupported.o
libs/context/src/unsupported.cpp:7:2: error: #error "platform not supported"
#error "platform not supported"
^

"arm-linux-androideabi-g++"  -ftemplate-depth-128 -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS -O3 -finline-functions -Wno-inline -Wall -fexceptions -frtti -fpic -ffunction-sections -funwind-tables -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/opt/Android/NDK/platforms/android-9/arch-arm/usr/include -Wa,--noexecstack -DANDROID -D__ANDROID__ -DNDEBUG -O2 -lstdc++ -std=c++11 -g -I/opt/Android/NDK/sources/cxx-stl/gnu-libstdc++/4.8/include -I/opt/Android/NDK/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include -fvisibility=hidden -fvisibility-inlines-hidden -fdata-sections -pthread  -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_SOURCE -DNDEBUG  -I"." -c -o "bin.v2/libs/context/build/gcc-androidR8e/release/link-static/threading-multi/unsupported.o" "libs/context/src/unsupported.cpp"

...failed gcc.compile.c++ bin.v2/libs/context/build/gcc-androidR8e/release/link-static/threading-multi/unsupported.o...
...skipped <pbin.v2/libs/context/build/gcc-androidR8e/release/link-static/threading-multi>libboost_context-gcc-mt-1_56.a for lack of <pbin.v2/libs/context/build/gcc-androidR8e/release/link-static/threading-multi>unsupported.o...
...failed updating 1 target...
...skipped 1 target...
...updated 9727 targets...
ERROR: Failed to build boost for android!
Done!

fails to build on osx-64

I am also having trouble building on osx x64. Whats the best way to send my log?

Looking at the Filesystem build, here is a snippet from the log:

ommon.mkdir bin.v2/libs/filesystem
common.mkdir bin.v2/libs/filesystem/build
common.mkdir bin.v2/libs/filesystem/build/gcc-androidR5
common.mkdir bin.v2/libs/filesystem/build/gcc-androidR5/release
common.mkdir bin.v2/libs/filesystem/build/gcc-androidR5/release/link-static
common.mkdir bin.v2/libs/filesystem/build/gcc-androidR5/release/link-static/threading-multi
common.mkdir bin.v2/libs/filesystem/build/gcc-androidR5/release/link-static/threading-multi/v2
common.mkdir bin.v2/libs/filesystem/build/gcc-androidR5/release/link-static/threading-multi/v2/src
gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-androidR5/release/link-static/threading-multi/v2/src/v2_operations.o
In file included from ./boost/config/platform/macos.hpp:28,
from ./boost/config.hpp:53,
from ./boost/filesystem/v2/config.hpp:30,
from ./boost/filesystem/v2/path.hpp:20,
from ./boost/filesystem/v2/operations.hpp:17,
from libs/filesystem/v2/src/v2_operations.cpp:45:
./boost/config/posix_features.hpp:46:1: warning: "BOOST_HAS_PTHREADS" redefined
In file included from ./boost/config.hpp:26,
from ./boost/filesystem/v2/config.hpp:30,
from ./boost/filesystem/v2/path.hpp:20,
from ./boost/filesystem/v2/operations.hpp:17,
from libs/filesystem/v2/src/v2_operations.cpp:45:
./boost/config/user.hpp:18:1: warning: this is the location of the previous definition
In file included from ./boost/config/platform/macos.hpp:28,
from ./boost/config.hpp:53,
from ./boost/filesystem/v2/config.hpp:30,
from ./boost/filesystem/v2/path.hpp:20,
from ./boost/filesystem/v2/operations.hpp:17,
from libs/filesystem/v2/src/v2_operations.cpp:45:
./boost/config/posix_features.hpp:79:1: warning: "BOOST_HAS_GETTIMEOFDAY" redefined
In file included from ./boost/config.hpp:26,
from ./boost/filesystem/v2/config.hpp:30,
from ./boost/filesystem/v2/path.hpp:20,
from ./boost/filesystem/v2/operations.hpp:17,
from libs/filesystem/v2/src/v2_operations.cpp:45:
./boost/config/user.hpp:22:1: warning: this is the location of the previous definition
In file included from /Developer/android/android-ndk-r5c/sources/cxx-stl/gnu-libstdc++/include/bits/char_traits.h:41,
from /Developer/android/android-ndk-r5c/sources/cxx-stl/gnu-libstdc++/include/string:42,
from ./boost/system/system_error.hpp:11,
from ./boost/filesystem/v2/path.hpp:21,
from ./boost/filesystem/v2/operations.hpp:17,
from libs/filesystem/v2/src/v2_operations.cpp:45:
/Developer/android/android-ndk-r5c/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algobase.h: In function �_OI std::__copy_move_a(_II, _II, _OI)�:
/Developer/android/android-ndk-r5c/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algobase.h:391: error: expected primary-expression before �)� token
/Developer/android/android-ndk-r5c/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algobase.h:391: error: there are no arguments to �__is_pod� that depend on a template parameter, so a declaration of �__is_pod� must be available

Remove versioning in SONAME when compiling shared library

(Only valid when @inetic's shared library solution is incorporated)

Android does not support versioning in SONAMES (https://code.google.com/p/android/issues/detail?id=55868, https://groups.google.com/d/msg/android-ndk/_UhNpRJlA1k/hbryqzEgN94J) so it would be good if they somehow could be modified when building shared libraries for Android.

I have spent some time investigating this but I have yet to come up with a working solution...

Issues raised upstream seem to have died:
https://svn.boost.org/trac/boost/ticket/2746
https://svn.boost.org/trac/boost/ticket/4244

Supporting Boost 1.47

I'm wondering if it would be possible to upgrade to the latest release, Boost 1.47.0. There are many useful changes and additions in it. In particular, Asio 1.6.0 is included, which is a major version.

Thanks.

bjam problem

Hi everyone!
I'm trying to build Boost 1.53 with using NDK 8e

I got an error:

Building boost for android
build-android.sh: line 309: ./bjam: No such file or directory
build-android.sh: line 318: [: !=: unary operator expected

It seems like It can't find bjam. How can I solve it?

stl include paths wrong for android-ndk-r8

the /4.3.3 or /4.6 was missed in the include paths and the toolchain path was old.
Using 4.6 I was then able to get a successfull buld of bosot 1.49.0 on Mac OSX using the r8 ndk and these scripts.

in build-android.sh line 208
8)
CXXPATH=$AndroidNDKRoot/toolchains/arm-linux-androideabi-4.6/prebuilt/$Platfrom/bin/arm-linux-androideabi-g++
CXXFLAGS="-I$AndroidNDKRoot/platforms/android-9/arch-arm/usr/include
-I$AndroidNDKRoot/sources/cxx-stl/gnu-libstdc++/4.6/include
-I$AndroidNDKRoot/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include"
TOOLSET=gcc-androidR8

Can we hardcode these compiler versions? do we need to detect and make them a variable and option also?

Share my experience Boost 1.55 on OSX 10.10 Yosemite

Today I have to build Boost-for-Android because it's needed in this project "sh1r0/caffe-android-lib".

My system is OSX 10.10 Yosemite, My Android NDK version is "r10e", after clone this project, I download the "boost_1_55_0.tar.bz2" and put it inside Boost-for-Android folder

cd Boost-for-Android

basically i need to compile part of boost for android-caffe project with this command:

./build-android.sh /Users/ABC/Work/Libs/android-ndk-r10e --boost=1.55.0 --with-libraries=date_time,math,random,thread,system

error:

Undefined or not supported Android NDK version!

fix:
in "build-android.sh" file, after

    "10 (64-bit)"|"10b (64-bit)"|"10c (64-bit)"|"10d (64-bit)")                 
        TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.6}                       
        CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/arm-linux-androideabi-g++
        TOOLSET=gcc-androidR8e                                                  
        ;;

add

    "10e (64-bit)")                                                                
        TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.9}                          
        CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/arm-linux-androideabi-g++
        TOOLSET=gcc-androidR8e                                                     
        ;; 

so that it recognize the newest "r10e" NDK version, and in "r10e" NDK, it only contains androideabi-4.8 and androideabi-4.9, there isn't androideabi-4.6 anymore.

error:

In file included from ./boost/date_time/gregorian/greg_month.hpp:12:0,
                 from libs/date_time/src/gregorian/greg_month.cpp:14:
./boost/date_time/constrained_value.hpp:12:21: fatal error: exception: No such file or directory
 #include <exception>
                     ^
compilation terminated.

    "arm-linux-androideabi-g++"  -ftemplate-depth-128 -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS -O3 -finline-functions -Wno-inline -Wall -fexceptions -frtti -fpic -ffunction-sections -funwind-tables -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/Users/ABC/Work/Libs/android-ndk-r10e/platforms/android-9/arch-arm/usr/include -Wa,--noexecstack -DANDROID -D__ANDROID__ -DNDEBUG -O2 -g -I/Users/ABC/Work/Libs/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.6/include -I/Users/ABC/Work/Libs/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include -fvisibility=hidden -fvisibility-inlines-hidden -fdata-sections -pthread  -DBOOST_ALL_NO_LIB=1 -DBOOST_DATE_TIME_STATIC_LINK -DDATE_TIME_INLINE -DNDEBUG  -I"." -c -o "bin.v2/libs/date_time/build/gcc-androidR8e/release/link-static/target-os-linux/threading-multi/gregorian/greg_month.o" "libs/date_time/src/gregorian/greg_month.cpp"

...failed gcc.compile.c++ bin.v2/libs/date_time/build/gcc-androidR8e/release/link-static/target-os-linux/threading-multi/gregorian/greg_month.o...

fix:
in "configs/user-config-boost-1_55_0.jam", since the "TOOLSET" for "r10e" is "androidR8e" in "build-android.sh" file, so after

# --------------------------------------------------------------------          
using gcc : androidR8e                                                          
:                                                                               
arm-linux-androideabi-g++ 

i change

<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include     
<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include

to be

<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/include     
<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include

Actually there is no "/Users/ABC/Work/Libs/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.6/include" and "/Users/ABC/Work/Libs/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include" folders, that's why it cannot find exception.hpp.

about "build-android.py" file: "$PROGDIR" is "Boost-for-Android" folder, "$BOOST_DIR" is "boost_1_xx_x" folder, by default every time you run "./build-android.py" it will delete the "boost_1_xx_x" folder and "build" folder, then unzip the "boost_1_xx_x.tar.bz2" again, which is a bit annoying when you are debugging the compilation errors, you can comment line 148-151

#if [ -d "$PROGDIR/$BOOST_DIR" ]; then                                             
    #echo "Cleaning: $BOOST_DIR"                                                   
    #rm -f -r $PROGDIR/$BOOST_DIR                                                  
#fi

then when you run "build-android.py", it will only delete build folder.

Also by default "build-android.py" will copy "configs/user-configboost-1_xx_x.jam" to be "boost_1_xx_x/tools/build/v2/user-config.jam" in line 353 after apply patches to boost, and it actually calls "boost_1_xx_x/tools/build/v2/user-config.jam" file's configurations when it complies. If you comment the line 148-151 as i mentioned above, running "build-android.py" will not copy jam file anymore, so you will need to change "boost_1_xx_x/tools/build/v2/user-config.jam" instead of "configs/user-configboost-1_xx_x.jam" when fix the second type of error.

After all i only built few modules (date_time,math,random,thread,system), and i got stucked in the second type of error for almost a whole day, as i found in "Boost-for-Android/boost_1_55_0/boost" folder there is also "exception.hpp" file and a "exception" folder, at first i thought it was trying to include this header file instead of the "exception.hpp" in NDK folder, so i tried to include "Boost-for-Android/boost_1_55_0/boost" many times but still got the same error untill i found there is no ".../gnu-libstdc++/4.6/..." folders inside NDK.

I still got a "link.jam: No such file or directory" thing, but the compilation finished and seems all the libraries i need are built, hope it works fine in run time.

Error: 'shared_ptr' in namespace 'boost' does not name a type

While I was building a Caffe, In Caffe_classifier.cpp contains
( boost::shared_ptrcaffe::Layer netLayer=net->layer_by_name("eyes");
boost::dynamic_pointer_castcaffe::MemoryDataLayer(netLayer)->Reset((float*)data,&label,1); )
these lines throw issues like below ,

Error 1: CAFFE_classifier.cpp:85:82: error: conversion from 'const std::shared_ptrcaffe::Layer' to non-scalar type 'boost::shared_ptrcaffe::Layer' requested
boost::shared_ptr<caffe::Layer > netLayer = net->layer_by_name("data");
Error 2: CAFFE_classifier.cpp:106:80: error: invalid initialization of reference of type 'const boost::shared_ptrcaffe::Blob&' from expression of type 'const std::shared_ptrcaffe::Blob'
const boost::shared_ptr<Blob >& probLayer = net->blob_by_name("prob");

Please help me what i have to do...thank you

Error building boost.locale

In order to build boost.locale build-android.sh script clones from git libiconv-libicu-android and then run its ./build.sh script, which in turn try to run this command
curl http://download.icu-project.org/files/icu4c/52.1/icu4c-52_1-src.tgz | tar xvz which fails.

this is because file on this url was moved and webserver returns this page:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://sourceforge.net/projects/icu/files/ICU4C/52.1/icu4c-52_1-src.tgz/download">here</a>.</p>
<hr>
<address>Apache/2.2.17 (Fedora) Server at download.icu-project.org Port 80</address>
</body></html>

After this, of cource tar will fail to extract something from this data.
However this URL handled correctly when using wget.
Also, looks like addling -L parameter to curl will allow it to follow redirects: curl -L <URL>.

Boost 1.54.0 build fix

In compiling boost 1.54.0 the log library needed the following patch to compile.
(My build command was "./build-android.sh --boost=1.54.0 --with-libraries=all --without-libraries=python --toolchain=arm-linux-androideabi-4.8 /opt/android-ndk-r9")

Attached is a patch file:

diff -ruN boost_1_54_0-boot/libs/log/src/threadsafe_queue.cpp boost_1_54_0-patched/libs/log/src/threadsafe_queue.cpp
--- boost_1_54_0-boot/libs/log/src/threadsafe_queue.cpp 2013-06-17 14:20:22.000000000 -0700
+++ boost_1_54_0-patched/libs/log/src/threadsafe_queue.cpp 2013-10-30 13:30:34.880317515 -0700
@@ -54,7 +54,7 @@
#endif
#elif (defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200112L)) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600))
// Solaris 10 does not have posix_memalign. Solaris 11 and later seem to have it.
-#if !(defined(sun) || defined(__sun)) || defined(__SunOS_5_11) || defined(__SunOS_5_12)
+#if !(defined(ANDROID) || defined(ANDROID)) && (!(defined(sun) || defined(__sun)) || defined(__SunOS_5_11) || defined(__SunOS_5_12))
#define BOOST_LOG_HAS_POSIX_MEMALIGN 1
#endif
#endif

Linker issues

I’m trying to build my app by using Bjam & Boost.Build for Android, the scripts works fine for Windows and Linux, when I’m building for Android all the modules are compiled, but I can’t make linker to work properly. Linker tells that it can’t find all the libraries, I see many unresolved external symbols from stl and runtime libraries. E.g. /root/android-stuff/android-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtbegin_dynamic.o

Thanx in advance.

boost for andriod on mac osx lion 64 bit

Hi there,
I have been trying to install boost libraries for android on Mac OSX Lion (64-bit). I followed this link:-
#27
and I come across the same issues. I tried installing them on Linux 64 bit with ndk r 9 and worked like a breeze.

As this post is 4 months old I was wandering if this issue has been fixed.

Would appreciate anyone's guidance or feedback.

Boost building Error

Tried to build Boost_1_48_0 with android-ndk-r10d on ubuntu 14.04
Used the command $ ./build-android.sh /bin/android-ndk-r10d

It downloads boost_1_48_0
Unpacks the packages
Patches files and starts build using ndk
and then these errors are promted

error: toolset gcc initialization:
error: version 'androidR8e' requested but 'g++-androidR8e' not found and version '4.6' of default 'g++' does not match
error: initialized from
/home/aman/Boost-for-Android-master/boost_1_48_0/tools/build/v2/build/toolset.jam:38: in toolset.using from module toolset
/home/aman/Boost-for-Android-master/boost_1_48_0/tools/build/v2/build-system.jam:481: in process-explicit-toolset-requests from module build-system
/home/aman/Boost-for-Android-master/boost_1_48_0/tools/build/v2/build-system.jam:562: in load from module build-system
/home/aman/Boost-for-Android-master/boost_1_48_0/tools/build/v2/kernel/modules.jam:283: in import from module modules
/home/aman/Boost-for-Android-master/boost_1_48_0/tools/build/v2/kernel/bootstrap.jam:142: in boost-build from module
/home/aman/Boost-for-Android-master/boost_1_48_0/boost-build.jam:17: in module scope from module

ERROR: Failed to build boost for android!
Done!

Is it possible to link to gnustl_shared?

Hi, thank you very much for your work, I am using your script for building boost for my android ndk project. However, it conists of multiple libaries and therefore I would like to have boost link to gnustl as a shared library. Is that somehow possible with your script? Im experiencing weird crashes in boost (regarding freeing memory in weak_ptr for example) and i suspect it might be because there are multiple instances of gnustl in memory. And ideas?

can't download the zip successfully.

Hi,

I try to execute

./build-android.sh /home/hoveran/android-ndk-r5-crystax-1 --clean

but didn't download the zip successfully. only have one file with 976 bytes [text/html], what's the reason?

Thanks,
Hoveran

To follow build in another terminal, please use: tail -F /home/hoveran/Boost-for-Android/logs/myst-log-7335.log
Cleaning: ./build/
Cleaning: boost_1_45_0
Cleaning: boost_1_45_0.tar.bz2
Building with TOOLSET=gcc-androidR5 CXXPATH=/home/hoveran/android-ndk-r5-crystax-1/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++ CXXFLAGS=-I/home/hoveran/android-ndk-r5-crystax-1/platforms/android-8/arch-arm/usr/include -I/home/hoveran/android-ndk-r5-crystax-1/sources/cxx-stl/gnu-libstdc++/include -I/home/hoveran/android-ndk-r5-crystax-1/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include -I/home/hoveran/android-ndk-r5-crystax-1/sources/wchar-support/include
Downloading boost 1.45.0 please wait...
--2011-08-01 21:09:43-- http://downloads.sourceforge.net/project/boost/boost/1.45.0/boost_1_45_0.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.45.0%2F&ts=1291326673&use_mirror=garr
正在解析主机 downloads.sourceforge.net... 216.34.181.59
正在连接 downloads.sourceforge.net|216.34.181.59|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:http://garr.dl.sourceforge.net/project/boost/boost/1.45.0/boost_1_45_0.tar.bz2 [跟随至新的 URL]
--2011-08-01 21:09:44-- http://garr.dl.sourceforge.net/project/boost/boost/1.45.0/boost_1_45_0.tar.bz2
正在解析主机 garr.dl.sourceforge.net... 193.206.140.34, 2001:760:ffff:b0::34
正在连接 garr.dl.sourceforge.net|193.206.140.34|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Object moved
位置:http://61.156.8.189/proxy.html?e=3f35152317b67dfcWO~O92W2G2AEaOWKwX~EiXvKCXN7i6vmr6I7ToWKSZ91iOmiSJGc2Z85eg~cX9sKt990kZq2q9GkP6vmGOGEOZmZNJ9PcHsQea9o71VarR2kbLmQwa_Oiyd5qFAkEHmulYKk17QZSKNX4_Ws_Y2k17Ma6Gap8748S2_PDyqDiG5PFo_Do~s8r2~XEYv [跟随至新的 URL]
--2011-08-01 21:09:59-- http://61.156.8.189/proxy.html?e=3f35152317b67dfcWO~O92W2G2AEaOWKwX~EiXvKCXN7i6vmr6I7ToWKSZ91iOmiSJGc2Z85eg~cX9sKt990kZq2q9GkP6vmGOGEOZmZNJ9PcHsQea9o71VarR2kbLmQwa_Oiyd5qFAkEHmulYKk17QZSKNX4_Ws_Y2k17Ma6Gap8748S2_PDyqDiG5PFo_Do~s8r2~XEYv
正在连接 61.156.8.189:80... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Moved Temporarily
位置:http://61.156.8.189/forward.html [跟随至新的 URL]
--2011-08-01 21:09:59-- http://61.156.8.189/forward.html
正在连接 61.156.8.189:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 976 [text/html]
正在保存至: “/home/hoveran/Boost-for-Android/boost_1_45_0.tar.bz2”

 0K                                                       100%  222K=0.004s

2011-08-01 21:09:59 (222 KB/s) - 已保存 “/home/hoveran/Boost-for-Android/boost_1_45_0.tar.bz2” [976/976])

Unpack boost
bzip2: (stdin) is not a bzip2 file.
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Performing boost boostrap
cd: 200: can't cd to boost_1_45_0
./build-android.sh: 200: ./bootstrap.sh: not found
cd: 200: can't cd to /home/hoveran/Boost-for-Android/boost_1_45_0
ERROR: Patch failure !! Please check your patches directory! Try to perform a clean build using --clean

Doesn't work at all

I'm building on Windows and no matter how many hours I spend on this thing, I can't get it to build boost. It also looks for the toolchain in the wrong path. Part of the path to the toolchain has "windows-x86" but it is installed as just "windows" in my NDK.

Here are the error logs:

$ ./build-android.sh --boost=1.55.0 $ANDROID_NDK_ROOT
To follow build in another terminal, please use: tail -F /c/code/Boost-for-Android/logs/myst-log-473520.log
Building boost version: 1.55.0
Cleaning: boost_1_55_0

etected Android NDK version 9d
Building with TOOLSET=gcc-androidR8e CXXPATH=/c/android/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86/bin/arm-linux-androideabi-g++ CXXFLAGS=
Unpacking boost
Performing boost bootstrap
Building Boost.Build engine with toolset ...
Failed to build Boost.Build build engine
Consult 'bootstrap.log' for more details
patching file boost/asio/detail/socket_types.hpp
patching file boost/asio/ip/impl/address_v6.ipp
patching file boost/config/user.hpp
patching file boost/interprocess/detail/workaround.hpp
patching file boost/predef/other/endian.h
patching file libs/filesystem/src/operations.cpp
# ---------------
# Build using NDK
# ---------------
Building boost for android
./build-android.sh: line 373: ./bjam: No such file or directory
ERROR: Failed to build boost for android!
Done!

Cannot download boost solution

Please add -L to curl options in build-common.sh

I see your script tries to use wget first then falls back to curl

I was getting the failure on download as I think WGET follows links and CURL does not by default and I don't have wget on my machine.

I pruned off all the extra stuff on the url and added the -L and let it fill in the rest of the link and follow it.

Looking here: http://www.miscdebris.net/blog/2010/04/06/use-curl-to-download-a-file-from-sourceforge-mirror/

Explains it.

I still can't get anything to build without lots of errors, but now I can try a few versions of boost more easily

Cannot link `boost_system` after building; `libboost_system.so` missing?

I successfully built all 10078 targets for Boost 1.53, and am now trying to compile it into a library with the NDK.

I'm using NDK 8e, and my Android.mk looks like:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := vpn
LOCAL_SRC_FILES := vpn.cpp

LOCAL_C_INCLUDES := ${NDKROOT}/sources/cxx-stl/stlport/stlport
LOCAL_CFLAGS :=

LOCAL_LDLIBS    := -llog -landroid
LOCAL_STATIC_LIBRARIES :=

# Start of Boost requirements
LOCAL_CFLAGS += -I$(LOCAL_PATH)/boost/include/boost-1_53
LOCAL_LDLIBS += -L$(LOCAL_PATH)/boost/lib/ -lboost_system

LOCAL_CPPFLAGS += -fexceptions
LOCAL_CPPFLAGS += -frtti
# End of Boost requirements

include $(BUILD_SHARED_LIBRARY)

Executing ndk-build gives:

paul@ubuntu:~/workspace/boost-project$ ~/android-ndk-r8e/ndk-build -w
make: Entering directory `/home/paul/workspace/boost-project'
SharedLibrary  : libvpn.so
/home/paul/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lboost_system
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libvpn.so] Error 1
make: Leaving directory `/home/paul/workspace/boost-project'

My project contains the Boost build files in /jni/boost, although sure enough, libboost_system.so isn't in lib; I only see the archive file libboost_system-gcc-mt-1_53.a.

I get a different error if I try to use the archive file for building by changing LOCAL_LDLIBS to:

LOCAL_LDLIBS += -L$(LOCAL_PATH)/boost/lib/ -lboost_system-gcc-mt-1_53

The error is then:

/home/paul/android-ndk-r8e/toolchains/mipsel-linux-android-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/mipsel-linux-android/4.6/../../../../mipsel-linux-android/bin/ld: skipping incompatible jni/boost/lib//libboost_system-gcc-mt-1_53.a when searching for -lboost_system-gcc-mt-1_53
/home/paul/android-ndk-r8e/toolchains/mipsel-linux-android-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/mipsel-linux-android/4.6/../../../../mipsel-linux-android/bin/ld: cannot find -lboost_system-gcc-mt-1_53

Could it be that there is some incompatibility as the host machine is Ubuntu 12 LTS 64-bit?

Since -lboost_system is suggested, I'm guessing I should be seeing a shared object file libboost_system.so or expect a symbolic link with that name. Is it's absence a symptom of some other problem?

Preprocessed

Trying to build newest version with NDK r8e. Getting this error

In file included from jni/boost/include/boost-1_53/boost/mpl/and.hpp:42:0,
from jni/boost/include/boost-1_53/boost/regex/v4/regex_format.hpp:32,
from jni/boost/include/boost-1_53/boost/regex/v4/regex.hpp:79,
from jni/boost/include/boost-1_53/boost/regex.hpp:31,
from jni/wahet.cpp:28:
jni/boost/include/boost-1_53/boost/mpl/aux_/include_preprocessed.hpp:37:90: fatal error: boost/mpl/aux_/preprocessed/gcc/and.hpp: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi-v7a/objs-debug/wahet/wahet.o] Error 1

This is how me make file looks like:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

include ./jni/opencv/sdk/native/jni/OpenCV.mk

LOCAL_MODULE := wahet
LOCAL_SRC_FILES := wahet.cpp

LOCAL_CFLAGS += -I$(LOCAL_PATH)/boost/include/boost-1_53
LOCAL_LDLIBS += -L$(LOCAL_PATH)/boost/lib/ -libboost_system-gcc-mt-1_53.a -libboost_regex-gcc-mt-1_53.a -libboost_filesystem-gcc-mt-1_53.a -libboost_date_time-gcc-mt-1_53.a
-L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi
-lgnustl_static

include $(BUILD_SHARED_LIBRARY)

Unable to Compile with r10b

Detected Android NDK version 10b (64-bit)
Undefined or not supported Android NDK version!

Just thought I would bring it to your attention.

can't compile in cygwin with ndkR8d

  1. the symbol links in patches directory doesn't work in cygwin
  2. Platform name in ndkR8d for windows is "windows" instead of "windows-x86"
# Check platform patch
case "$HOST_OS" in
    linux)
        Platfrom=linux-x86
        ;;
    darwin|freebsd)
        Platfrom=darwin-x86
        ;;
    windows|cygwin)
        Platfrom=windows
        ;;
    *)  # let's play safe here
        Platfrom=linux-x86
esac
  • NEED HELP. After correcting that, run ./build-android.sh $NDK_ROOT, error message show as follows:
Building boost version: 1.49.0
Building with TOOLSET=gcc-androidR8b CXXPATH=/cygdrive/d/android-ndk-r8d/toolcha                                                        ins/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-g++ CXX                                                        FLAGS=-I/cygdrive/d/android-ndk-r8d/platforms/android-9/arch-arm/usr/include -I/                                                        cygdrive/d/android-ndk-r8d/sources/cxx-stl/gnu-libstdc++/4.6/include -I/cygdrive                                                        /d/android-ndk-r8d/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include
Unpacking boost
Performing boost bootstrap
Building Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.cygwin                                                        x86/b2
Unicode/ICU support for Boost.Regex?... /usr
Generating Boost.Build configuration in project-config.jam...

Bootstrapping is done. To build, run:

    ./b2

To adjust configuration, edit 'project-config.jam'.
Further information:

   - Command line help:
     ./b2 --help

   - Getting started guide:
     http://www.boost.org/more/getting_started/unix-variants.html

   - Boost.Build documentation:
     http://www.boost.org/boost-build2/doc/html/index.html

patching file boost/asio/detail/fenced_block.hpp
patching file boost/asio/detail/socket_types.hpp
patching file boost/asio/ip/impl/address_v6.ipp
patching file boost/config/user.hpp
patching file boost/detail/endian.hpp
patching file boost/interprocess/detail/workaround.hpp
patching file libs/filesystem/v2/src/v2_operations.cpp
patching file libs/filesystem/v3/src/operations.cpp
patching file tools/build/v2/tools/android.jam
patching file tools/build/v2/tools/android.py
patching file tools/build/v2/user-config.jam
# ---------------
# Build using NDK
# ---------------
Building boost for android
env: Files/AMD: No such file or directory
Done!

Fails to build on Win7 and Ndk r8e with boost 1.48

Try to build boost-android-master in window with cygwin and ndk-r8e get following error.

Android@Android-PC /cygdrive/e/jeevan_troxy/framework/Boost/Boost-for-Android-e2001539cd70121b7354a4ff05b5a55a24677bad
$ sh build-android.sh $E:/mayur_eclipse/Android-sdk/android-ndk-r8e
To follow build in another terminal, please use: tail -F /cygdrive/e/jeevan_troxy/framework/Boost/Boost-for-Android-e2001539cd70121b7354a4ff05b5a55a24677bad/logs/myst-log-3316.log
Building boost version: 1.48.0
Building with TOOLSET=gcc-androidR4 CXXPATH=:/mayur_eclipse/Android-sdk/android-ndk-r8e/build/prebuilt/windows-x86/arm-eabi-4.4.0/bin/arm-eabi-g++ CXXFLAGS=-I:/mayur_eclipse/Android-sdk/android-ndk-r8e/build/platforms/android-8/arch-arm/usr/include
Cannot find C++ compiler at: :/mayur_eclipse/Android-sdk/android-ndk-r8e/build/prebuilt/windows-x86/arm-eabi-4.4.0/bin/arm-eabi-g++

endian.hpp "ANDROID" should be "__ANDROID__"

I had to rename the variable "ANDROID" to "ANDROID" to be able to compile using the static libraries that this tool produced. Without this change endian.hpp complained about not having a cpu type defined.

Boost 1.55.0 doesn't patch out of the box?

With the latest setup, cloned on 8/2/2014, I don't get a clean patch on boost 1.55.0..

I get the following: (On ubuntu 14 lts, with Android NDK r10)

patch: **** malformed patch at line 62: diff -u -r boost_1_55_0/boost/interprocess/detail/workaround.hpp boost_1_55_0.patched/boost/interprocess/detail/workaround.hpp

Android-x86 support

Could you please kindly add Android-x86 support?

I have already made the following changes:

echo "Detected Android NDK version $NDK_RN"

case "$NDK_RN" in
.
.
.
"8e (64-bit)")
TOOLCHAIN=${TOOLCHAIN:-x86-4.8}
CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/i686-linux-android-g++
TOOLSET=gcc-androidR8e
;;
"9 (64-bit)"|"9b (64-bit)"|"9c (64-bit)"|"9d (64-bit)")
TOOLCHAIN=${TOOLCHAIN:-x86-4.8}
CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/i686-linux-android-g++
TOOLSET=gcc-androidR8e
;;
"10 (64-bit)")
TOOLCHAIN=${TOOLCHAIN:-x86-4.8}
CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/i686-linux-android-g++
TOOLSET=gcc-androidR8e
;;
*)
echo "Undefined or not supported Android NDK version!"
exit 1
esac

if [ -n "${AndroidSourcesDetected}" ]; then # Overwrite CXXPATH if we are building from Android sources
CXXPATH="${ANDROID_TOOLCHAIN}/i686-linux-android-g++"
fi

But the following command fails to build Boost
./build-android.sh --boost=1.55.0 --toolchain=x86-4.8 --with-libraries=atomic,chrono,context,coroutine,date_time,exception,filesystem,graph,graph_parallel,iostreams,locale,log,math,mpi,program_options,random,regex,serialization,signals,system,test,thread,timer,wave /opt/android/ndk

Building boost for android
Adding pathname: /opt/android/ndk/toolchains/x86-4.8/prebuilt/linux-x86_64/bin
/home/babaei/Desktop/Boost-for-Android/boost_1_55_0/tools/build/v2/tools/gcc.jam:83: in gcc.init from module gcc
error: toolset gcc initialization:
error: provided command 'arm-linux-androideabi-g++' not found
error: initialized from /home/babaei/Desktop/Boost-for-Android/boost_1_55_0/tools/build/v2/user-config.jam:85
/home/babaei/Desktop/Boost-for-Android/boost_1_55_0/tools/build/v2/build/toolset.jam:41: in toolset.using from module toolset
/home/babaei/Desktop/Boost-for-Android/boost_1_55_0/tools/build/v2/build/project.jam:1007: in using from module project-rules
/home/babaei/Desktop/Boost-for-Android/boost_1_55_0/tools/build/v2/user-config.jam:85: in modules.load from module user-config
/home/babaei/Desktop/Boost-for-Android/boost_1_55_0/tools/build/v2/build-system.jam:249: in load-config from module build-system
/home/babaei/Desktop/Boost-for-Android/boost_1_55_0/tools/build/v2/build-system.jam:389: in load-configuration-files from module build-system
/home/babaei/Desktop/Boost-for-Android/boost_1_55_0/tools/build/v2/build-system.jam:524: in load from module build-system
/home/babaei/Desktop/Boost-for-Android/boost_1_55_0/tools/build/v2/kernel/modules.jam:289: in import from module modules
/home/babaei/Desktop/Boost-for-Android/boost_1_55_0/tools/build/v2/kernel/bootstrap.jam:139: in boost-build from module
/home/babaei/Desktop/Boost-for-Android/boost_1_55_0/boost-build.jam:17: in module scope from module

ERROR: Failed to build boost for android!
Done!

Commit access for other developers?

Hi @moritz-wundke. It seems the repository is becoming quite hairy. Perhaps some of us could help you with merging?

One option would be that some of us would start merging changes from others into our repositories and then you would merge those bigger branches. This seems to be the case now. My opinion is that this puts too much responsibility onto you and perhaps that is the reason why there hasn't been many merges into the main branch lately.

Another option would be to give some of us a commit access to the main branch. Have a look at this blog post which explains this idea in more detail. I perhaps wouldn't give access to everyone, but looking at network graph one could find a few people that I think would be happy to help (e.g. @pelya, @derkling, @crazymaik, @madadam).

Add r9b to README

From the commit history, it looks like NDK r9b is supported, but it's not listed in the README.

Boost locale support

Hi I tried enabling boost locale for android by changing line 72 in build-android.sh:

LIBRARIES=--with-libraries=date_time,filesystem,program_options,regex,signals,system,thread,iostreams,locale

bjam also tries to build this but:

- iconv (libc) : no - iconv (separate) : no - icu : no - icu (lib64) : no - Boost.Locale needs either iconv or ICU library to be built. - Boost.Locale needs either iconv or ICU library to be built. - Boost.Locale needs either iconv or ICU library to be built. - Boost.Locale needs either iconv or ICU library to be built. - Boost.Locale needs either iconv or ICU library to be built. - Boost.Locale needs either iconv or ICU library to be built. - has_icu builds : no

Component configuration:

- atomic                   : not building
- chrono                   : not building
- context                  : not building
- date_time                : building
- exception                : not building
- filesystem               : building
- graph                    : not building
- graph_parallel           : not building
- iostreams                : building
- locale                   : building
- math                     : not building
- mpi                      : not building
- program_options          : building
- python                   : not building
- random                   : not building
- regex                    : building
- serialization            : not building
- signals                  : building
- system                   : building
- test                     : not building
- thread                   : building
- timer                    : not building
- wave                     : not building

So I tried building ICU with these instructions and got them made:

http://thebugfreeblog.blogspot.de/2013/05/cross-building-icu-for-applications-on.html

I have a directory, but as I see boost needs a special directory as told here:

http://www.boost.org/doc/libs/1_48_0/libs/locale/doc/html/building_boost_locale.html

So I tried to overrride ./bjam with
./bjam --with-locale -sICU_PATH=<icu_dir> stage

but no luck, it still tells me the same error. As told the libs are there.

I hope someone can help on this and enable boost locale...

Does not compile with ndk8b

With the latest version of the ndk, the script does not yet work. The standard compiler was changed to be 4.6 - the script does not yet take that into account.

cannot locate symbol "__gxx_personality_v0" on runtime for boost 1.54

Hi

I was use the NDK9 and Boost-for-Android to build a boost for my
android, it can finish build but some issue in runtime

CANNOT LINK EXECUTABLE: could not load library "libboost_system-gcc-mt-1_54.so.1
.54.0" needed by "a.out"; caused by cannot locate symbol "__gxx_personality_v0"
referenced by "libboost_system-gcc-mt-1_54.so.1.54.0"

I think it may caused by the bionic not support exception ,but it seems boost must use -fexception.

Any idea for the issue?

warnings "relocation refers to discarded section" when using static boost libs

Thanks for providing these scripts, they help a lot.
When including the boost libs (built with Boost-for-Android) in an NDK shared lib project -- specifically, I need boost_system and boost_thread -- ndk-build is giving me the following warnings:

jni/../../../Boost-for-Android/build/lib/libboost_thread-gcc-mt-1_53.a(thread.o):thread.cpp:function non-virtual thunk to boost::exception_detail::bad_alloc_::~bad_alloc_(): warning: relocation refers to discarded section
jni/../../../Boost-for-Android/build/lib/libboost_thread-gcc-mt-1_53.a(thread.o):thread.cpp:function non-virtual thuntk to boost::exception_detail::bad_exception_::~bad_exception_(): warning: relocation refers to discarded section
jni/../../../Boost-for-Android/build/lib/libboost_thread-gcc-mt-1_53.a(thread.o):thread.cpp:function non-virtual thunk to boost::exception_detail::error_info_injector<boost::thread_resource_error>::~error_info_injector(): warning: relocation refers to discarded section
jni/../../../Boost-for-Android/build/lib/libboost_thread-gcc-mt-1_53.a(thread.o):thread.cpp:function non-virtual thunk to boost::exception_detail::error_info_injector<boost::lock_error>::~error_info_injector(): warning: relocation refers to discarded section
jni/../../../Boost-for-Android/build/lib/libboost_thread-gcc-mt-1_53.a(thread.o):thread.cpp:function non-virtual thunk to boost::exception_detail::error_info_injector<boost::condition_error>::~error_info_injector(): warning: relocation refers to discarded section

It's unclear to me if they have particular consequences -- the build suceeds, the app runs -- but I'm investigating some spurious issues (which MAY be completely unrelated, but threading issues are notoriously difficult...). I'd feel more comfortable fixing these warnings (or at least knowing that they can be ignored...).

Here are the relevant (I hope) sections of my Android.mk which uses boost:

LOCAL_PATH := $(call my-dir)
...

include $(CLEAR_VARS)
LOCAL_MODULE := boost_system-prebuilt
LOCAL_SRC_FILES = ../../../Boost-for-Android/build/lib/lib$(BOOST_LIB)-gcc-mt-1_53.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := boost_thread-prebuilt
LOCAL_SRC_FILES = ../../../Boost-for-Android/build/lib/lib$(BOOST_LIB)-gcc-mt-1_53.a
include $(PREBUILT_STATIC_LIBRARY)

...

include $(CLEAR_VARS)

LOCAL_MODULE := my_module

...

LOCAL_CFLAGS += -std=gnu++11

LOCAL_STATIC_LIBRARIES := \
    (other libs here, including OpenCV) \
    boost_thread-prebuilt boost_system-prebuilt \

LOCAL_SHARED_LIBRARIES := \
    (also some other libs here) \
...

(source files, etc)

LOCAL_C_INCLUDES := \
    (other paths) \
    $(LOCAL_PATH)/../../../Boost-for-Android/boost_1_53_0 \

LOCAL_ARM_MODE := arm

include $(BUILD_SHARED_LIBRARY)

The boost libs have been built with

./build-android.sh ~/android-devel/android-ndk-r10d/

...and the project is subsequently built with

~/android-devel/android-ndk-r10d/ndk-build -j4

Searching for the error message online suggests that warnings like this may occurr when using different compiler versions and such, but I haven't found anything that appeared to be applicable here; or better said: which I was able to apply here.

Any hints as to how to eliminate the warnings' cause or where I might find more information are appreciated :) Thanks!

Error during linking with android app

Hey there!

I'm getting the following weird errors when linking my project against the boost libraries. Any idea where that might be coming from?
I don't suppose renaming the files by taking the -gcc-mt from the filename broke anything.

I compiled the 1.53 Boost with the official NDK 8d according to your instructions on my Ubuntu VM

1>Link:
1> .LTHUNK0' referenced in section.text._ZN5boost16exception_detail10bad_alloc_D1Ev[_ZN5boost16exception_detail10bad_alloc_D1Ev]' of D:/master/svn/ogre/ogre/AndroidDependencies/lib\libboost_thread.a(thread.o): defined in discarded section .text._ZN5boost16exception_detail10bad_alloc_D2Ev[_ZN5boost16exception_detail10bad_alloc_D5Ev]' of D:/master/svn/ogre/ogre/AndroidDependencies/lib\libboost_thread.a(thread.o) 1>.LTHUNK2' referenced in section .text._ZN5boost16exception_detail14bad_exception_D1Ev[_ZN5boost16exception_detail14bad_exception_D1Ev]' of D:/master/svn/ogre/ogre/AndroidDependencies/lib\libboost_thread.a(thread.o): defined in discarded section.text._ZN5boost16exception_detail14bad_exception_D2Ev[_ZN5boost16exception_detail14bad_exception_D5Ev]' of D:/master/svn/ogre/ogre/AndroidDependencies/lib\libboost_thread.a(thread.o)
1> .LTHUNK30' referenced in section.text._ZN5boost16exception_detail19error_info_injectorINS_21thread_resource_errorEED1Ev[_ZN5boost16exception_detail19error_info_injectorINS_21thread_resource_errorEED1Ev]' of D:/master/svn/ogre/ogre/AndroidDependencies/lib\libboost_thread.a(thread.o): defined in discarded section .text._ZN5boost16exception_detail19error_info_injectorINS_21thread_resource_errorEED2Ev[_ZN5boost16exception_detail19error_info_injectorINS_21thread_resource_errorEED5Ev]' of D:/master/svn/ogre/ogre/AndroidDependencies/lib\libboost_thread.a(thread.o) 1>.LTHUNK36' referenced in section .text._ZN5boost16exception_detail19error_info_injectorINS_10lock_errorEED1Ev[_ZN5boost16exception_detail19error_info_injectorINS_10lock_errorEED1Ev]' of D:/master/svn/ogre/ogre/AndroidDependencies/lib\libboost_thread.a(thread.o): defined in discarded section.text._ZN5boost16exception_detail19error_info_injectorINS_10lock_errorEED2Ev[_ZN5boost16exception_detail19error_info_injectorINS_10lock_errorEED5Ev]' of D:/master/svn/ogre/ogre/AndroidDependencies/lib\libboost_thread.a(thread.o)
1>collect2.exe : error : ld returned 1 exit status

fails to build on win7-64

Using cygwin and win7 x64.

$ ./build-android.sh
To follow build in another terminal, please use: tail -F /cygdrive/f/work/Immersive.Media/dev/trunk/im360.lib/common/boost-android/logs/
myst-log-5600.log
Using AndroidNDKRoot = /cygdrive/d/Dev/android-ndk-r6
Building with TOOLSET=gcc-androidR4 CXXPATH=/cygdrive/d/Dev/android-ndk-r6/build/prebuilt/windows-x86/arm-eabi-4.4.0/bin/arm-eabi-g++ CX
XFLAGS=-I/cygdrive/d/Dev/android-ndk-r6/build/platforms/android-8/arch-arm/usr/include
Cannot find C++ compiler at: /cygdrive/d/Dev/android-ndk-r6/build/prebuilt/windows-x86/arm-eabi-4.4.0/bin/arm-eabi-g++

Any help would be appreciated.

Thanks.

-=ben

Question: How to static link boost to an app ?

Hey,

More a question than an issue, but I see in the README.md that you need to use the LOCAL_LDLIBS option.

However, reading the NDK doc, they state that this is used to link against /system/lib, which contains the android system libs (at least, that' what I understood) and therefore not the boost lib built thanks to your tool:

LOCAL_LDLIBS
    The list of additional linker flags to be used when building your
    module. This is useful to pass the name of specific system libraries
    with the "-l" prefix. For example, the following will tell the linker
    to generate a module that links to /system/lib/libz.so at load time:

      LOCAL_LDLIBS := -lz

    See docs/STABLE-APIS.html for the list of exposed system libraries you
    can linked against with this NDK release.

So I'm a bit confused. Shouldn't LOCAL_STATIC_LIBRARIES be used instead ?

LOCAL_STATIC_LIBRARIES
    The list of static libraries modules (built with BUILD_STATIC_LIBRARY)
    that should be linked to this module. This only makes sense in
    shared library modules.

If anyone can help me understand, that would be great thanks!

BQ.

Build fails on Ubuntu 12 LTS 64-bit

Possibly related to issue #27, except I'm trying to build from a completely clean Ubuntu 12 LTS virtual machine. The build fails with:

$ ./build-android.sh --with-libraries=chrono,program_options,system,thread ../android-ndk-r8e
[...]
Building boost for android
/home/paul/boost/Boost-for-Android/boost_1_53_0/tools/build/v2/tools/gcc.jam:78: in gcc.init from module gcc
error: toolset gcc initialization:
error: provided command 'arm-linux-androideabi-g++' not found
error: initialized from /home/paul/boost/Boost-for-Android/boost_1_53_0/tools/build/v2/user-config.jam:85
/home/paul/boost/Boost-for-Android/boost_1_53_0/tools/build/v2/build/toolset.jam:39: in toolset.using from module toolset
/home/paul/boost/Boost-for-Android/boost_1_53_0/tools/build/v2/build/project.jam:898: in using from module project-rules
/home/paul/boost/Boost-for-Android/boost_1_53_0/tools/build/v2/user-config.jam:85: in modules.load from module user-config
/home/paul/boost/Boost-for-Android/boost_1_53_0/tools/build/v2/build-system.jam:257: in load-config from module build-system
/home/paul/boost/Boost-for-Android/boost_1_53_0/tools/build/v2/build-system.jam:399: in load-configuration-files from module build-system
/home/paul/boost/Boost-for-Android/boost_1_53_0/tools/build/v2/build-system.jam:555: in load from module build-system
/home/paul/boost/Boost-for-Android/boost_1_53_0/tools/build/v2/kernel/modules.jam:283: in import from module modules
/home/paul/boost/Boost-for-Android/boost_1_53_0/tools/build/v2/kernel/bootstrap.jam:142: in boost-build from module
/home/paul/boost/Boost-for-Android/boost_1_53_0/boost-build.jam:17: in module scope from module

ERROR: Failed to build boost for android!
Done!

I've confirmed that the g++ compiler is present at the specified CXXPATH:

$ ../android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
arm-linux-androideabi-g++: fatal error: no input files

Any idea what might be causing this and how I can try resolving it?

Rewrite script in Python

Seeing as there is quite some unreliable voodoo done in the script and it runs on *nix platforms only, I think it would be best to rewrite in Python, so Windows users might use the script, too.

no possible to build shared library

Hi !

I tried to build boost as shared library, but I get this kind of errors :

cannot find crtbegin_so.o
cannot find -lrt

Does anybody has a solution ?

I built static libraries using boost 1_49 and ndk8b without any problems.

Gabriel

x86_64 version support

Hi all,
Has someone implemented boost-1_55 with x86_64 version? Could someone give me some hints to do it?

My env:
NDK version : android-ndk-r10e
NDK_TOOLCHAIN_VERSION := 4.9
APP_PLATFORM := android-21
APP_ABI := x86_64

Can not find pyconfig.h in ubuntu 14.04 use NDK r10c(devel branch)

Dear Moritz-wundke and all friends:
I try to build boost for android in ubuntu 14.04.
My NDK version is r10c, so I use the devel branch.
1、Step1: First time, I get the error:
gcc.compile.c++ bin.v2/libs/python/build/gcc-androidR8e/release/link-static/threading-multi/numeric.o
In file included from ./boost/python/detail/prefix.hpp:13:0,
from ./boost/python/numeric.hpp:8,
from libs/python/src/numeric.cpp:6:
./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
fatal error: pyconfig.h: No such file or directory,there have 28 same errors.
I get the suggest:
sudo apt get install phthon-dev
After I install the phthon, I get the new error:
2、Step2:
gcc.compile.c++ bin.v2/libs/python/build/gcc-androidR8e/release/link-static/threading-multi/numeric.o
In file included from ./boost/python/detail/wrap_python.hpp:50:0,
from ./boost/python/detail/prefix.hpp:13,
from ./boost/python/numeric.hpp:8,
from libs/python/src/numeric.cpp:6:
/usr/include/python2.7/pyconfig.h:15:52: fatal error: arm-linux-gnueabi/python2.7/pyconfig.h: No such file or directory compilation terminated.

Fatal error: arm-linux-gnueabi/python2.7/pyconfig.h,there is 28 same error.

In /usr/include/python2.7/pyconfig.h: Line15:

elif defined(ARM_EABI) && !defined(__ARM_PCS_VFP)

include <arm-linux-gnueabi/python2.7/pyconfig.h>

I have not got good suggest in the internet.
Can you help me , what's wrong with me ?
Thanks.

arm-linux-androideabi-g++: not found

With whatever clone (master) or fork I try, I get this:

Building boost for android
sh: arm-linux-androideabi-g++: not found
sh: arm-linux-androideabi-g++: not found
sh: arm-linux-androideabi-g++: not found
sh: arm-linux-androideabi-g++: not found

The file is there. On the proper path and all.

Fails to build on Win7 x64 and Ndk r8

I am trying to build it on windows7 64 bit with Cygwin installed and Android-ndk-r8, but getting the following error message.

CONSOLE

admin@admin-PC /cygdrive/c/users/admin/Downloads/Boost-for-Android-master
$ sh build-android.sh
To follow build in another terminal, please use: tail -F /cygdrive/c/users/admin/Downloads/Boost-for-Android-master/logs/myst-log-2272.log
Building boost version: 1.53.0
Using AndroidNDKRoot = /cygdrive/c/android-ndk-r8
Detected Android NDK version 8
Building with TOOLSET=gcc-androidR8 CXXPATH=/cygdrive/c/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows-x86/bin/arm-linux-androideabi-g++ CXXFLAGS=
Cannot find C++ compiler at: /cygdrive/c/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows-x86/bin/arm-linux-androideabi-g++

Any help would be appreciated. Thanks

problem building boost for android x86 in ubuntu

Hi, i suppose that i cannot run the .so libraries compiled for linux x86 on the emulator, so i tried to compile on linux the libraries for x86 for Android with this
./build-android.sh --boost=1.55.0 --toolchain=x86-4.6 /home/teo/Scrivania/android-ndk-r9b

at very first i had a problem with the toolchain: he is looking for the arm one so i substitue it with the i686 one in build-android.sh
so it will become like this
"9 (64-bit)"|"9b (64-bit)")
TOOLCHAIN=${TOOLCHAIN:-x86-4.6}
CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/i686-linux-android-g++

after that it arrives until the "build using NDK" comment then i have this error
error: provided command 'arm-linux-androideabi-g++' not found
this is probably in user-config.jam
there there are a lot of cxx flags and they are setted at the boost startup i presume, but they always refer to arm processor and not to x86

how can i proceed ?
thank you in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.