GithubHelp home page GithubHelp logo

Comments (25)

DoDoENT avatar DoDoENT commented on July 27, 2024 3

I've managed to workaround this problem by creating symlink named llvm-3.8 that points to llvm folder and from r10e I've copied folders aarch64-linux-android-clang3.5 and others, renamed them to have suffix clang3.8 and modified their setup.mk to contain only following line:

TOOLCHAIN_VERSION := 4.9

After this I was able to set ANDROID_TOOLCHAIN_NAME variable to aarch64-linux-android-clang3.8 and so on. This worked for me - I was compiling OpenCV 3.0 with clang and libc++ using NDK r11b.

from android-cmake.

chenxiaolong avatar chenxiaolong commented on July 27, 2024 1

@osfans You might have to remove the build directory and then rerun CMake. The toolchain file can't seem to change the compiler after the build has already been configured.

from android-cmake.

osfans avatar osfans commented on July 27, 2024 1

@chenxiaolong It works. Thanks! I include your fork of android-cmake in trime.

from android-cmake.

adytzs avatar adytzs commented on July 27, 2024 1

@chenxiaolong , I am a newbie in cmake, Can you explain how to "remove the build directory". I got this error

arm-linux-androideabi-gcc: error: armv7-none-linux-androideabi: No such file or directory
arm-linux-androideabi-gcc: error: unrecognized command line option '-target'
arm-linux-androideabi-gcc: error: unrecognized command line option '-fno-integrated-as'
arm-linux-androideabi-gcc: error: unrecognized command line option '-fno-limit-debug-info'

Thanks

from android-cmake.

chenxiaolong avatar chenxiaolong commented on July 27, 2024

chenxiaolong@6d8525b#commitcomment-16919805 :)

Just pass -DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang3.6 or the equivalent toolchain for other ABIs.

from android-cmake.

osfans avatar osfans commented on July 27, 2024

@chenxiaolong

-DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang3.6 has errors:

arm-linux-androideabi-g++: error: armv5te-none-linux-androideabi: No such file or directory
arm-linux-androideabi-g++: error: unrecognized command line option '-target'
arm-linux-androideabi-g++: error: unrecognized command line option '-Qunused-arguments'
arm-linux-androideabi-g++: error: unrecognized command line option '-Xclang'
arm-linux-androideabi-g++: error: unrecognized command line option '-mnoexecstack'

from android-cmake.

osfans avatar osfans commented on July 27, 2024

@chenxiaolong it works! Thanks!

When -DANDROID_STL=c++_static, there's error:

/usr/local/google/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-5996/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/src/cxa_handlers.cpp:112: error: undefined reference to '__atomic_exchange_4'
/usr/local/google/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-5996/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/src/cxa_default_handlers.cpp:106: error: undefined reference to '__atomic_exchange_4'
/usr/local/google/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-5996/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/src/cxa_default_handlers.cpp:117: error: undefined reference to '__atomic_exchange_4'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

ndk-build has no error when link c++_static.

from android-cmake.

chenxiaolong avatar chenxiaolong commented on July 27, 2024

@osfans You're welcome!

Do you have a simple test case that causes the error? I created a simple project and cannot reproduce it: https://github.com/chenxiaolong/ndk_cmake_test I tried armeabi, armeabi-v7a, arm64-v8a, x86, and x86_64 (See test.sh)

from android-cmake.

osfans avatar osfans commented on July 27, 2024

@chenxiaolong I create a PR in your repo. It seems I need pass LOCAL_LDLIBS := -latomic somewhere to android-cmake.

from android-cmake.

chenxiaolong avatar chenxiaolong commented on July 27, 2024

@osfans It looks like that's because CMake is linking the static library in the wrong order. CMake is passing the -latomic parameter before the /opt/android-ndk/.../libc++_static.a parameter to clang++.

This should fix the issue: https://gist.github.com/chenxiaolong/eae919138c5e56b16955d72eaa37041e
I was able to build trime successfully :) https://gist.github.com/chenxiaolong/0df1a2c976dc634ddbe19bcac4624ad3

from android-cmake.

osfans avatar osfans commented on July 27, 2024

@chenxiaolong I git pull your r12 commit. I can't make trime with r12 again.
And ndk-build works.

        -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang \
        -DANDROID_ABI=armeabi \
        -DANDROID_STL=c++_static \
        -DANDROID_NATIVE_API_LEVEL=9

It seems that I cannot choose clang.

from android-cmake.

