Skip to content

Commit

Permalink
Support boost 1.83.0 on ndk26
Browse files Browse the repository at this point in the history
  • Loading branch information
justusranvier authored and pelya committed Dec 21, 2023
1 parent 63b9eef commit c935efc
Show file tree
Hide file tree
Showing 9 changed files with 8,757 additions and 40 deletions.
72 changes: 36 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,38 @@ Other versions of Boost are built only for arm architecture, they are using gcc

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 |
| ----------- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
| r4 customized by [Dmitry Moskalchuk aka CrystaX](http://www.crystax.net/android/ndk.php). | x | | | | | | | | | | | | | | | | | | |
| r5 from the [official android repository](http://developer.android.com). | x | | | | | | | | | | | | | | | | | | |
| r5 customized by [CrystaX](http://www.crystax.net/android/ndk.php). | x | | | | | | | | | | | | | | | | | | |
| r7 customized by [CrystaX](http://www.crystax.net/android/ndk.php). | x | x | x | | | | | | | | | | | | | | | | |
| r8 from the [official android repository](http://developer.android.com). | x | x | x | | | | | | | | | | | | | | | | |
| r8b from the [official android repository](http://developer.android.com). | | x | x | | | | | | | | | | | | | | | | |
| r8c from the [official android repository](http://developer.android.com). | | | x | | | | | | | | | | | | | | | | |
| r8d from the [official android repository](http://developer.android.com). | | | x | x | | | | | | | | | | | | | | | |
| r8e from the [official android repository](http://developer.android.com). | | | x | x | | | | | | | | | | | | | | | |
| r10 from the [official android repository](http://developer.android.com). | | | x | x | | | | | | | | | | | | | | | |
| r16 from the [official android repository](http://developer.android.com). | | | | | x | x | x | x | | x | | | | | | | | | |
| r17b from the [official android repository](http://developer.android.com). | | | | | | | x | x | | x | | | | | | | | | |
| r18 from the [official android repository](http://developer.android.com). | | | | | | | | x | | | | | | | | | | | |
| r18b from the [official android repository](http://developer.android.com). | | | | | | | | x | x | x | | | | | | | | | |
| r19 from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | |
| r19b from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | |
| r19c from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | |
| r20 from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | |
| r20b from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | |
| r21 from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | |
| r21b from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | |
| r21c from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | |
| r21d from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | |
| r21e from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | |
| r23 from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | x | x | x | x | x | x | x |
| r23b from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | x | x | x | x | x | x | x |
| r25 from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | x | x | x | x | x | x | x |
| r25b from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | x | x | x | x | x | x | x |
| r25c from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | x | x | x | x | x | x | x |
| r26 from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | x | x | x | x | x | x | x |
| 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 |
| ----------- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
| r4 customized by [Dmitry Moskalchuk aka CrystaX](http://www.crystax.net/android/ndk.php). | x | | | | | | | | | | | | | | | | | | | |
| r5 from the [official android repository](http://developer.android.com). | x | | | | | | | | | | | | | | | | | | | |
| r5 customized by [CrystaX](http://www.crystax.net/android/ndk.php). | x | | | | | | | | | | | | | | | | | | | |
| r7 customized by [CrystaX](http://www.crystax.net/android/ndk.php). | x | x | x | | | | | | | | | | | | | | | | | |
| r8 from the [official android repository](http://developer.android.com). | x | x | x | | | | | | | | | | | | | | | | | |
| r8b from the [official android repository](http://developer.android.com). | | x | x | | | | | | | | | | | | | | | | | |
| r8c from the [official android repository](http://developer.android.com). | | | x | | | | | | | | | | | | | | | | | |
| r8d from the [official android repository](http://developer.android.com). | | | x | x | | | | | | | | | | | | | | | | |
| r8e from the [official android repository](http://developer.android.com). | | | x | x | | | | | | | | | | | | | | | | |
| r10 from the [official android repository](http://developer.android.com). | | | x | x | | | | | | | | | | | | | | | | |
| r16 from the [official android repository](http://developer.android.com). | | | | | x | x | x | x | | x | | | | | | | | | | |
| r17b from the [official android repository](http://developer.android.com). | | | | | | | x | x | | x | | | | | | | | | | |
| r18 from the [official android repository](http://developer.android.com). | | | | | | | | x | | | | | | | | | | | | |
| r18b from the [official android repository](http://developer.android.com). | | | | | | | | x | x | x | | | | | | | | | | |
| r19 from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | | |
| r19b from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | | |
| r19c from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | | |
| r20 from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | | |
| r20b from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | | |
| r21 from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | | |
| r21b from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | | |
| r21c from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | | |
| r21d from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | | |
| r21e from the [official android repository](http://developer.android.com). | | | | | | | | | x | x | x | x | x | | | | | | | |
| r23 from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | x | x | x | x | x | x | x | x |
| r23b from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | x | x | x | x | x | x | x | x |
| r25 from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | x | x | x | x | x | x | x | x |
| r25b from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | x | x | x | x | x | x | x | x |
| r25c from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | x | x | x | x | x | x | x | x |
| r26 from the [official android repository](http://developer.android.com). | | | | | | | | | | | | | 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.

Expand Down Expand Up @@ -69,9 +69,9 @@ 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`.
Expand All @@ -98,7 +98,7 @@ The projects is split into two main branches, the master and devel. The master b

## Troubleshooting

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

### Building from a 64 bit machine (Linux)
Expand All @@ -112,7 +112,7 @@ To install them just use the following

### NDK 7 (CrystaX)

Add `-lgnustl_static` *AFTER* all boost libraries to the LOCAL_LDLIBS line in
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
Expand Down
12 changes: 8 additions & 4 deletions build-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ SCRIPTDIR="$(cd "$(dirname "$0")"; pwd)" # " # This extra quote fixes syntax hig
# -----------------------

BOOST_VER1=1
BOOST_VER2=82
BOOST_VER2=83
BOOST_VER3=0
register_option "--boost=<version>" boost_version "Boost version to be used, one of {1.82.0 1.80.0 1.79.0 1.78.0 1.76.0 1.74.0, 1.73.0, 1.71.0, 1.70.0, 1.69.0, 1.68.0, 1.67.0, 1.66.0, 1.65.1, 1.55.0, 1.54.0, 1.53.0, 1.49.0, 1.48.0, 1.45.0}, default is 1.82.0."
register_option "--boost=<version>" boost_version "Boost version to be used, one of {1.83.0 1.82.0 1.80.0 1.79.0 1.78.0 1.76.0 1.74.0, 1.73.0, 1.71.0, 1.70.0, 1.69.0, 1.68.0, 1.67.0, 1.66.0, 1.65.1, 1.55.0, 1.54.0, 1.53.0, 1.49.0, 1.48.0, 1.45.0}, default is 1.83.0."
boost_version()
{
if [ "$1" = "1.82.0" ]; then
if [ "$1" = "1.83.0" ]; then
BOOST_VER1=1
BOOST_VER2=83
BOOST_VER3=0
elif [ "$1" = "1.82.0" ]; then
BOOST_VER1=1
BOOST_VER2=82
BOOST_VER3=0
Expand Down Expand Up @@ -644,7 +648,7 @@ echo "Building boost for android for $ARCH"
unset WITHOUT_LIBRARIES
fi

{
{
./b2 -q \
-d+2 \
--ignore-site-config \
Expand Down
1 change: 1 addition & 0 deletions configs/user-config-ndk23-1_83_0-arm64-v8a.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions configs/user-config-ndk23-1_83_0-armeabi-v7a.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<compileflags>-mthumb
22 changes: 22 additions & 0 deletions configs/user-config-ndk23-1_83_0-common.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

# --------------------------------------------------------------------

using clang : %ARCH%
:
$(AndroidCompiler_%ARCH%)
:
<archiver>$(AndroidBinariesPath)/llvm-ar
<ranlib>$(AndroidBinariesPath)/llvm-ranlib
<compileflags>-fPIC
<compileflags>-ffunction-sections
<compileflags>-fdata-sections
<compileflags>-funwind-tables
<compileflags>-fstack-protector-strong
<compileflags>-no-canonical-prefixes
<compileflags>-Wformat
<compileflags>-Werror=format-security
<compileflags>-frtti
<compileflags>-fexceptions
<compileflags>-DNDEBUG
<compileflags>-g
<compileflags>-Oz
1 change: 1 addition & 0 deletions configs/user-config-ndk23-1_83_0-x86.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions configs/user-config-ndk23-1_83_0-x86_64.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

54 changes: 54 additions & 0 deletions configs/user-config-ndk23-1_83_0.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2003, 2005 Douglas Gregor
# Copyright 2004 John Maddock
# Copyright 2002, 2003, 2004, 2007 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

# This file is used to configure your Boost.Build installation. You can modify
# this file in place, or you can place it in a permanent location so that it
# does not get overwritten should you get a new version of Boost.Build. See:
#
# http://www.boost.org/boost-build2/doc/html/bbv2/overview/configuration.html
#
# for documentation about possible permanent locations.

# This file specifies which toolsets (C++ compilers), libraries, and other
# tools are available. Often, you should be able to just uncomment existing
# example lines and adjust them to taste. The complete list of supported tools,
# and configuration instructions can be found at:
#
# http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html
#

# This file uses Jam language syntax to describe available tools. Mostly,
# there are 'using' lines, that contain the name of the used tools, and
# parameters to pass to those tools -- where paremeters are separated by
# semicolons. Important syntax notes:
#
# - Both ':' and ';' must be separated from other tokens by whitespace
# - The '\' symbol is a quote character, so when specifying Windows paths you
# should use '/' or '\\' instead.
#
# More details about the syntax can be found at:
#
# http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language
#
# ------------------
# Android configurations.
# ------------------

import os ;
local AndroidNDKRoot = [ os.environ AndroidNDKRoot ] ;
local AndroidBinariesPath = [ os.environ AndroidBinariesPath ] ;
local AndroidTargetVersion32 = [ os.environ AndroidTargetVersion32 ] ;
local AndroidTargetVersion64 = [ os.environ AndroidTargetVersion64 ] ;

local AndroidCompiler_arm64v8a = $(AndroidBinariesPath)/aarch64-linux-android$(AndroidTargetVersion64)-clang++ ;
local AndroidCompiler_armeabiv7a = $(AndroidBinariesPath)/armv7a-linux-androideabi$(AndroidTargetVersion32)-clang++ ;
local AndroidCompiler_x86 = $(AndroidBinariesPath)/i686-linux-android$(AndroidTargetVersion32)-clang++ ;
local AndroidCompiler_x8664 = $(AndroidBinariesPath)/x86_64-linux-android$(AndroidTargetVersion64)-clang++ ;

local AndroidBinaryPrefix_arm64v8a = $(AndroidBinariesPath)/aarch64-linux-android ;
local AndroidBinaryPrefix_armeabiv7a = $(AndroidBinariesPath)/arm-linux-androideabi ;
local AndroidBinaryPrefix_x86 = $(AndroidBinariesPath)/i686-linux-android ;
local AndroidBinaryPrefix_x8664 = $(AndroidBinariesPath)/x86_64-linux-android ;
Loading

0 comments on commit c935efc

Please sign in to comment.