I try to compile a shared library on Ubuntu using CMake for Android
my "toolchain.cmake" file :
set (CMAKE_SYSTEM_NAME Android)
set (CMAKE_SYSTEM_VERSION 26)
set (CMAKE_ANDROID_ARCH_ABI armeabi-v7a)
set (CMAKE_ANDROID_NDK "/home/user/android-ndk-r23b")
set (CMAKE_ANDROID_STL_TYPE c++_shared)
but I have this message error :
Android: The API specified by CMAKE_SYSTEM_VERSION='26' does not exist in the NDK. The directory: /home/user/android-ndk-r23b/platforms/android-26 does not exist.
Thanks
According to your error message it seems that the path /home/user/android-ndk-r23b/platforms/android-26 does not exist. You can download the NDK from here https://developer.android.com/ndk/downloads and create and validate the path /home/user/android-ndk-r23b/platforms/android-26 from hand.
Related
I am trying to compile boost for android (x86 for the moment) using clang that is provided with the VS2015 Mobile Development Tools. So far I have not been able to compile boost with clang at all, even for native. Here is the project-config.jam that I am using for the x86 android build:
using clang : androidr10e :
C:/ProgramData/Microsoft/AndroidNDK/android-ndk-r10e/toolchains/llvm-3.6/prebuilt/windows/bin/clang++ :
<compileflags>--sysroot=C:/ProgramData/Microsoft/AndroidNDK/android-ndk-r10e/platforms/android-19/arch-x86
<compileflags>-fno-strict-aliasing
<compileflags>-fomit-frame-pointer
<compileflags>-O2
<compileflags>-D__ANDROID__
<compileflags>-DNDEBUG
<compileflags>-g
<compileflags>-lstdc++
<compileflags>-IC:/ProgramData/Microsoft/AndroidNDK/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include
<compileflags>-IC:/ProgramData/Microsoft/AndroidNDK/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libs/x86_64
<compileflags>-D__GLIBC__
<compileflags>-DBOOST_NO_INTRINSIC_WCHAR_T
;
and executing b2 with:
b2 toolset=clang-androidr10e target-os=android cxxflags="-std=c++11" linkflags="-stdlib=libc++" threading=multi threadapi=pthread link=shared runtime-link=shared --prefix=C:\projects\3rdparty\boost_1_59_0_x86android
This gives the following errors
In file included from libs\atomic\src\lockpool.cpp:16:
In file included from .\boost/config.hpp:57:
In file included from .\boost/config/platform/linux.hpp:15:
C:/ProgramData/Microsoft/AndroidNDK/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include\cstdlib:111:9: error: no member named 'strtold' in the global namespace
using ::strtold;
~~^
C:/ProgramData/Microsoft/AndroidNDK/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include\cstdlib:129:9: error: no member named '_Exit' in the global namespace
using ::_Exit;
~~^
etc...
In file included from libs\system\src\error_code.cpp:16:
In file included from .\boost/system/error_code.hpp:14:
In file included from .\boost/system/config.hpp:14:
In file included from .\boost/predef/platform.h:14:
.\boost/predef/platform/mingw.h:34:13: fatal error: '_mingw.h' file not found
# include <_mingw.h>
^
3 errors generated.
Any help would be appreciated.
I am facing the following issue when trying to compile a c program using openssl for android x-86. I set up the environment variables as follows using the following script:
setenv-android.sh
After running the script I have the following environment.
./setenv-android_x86.sh
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
Error: FIPS_SIG does not specify incore module. Please edit this script.
ANDROID_NDK_ROOT: /opt/android-ndk-r9d-x86
ANDROID_ARCH: arch-x86
ANDROID_EABI: x86-4.6
ANDROID_API: android-18
ANDROID_SYSROOT: /opt/android-ndk-r9d-x86/platforms/android-18/arch-x86
ANDROID_TOOLCHAIN: /opt/android-ndk-r9d-x86/toolchains/x86-4.6/prebuilt/darwin-x86_64/bin
FIPS_SIG:
CROSS_COMPILE: i686-linux-android-
ANDROID_DEV: /opt/android-ndk-r9d-x86/platforms/android-18/arch-x86/usr
However when trying to compile with the following command I get the following error:
pwd
/opt/android-ndk-r9d-x86/bin
./i686-linux-android-gcc Test.c -o test -lcrypto
fatal error: openssl/conf.h: No such file or directory
When I locate for the openssl/conf.h I see the file is available in many places:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/openssl/conf.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/openssl/conf.h
/data/local/arm/ssl/include/openssl/conf.h
/data/local/ssl/include/openssl/conf.h
/openssl/include/openssl/conf.h
/openssl-1.0.1e/include/openssl/conf.h
/openssl-1.0.1g/include/openssl/conf.h
/opt/local/include/openssl/conf.h
/usr/include/openssl/conf.h
/usr/local/include/openssl/conf.h
/usr/local/ssl/android-14/include/openssl/conf.h
/usr/local/ssl/android-18/include/openssl/conf.h
/usr/local/ssl/android-18-x86/include/openssl/conf.h
/usr/local/ssl/include/openssl/conf.h
I think the proper path is this:
/usr/local/ssl/android-18-x86/include/openssl/conf.h
I tried with the -L option but with no luck.
-L/usr/local/ssl/android-18-x86/include/
Can anybody please explain how to setup the path properly to solve this issue. (finally there is no issue with the C code as it compiles properly with gcc)
You are compiling your code using the Android NDK, which creates a "virtual" compiling environment by placing everything you need to compile for android into the ${ANDROID_SYSROOT} directory.
Those directories you listed are outside that sysroot, and therefore are not available to the build system, hence the errors. You must install OpenSSL for Android and putting the resulting headers and binaries there. You might follow this guide to assist you in that.
I want to compile pref for android device and i did that base on the guide the guide. One i set NDK environment use Android NDK r9
export NDK_TOOLCHAIN=${NDK}/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
export NDK_SYSROOT=${NDK}/platforms/android-9/arch-arm
I run make with tool
make ARCH=arm CROSS_COMPILE=${NDK_TOOLCHAIN} CFLAGS="--sysroot=${NDK_SYSROOT}"
I recieve the error, so can you help me?
Android NDK: NDK_TOOLCHAIN is defined to the unsupported value android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
Android NDK: Please use one of the following values: arm-linux-androideabi-4.6 arm-linux-androideabi-4.8 arm-linux-androideabi-clang3.2 arm-linux-androideabi-clang3.3 mipsel-linux-android-4.6 mipsel-linux-android-4.8 mipsel-linux-android-clang3.2 mipsel-linux-android-clang3.3 x86-4.6 x86-4.8 x86-clang3.2 x86-clang3.3
build/core/init.mk:555: * Android NDK: Aborting . Stop.
Android bundles the simpleperf tool which is almost a drop-in replacement for many usages of perf/linux-tool-perf.
https://developer.android.com/ndk/guides/simpleperf
Have you looked at external/linux-tools-perf/ inside android repository?
https://android.googlesource.com/platform/external/linux-tools-perf/
the error clearly says , you need select appropriate value while exporting ,
export NDK_TOOLCHAIN=${NDK}/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
should be
export NDK_TOOLCHAIN=${NDK}/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-4.6
If it dosen't work , i recommend you recheck the overall path which $NDK_TOOLCHAIN contains.
Thanks , Jain
I m trying to build old c code with android standalone tool chain and it keeps failing on
following error :
fatal error: ftw.h: No such file or directory
Not sure how to include these headers from android.
Thanks,
ftw.h is included in android-21 platform (ndk 10c):
MBA-Anton:android-ndk-r10c asmirnov$ find /softdev/android-ndk-r10c -name "ftw.h"
/softdev/android-ndk-r10c/platforms/android-21/arch-arm/usr/include/ftw.h
/softdev/android-ndk-r10c/platforms/android-21/arch-arm64/usr/include/ftw.h
/softdev/android-ndk-r10c/platforms/android-21/arch-mips/usr/include/ftw.h
/softdev/android-ndk-r10c/platforms/android-21/arch-mips64/usr/include/ftw.h
/softdev/android-ndk-r10c/platforms/android-21/arch-x86/usr/include/ftw.h
/softdev/android-ndk-r10c/platforms/android-21/arch-x86_64/usr/include/ftw.h
This was an old message, but as I am on a similar ftw-hunt today: as of my writing this, ftw.h does not exist in contemporary android ndk include dirs.
Here are external links to source code for ftw* which may be useful:
http://www.opensource.apple.com/source/ksh/ksh-4/ksh/src/lib/libast/comp/ftw.c
http://www.opensource.apple.com/source/ksh/ksh-4/ksh/src/lib/libast/comp/ftw.h
Also, ftwalk.c is located as above but libast/misc/ftwalk.c (stackoverflow will not let me post a third link cause I'm a newb).
I have to edit a project using some C++ stuff (commons-codec-1.4) to read a SVG file. If I comment out the SVG reference it works fine but I have to run with it. It originally compiled with NDK. I downloaded NDK but don't know how to attach with this project.
build.log file in jni folder says
Android NDK: WARNING: Unsupported source file extensions in /cygdrive/c/work/Android/Source/yprintit-android/jni/Android.mk for module svgandroid
Android NDK: libpng/png.h libpng/pngconf.h libpng/pngpriv.h libsvg/svg.h libsvg/svgint.h libsvg/svg_ascii.h libsvg/svg_version.h libsvg/svg_hash.h libsvg-android/svg-android.h libsvg-android/svg-android-internal.h
Compile thumb : svgandroid <= /cygdrive/c/work/Android/Source/yprintit-android/jni/datauri/base64.c
SharedLibrary : libsvgandroid.so
Install : libsvgandroid.so => /cygdrive/c/work/Android/Source/yprintit-android/libs/armeabi