rcdailey avatar rcdailey commented on July 27, 2024

Looks like r12 restructured things again. Why is google doing this nonsense?

from android-cmake.

rpavlik avatar rpavlik commented on July 27, 2024

I have at least a parser for the release property file in the OSVR fork of this repo

from android-cmake.

chenxiaolong avatar chenxiaolong commented on July 27, 2024

@osfans I made one more change related to libc++. I am able to successfully build trime now with:

        -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang \

Commit: chenxiaolong@2522915

from android-cmake.

osfans avatar osfans commented on July 27, 2024

@chenxiaolong Thanks. It works.

from android-cmake.

rcdailey avatar rcdailey commented on July 27, 2024

@chenxiaolong I really appreciate your efforts in maintaining the android cmake scripts. The unfortunate issue I see is that we have a lot of smart people investing their free time maintaining these scripts, but they all do it in isolation and the same set of issues have been fixed over and over, but in different ways.

I think it's worth it to start getting people onto 1 repository and pooling fixes together. Would it be unreasonable to pool your efforts into @rpavlik's fork?

from android-cmake.

osfans avatar osfans commented on July 27, 2024

Where's rpavlik's fork? I can't find it.

from android-cmake.

rpavlik avatar rpavlik commented on July 27, 2024

The most updated, though not tidiest, branch is here: https://github.com/OSVR/android-cmake/tree/libcxx (under dev, so I haven't pulled things out into pull-requestable-branches yet). I tried to incorporate all the pull requests that I could find that made sense, plus additional changes as needed.

I actually started working in parallel on a more minimal, modern, semi-from-scratch toolchain file that works with, rather than against, current CMake practices, in alt.android.toolchain.cmake in the same directory - it contains some pieces based on the original here (or the modifications I've made to it) but it's simpler and hopefully less fragile. It's incomplete, though enough to build one sample library (jsoncpp) against the NDK r12.

Note also that the folks behind the CrystaX NDK forked some version of this toolchain script and made their own changes - https://github.com/crystax/android-platform-ndk/blob/master/cmake/toolchain.cmake - which I haven't fully ported over into my fork, and vice versa (there are changes that I've incorporated that they don't have). Ideally, I think, that would be the way to go: instead of having to do so much detection/guessing, have the toolchain description be shipped with the NDK, but it appears that might be a dream unless you can use (a currently unreleased version of) the CrystaX NDK.

from android-cmake.

DoDoENT avatar DoDoENT commented on July 27, 2024

A colleague of mine created his own android toolchain specifically designed for r11. You can try it our here

from android-cmake.

osfans avatar osfans commented on July 27, 2024

@chenxiaolong r13 is out in Archlinux, and trime build breaks again. Will you support it?

trime/jni/OpenCC/src/Common.hpp:26:10: fatal error: 
      'algorithm' file not found
#include <algorithm>
         ^
1 error generated.

from android-cmake.

rcdailey avatar rcdailey commented on July 27, 2024

r13 comes with its own toolchain file. No need to use this anymore.

On Sun, Oct 9, 2016, 8:37 PM osfans [email protected] wrote:

@chenxiaolong https://github.com/chenxiaolong r13 is out and build
breaks again. Will you support it?

trime/jni/OpenCC/src/Common.hpp:26:10: fatal error:
'algorithm' file not found
#include
^
1 error generated.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#81 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABr6dmsLHG-zrWeY07vp8YDTGH0KTNfBks5qyZbJgaJpZM4HvGH0
.

from android-cmake.

osfans avatar osfans commented on July 27, 2024

Yes, it works!
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake

from android-cmake.

osfans avatar osfans commented on July 27, 2024

@rcdailey
I have to -DLIBRARY_OUTPUT_PATH=../libs/armeabi/ to install jni libs.
Any other solutions?

from android-cmake.

rcdailey avatar rcdailey commented on July 27, 2024

I use a custom command in cmake to copy my binary to that directory so ant
can find it.

On Tue, Oct 11, 2016, 12:04 AM osfans [email protected] wrote:

@rcdailey https://github.com/rcdailey
I have to -DLIBRARY_OUTPUT_PATH=../libs/armeabi/ to install jni libs.
Any other solutions?


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#81 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABr6dvO6scUzGp2GFeJmO1PwnrIjknKoks5qyxjkgaJpZM4HvGH0
.

from android-cmake.

wo4li2wang avatar wo4li2wang commented on July 27, 2024

@chenxiaolong It works ,3Q

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.