GithubHelp home page GithubHelp logo

Comments (13)

chromaticbum avatar chromaticbum commented on July 27, 2024 1

Make sure to specify -target armv7-none-linux-androideabi
If you are manually invoking clang.

from android-cmake.

shaders avatar shaders commented on July 27, 2024

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.

taka-no-me avatar taka-no-me commented on July 27, 2024

@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.

dreamzor avatar dreamzor commented on July 27, 2024

Hi! I've got the same error with clang 3.3 and your toolchain :(

from android-cmake.

chromaticbum avatar chromaticbum commented on July 27, 2024

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.

chromaticbum avatar chromaticbum commented on July 27, 2024

Or as taka suggested, add -DCMAKE_BUILD_TYPE=Release|Debug and this will set the triplet as well

from android-cmake.

dreamzor avatar dreamzor commented on July 27, 2024

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.

chromaticbum avatar chromaticbum commented on July 27, 2024

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.

dreamzor avatar dreamzor commented on July 27, 2024

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.

dreamzor avatar dreamzor commented on July 27, 2024

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.

chromaticbum avatar chromaticbum commented on July 27, 2024

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.

dreamzor avatar dreamzor commented on July 27, 2024

Ok, I'll take a look at that, thanks a lot!

from android-cmake.

taka-no-me avatar taka-no-me commented on July 27, 2024

This problem should be gone with the latest update.

from android-cmake.

Related Issues (20)

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.