Boost-for-Android icon indicating copy to clipboard operation
Boost-for-Android copied to clipboard

compile boost1.68 shared library for armeabi-v7a with NDK r20 in x86-64 Linux

Open Ruffletuft opened this issue 5 years ago • 1 comments

Here's my command:

 ./build-android.sh ~/android-ndk-r20b/ --boost=1.68.0 --with-libraries=system,thread --arch=armeabi-v7a

Here's output:

To follow build in another terminal, please use: tail -F /home/haed/boost-for-android/Boost-for-Android/logs/myst-log-15584.log
Building boost version: 1.68.0
Cleaning: boost_1_68_0
Cleaning: ./build/
Detected Android NDK version 20.1
Building with TOOLSET=clang CONFIG_VARIANT=ndk19 CXXPATH=/home/haed/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ CFLAGS= CXXFLAGS=
Unpacking boost
Performing boost bootstrap
Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2
Unicode/ICU support for Boost.Regex?... not found.
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/build/doc/html/index.html

patching file boost/config/user.hpp
patching file boost/asio/detail/config.hpp
patching file boost/system/error_code.hpp
patching file libs/filesystem/src/operations.cpp
# ---------------
# Build using NDK
# ---------------
Building boost for android for armeabi-v7a
Adding pathname: /home/haed/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin
AndroidBinariesPath: /home/haed/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin
Performing configuration checks

    - default address-model    : 64-bit
    - default architecture     : x86
    - symlinks supported       : yes
    - lockfree boost::atomic_flag : yes

The out put file name islibboost_thread-clang-mt-x64-1_68.so.1.68.0.Shouldn't x64 bea accoding to Library naming?What's wrong with my command or something else? Also,when I tried to link the library to Android Studio,it says

Build command failed.
Error while executing process F:\androidSDK\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C E:\androidworkspace\MyApplication4\app\.cxx\cmake\debug\arm64-v8a native-lib}
ninja: Entering directory `E:\androidworkspace\MyApplication4\app\.cxx\cmake\debug\arm64-v8a'
[1/1] Linking CXX shared library E:\androidworkspace\MyApplication4\app\build\intermediates\cmake\debug\obj\arm64-v8a\libnative-lib.so
FAILED: E:/androidworkspace/MyApplication4/app/build/intermediates/cmake/debug/obj/arm64-v8a/libnative-lib.so 
cmd.exe /C "cd . && F:\androidSDK\ndk\21.1.6352462\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android28 --gcc-toolchain=F:/androidSDK/ndk/21.1.6352462/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=F:/androidSDK/ndk/21.1.6352462/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libnative-lib.so -o E:\androidworkspace\MyApplication4\app\build\intermediates\cmake\debug\obj\arm64-v8a\libnative-lib.so CMakeFiles/native-lib.dir/native-lib.cpp.o  -llog E:/androidworkspace/MyApplication4/app/src/main/cpp/3rdparty/arm64-v8a/libboost_system-clang-mt-x64-1_68.so -latomic -lm && cd ."
E:/androidworkspace/MyApplication4/app/src/main/cpp/3rdparty/arm64-v8a/libboost_system-clang-mt-x64-1_68.so: error adding symbols: File in wrong format
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

Ruffletuft avatar Dec 09 '20 11:12 Ruffletuft

@Ruffletuft I have the same problem, did you fix this problem?

zhulove86 avatar Apr 11 '22 03:04 zhulove86