Closed mclbn closed 8 years ago
Just found what I was doing wrong. I was overwriting ${CMAKE_CXX_FLAGS}
instead of appending to it, losing --sysroot=...
and other valuable flags.
Sorry for the spam. I hope this will help another beginner making the same mistakes :-)
I'm getting a linking error when building a cmake project for android using these scripts. The project consists in a static library and a binary, linked to it. Here is the structure of my project :
My ./CMakeLists.txt looks like this ;
My ./androidproject/src/CMakeLists.txt looks like this :
I build my project :
The project builds and links without problem natively (i.e. using the host system's clang for x86_64). I also tried with another ANDROID_TOOLCHAIN_NAME (arm gcc) without success.
From what I understand, it is the system linker (
/usr/bin/ld
) that is called at the end. Should not it be the toolchain's linker (/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld
) ?When I print the value of
${CMAKE_LINKER}
, i get the right value (/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld
), in both the rootCMakeLists.txt
andandroid_project/src/CMakeLists.txt
.Since my project is rather small and its architecture quite classic, there might be something I am doing something wrong. But I cannot figure what.
Anyone got pointers or suggestions regarding this error ?