Comments (13)
Make sure to specify -target armv7-none-linux-androideabi
If you are manually invoking clang.
from android-cmake.
I have clang selected by default:
/Users/User/android-ndk-r8e/toolchains/llvm-3.1/prebuilt/darwin-x86/bin/clang -fexceptions -Wno-psabi --sysroot=/Users/User/android-ndk-r8e/platforms/android-8/arch-arm -fpic -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fdata-sections -ffunction-sections -Wa,--noexecstack -isystem /Users/User/android-ndk-r8e/platforms/android-8/arch-arm/usr/include -isystem /Users/User/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/include -isystem /Users/User/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include -o CMakeFiles/libzip.dir/lib/mkstemp.c.o -c mkstemp.c
from android-cmake.
@shaders, thanks for the report!
At the moment toolchain requires CMAKE_BUILD_TYPE
to be set to Release
or Debug
for the clang compiler.
from android-cmake.
Hi! I've got the same error with clang 3.3 and your toolchain :(
from android-cmake.
The compiler needs a triplet, and there is code in there to set the triplet to get the proper CPU. Take a look at android.toolchain.cmake and look for the section where it talks about the ANDROID_ABI variable. You need to set this when you are running cmake. For example: "cmake -DCMAKE_TOOLCHAIN_FILE=$ANDTOOLCHAIN -DANDROID_TOOLCHAIN_NAME=$ANDROID_TOOLCHAIN_NAME -DANDROID_ABI=armeabi-v7a .." Here is a link: https://github.com/taka-no-me/android-cmake/blob/5db45cfb87fec180b74963d3680dd60d4d8d8c3a/android.toolchain.cmake#l74-91
from android-cmake.
Or as taka suggested, add -DCMAKE_BUILD_TYPE=Release|Debug and this will set the triplet as well
from android-cmake.
Thanks, but I already tried that... here's the complete list of relevant cmake options:
-DANDROID_ABI="armeabi-v7a with NEON"
-DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang3.3
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_DIR}/android.toolchain.cmake
-DCMAKE_BUILD_TYPE=Release
I ended up compiling a standalone toolchain which worked (yay!) with this cmake toolchain (using make_standalone_toolchain.sh
at android-ndk/build/tools
, but it certainly would be so much better if 'out of the box' solution would work.
That's the clang instance being called:
android-ndk/toolchains/llvm-3.3/prebuilt/darwin-x86/bin/clang
Maybe it's not suitable for armeabi-v7a with NEON
somehow?
from android-cmake.
This worked for me:
export ANDTOOLCHAIN=/Users/hollin/ndk.workspace/android-cmake/android.toolchain.cmake
export ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang3.3
export ANDROID_NDK=~/Lib/Android/ndk # this is r9c
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDTOOLCHAIN -DANDROID_TOOLCHAIN_NAME=$ANDROID_TOOLCHAIN_NAME -DANDROID_ABI="armeabi-v7a with NEON" -DCMAKE_BUILD_TYPE=Release ..
from android-cmake.
Thanks! That's weird, it looks exactly the same..
Do you have the same clang instance being called? (make VERBOSE=1
will tell) Because when I'm trying to manually compile a int main() { return 0; }
program with -march=armv7-a
flag using that clang executable, it shows me the same 'unknown target cpu' error.
from android-cmake.
Calling clang from this folder
android-ndk/toolchains/llvm-3.3/prebuilt/darwin-x86/bin
With these parameters
./clang++ -target armv7-none-linux-androideabi -march=armv7-a code.cpp
I'm getting this...
FATAL:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../libexec/as/x86_64/as: I don't understand 'm' flag! clang: error: assembler command failed with exit code 1 (use -v to see invocation)
I feel that something is really wrong..
from android-cmake.
This is getting a bit off topic. But you would learn a lot by running ndk-build V=1 on one of the sample projects. You will see all of the options that need to be passed in. Of particular importance are compiling with -fPIC and using the proper gcc toolchain. Pretty much just look at the output of ndk-build and see what it's doing then adapt to your files.
from android-cmake.
Ok, I'll take a look at that, thanks a lot!
from android-cmake.
This problem should be gone with the latest update.
from android-cmake.
Related Issues (20)
- how to build dynamic libs of OpenCV under android system
- Add support for NDK r16b HOT 6
- How to complie to a library.so file ?
- adept to new ndk releases HOT 4
- CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. HOT 3
- how to generate executable file
- -fsigned-char breaks binary compatibility on ARM HOT 1
- Update for libc++
- Add support for C++11 HOT 1
- Problem building with Crystax 10.1.0 and add-rendermanager branch HOT 2
- NDK r11 does not work due to toolchain restructure HOT 25
- CLANG prefered over GCC as of r11b
- LIBRARY_OUTPUT_PATH is too oldschool way of doing things
- how to compile source for android using CMake HOT 1
- Add support for NDK r12 HOT 2
- cmake 3.6.0 not compatible with android-cmake with Ninja on Windows HOT 4
- *find_path* and *find_library* doesn't seem to work HOT 2
- A missing sysroot in ANDROID_LINKER_FLAGS
- how to load(render) 3d models .ply files from urls in my android app using this library?
- ndk r10e, ANROID_ABI=arm64-v8a HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-cmake.