CMake configure for Android fails
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'm trying to compile a dynamic library for Android. I use CMake-gui on Windows to do it. I successfully built the library (TagLib) a few years ago. But now the toolchain doesn't work anymore.
If I try to point the android.toolchain.cmake script to NDK R18, it fails with this error message:
Android: Targeting API '22' with architecture 'arm', ABI 'armeabi-v7a', and processor 'armv7-a'
CMake Error at C:/app/cmake/share/cmake-3.12/Modules/Platform/Android/Determine-Compiler-NDK.cmake:97 (message):
Android: No toolchain for ABI 'armeabi-v7a' found in the NDK:
I think it might be related to the fact that Android NDK now switched from GCC to Clang. So I tried an older NDK R16b. Now it gets a little bit further but still fails now with this error message:
CMake Error at C:/app/cmake/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message): The C compiler
"c:/app/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp
Run Build Command:"C:/Qt/Tools/mingw530_32/bin/mingw32-make.exe" "cmTC_9e009/fast"
C:/Qt/Tools/mingw530_32/bin/mingw32-make.exe -f CMakeFilescmTC_9e009.dirbuild.make CMakeFiles/cmTC_9e009.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o
c:appandroid-ndk-r16btoolchainsarm-linux-androideabi-4.9prebuiltwindows-x86_64binarm-linux-androideabi-gcc.exe
-target armv7-none-linux-androideabi --sysroot=C:/app/android-ndk-r16b/platforms/android-22/arch-arm -isystem C:appandroid-ndk-r16bplatformsandroid-22arch-armusrinclude
-isystem C:appandroid-ndk-r16bplatformsandroid-22arch-armusrincludearm-linux-androideabi
-g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIE -o CMakeFilescmTC_9e009.dirtestCCompiler.c.o -c C:MojeQtProjectstaglib_buildCMakeFilesCMakeTmptestCCompiler.c
arm-linux-androideabi-gcc.exe: error: armv7-none-linux-androideabi: No such file or directory
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-target'
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-fno-integrated-as'
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-fno-limit-debug-info'
CMakeFilescmTC_9e009.dirbuild.make:64: recipe for target 'CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp'
Makefile:120: recipe for target 'cmTC_9e009/fast' failed
mingw32-make.exe: *** [cmTC_9e009/fast] Error 2
I don't understand what is wrong with the test command and why it fails. Do you have any idea?
And after all is my approach to build a dynamic Android library correct or are there better ways to do it? I don't use Android Studio, I develop my application in QtCreator.
add a comment |
I'm trying to compile a dynamic library for Android. I use CMake-gui on Windows to do it. I successfully built the library (TagLib) a few years ago. But now the toolchain doesn't work anymore.
If I try to point the android.toolchain.cmake script to NDK R18, it fails with this error message:
Android: Targeting API '22' with architecture 'arm', ABI 'armeabi-v7a', and processor 'armv7-a'
CMake Error at C:/app/cmake/share/cmake-3.12/Modules/Platform/Android/Determine-Compiler-NDK.cmake:97 (message):
Android: No toolchain for ABI 'armeabi-v7a' found in the NDK:
I think it might be related to the fact that Android NDK now switched from GCC to Clang. So I tried an older NDK R16b. Now it gets a little bit further but still fails now with this error message:
CMake Error at C:/app/cmake/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message): The C compiler
"c:/app/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp
Run Build Command:"C:/Qt/Tools/mingw530_32/bin/mingw32-make.exe" "cmTC_9e009/fast"
C:/Qt/Tools/mingw530_32/bin/mingw32-make.exe -f CMakeFilescmTC_9e009.dirbuild.make CMakeFiles/cmTC_9e009.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o
c:appandroid-ndk-r16btoolchainsarm-linux-androideabi-4.9prebuiltwindows-x86_64binarm-linux-androideabi-gcc.exe
-target armv7-none-linux-androideabi --sysroot=C:/app/android-ndk-r16b/platforms/android-22/arch-arm -isystem C:appandroid-ndk-r16bplatformsandroid-22arch-armusrinclude
-isystem C:appandroid-ndk-r16bplatformsandroid-22arch-armusrincludearm-linux-androideabi
-g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIE -o CMakeFilescmTC_9e009.dirtestCCompiler.c.o -c C:MojeQtProjectstaglib_buildCMakeFilesCMakeTmptestCCompiler.c
arm-linux-androideabi-gcc.exe: error: armv7-none-linux-androideabi: No such file or directory
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-target'
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-fno-integrated-as'
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-fno-limit-debug-info'
CMakeFilescmTC_9e009.dirbuild.make:64: recipe for target 'CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp'
Makefile:120: recipe for target 'cmTC_9e009/fast' failed
mingw32-make.exe: *** [cmTC_9e009/fast] Error 2
I don't understand what is wrong with the test command and why it fails. Do you have any idea?
And after all is my approach to build a dynamic Android library correct or are there better ways to do it? I don't use Android Studio, I develop my application in QtCreator.
Please, format build logs as a code (Ctrl+Kor{}button), not as a blockquote. The latter formatting doesn't preserve newlines; it is very difficult to read such logs.
– Tsyvarev
Nov 22 '18 at 12:21
add a comment |
I'm trying to compile a dynamic library for Android. I use CMake-gui on Windows to do it. I successfully built the library (TagLib) a few years ago. But now the toolchain doesn't work anymore.
If I try to point the android.toolchain.cmake script to NDK R18, it fails with this error message:
Android: Targeting API '22' with architecture 'arm', ABI 'armeabi-v7a', and processor 'armv7-a'
CMake Error at C:/app/cmake/share/cmake-3.12/Modules/Platform/Android/Determine-Compiler-NDK.cmake:97 (message):
Android: No toolchain for ABI 'armeabi-v7a' found in the NDK:
I think it might be related to the fact that Android NDK now switched from GCC to Clang. So I tried an older NDK R16b. Now it gets a little bit further but still fails now with this error message:
CMake Error at C:/app/cmake/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message): The C compiler
"c:/app/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp
Run Build Command:"C:/Qt/Tools/mingw530_32/bin/mingw32-make.exe" "cmTC_9e009/fast"
C:/Qt/Tools/mingw530_32/bin/mingw32-make.exe -f CMakeFilescmTC_9e009.dirbuild.make CMakeFiles/cmTC_9e009.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o
c:appandroid-ndk-r16btoolchainsarm-linux-androideabi-4.9prebuiltwindows-x86_64binarm-linux-androideabi-gcc.exe
-target armv7-none-linux-androideabi --sysroot=C:/app/android-ndk-r16b/platforms/android-22/arch-arm -isystem C:appandroid-ndk-r16bplatformsandroid-22arch-armusrinclude
-isystem C:appandroid-ndk-r16bplatformsandroid-22arch-armusrincludearm-linux-androideabi
-g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIE -o CMakeFilescmTC_9e009.dirtestCCompiler.c.o -c C:MojeQtProjectstaglib_buildCMakeFilesCMakeTmptestCCompiler.c
arm-linux-androideabi-gcc.exe: error: armv7-none-linux-androideabi: No such file or directory
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-target'
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-fno-integrated-as'
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-fno-limit-debug-info'
CMakeFilescmTC_9e009.dirbuild.make:64: recipe for target 'CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp'
Makefile:120: recipe for target 'cmTC_9e009/fast' failed
mingw32-make.exe: *** [cmTC_9e009/fast] Error 2
I don't understand what is wrong with the test command and why it fails. Do you have any idea?
And after all is my approach to build a dynamic Android library correct or are there better ways to do it? I don't use Android Studio, I develop my application in QtCreator.
I'm trying to compile a dynamic library for Android. I use CMake-gui on Windows to do it. I successfully built the library (TagLib) a few years ago. But now the toolchain doesn't work anymore.
If I try to point the android.toolchain.cmake script to NDK R18, it fails with this error message:
Android: Targeting API '22' with architecture 'arm', ABI 'armeabi-v7a', and processor 'armv7-a'
CMake Error at C:/app/cmake/share/cmake-3.12/Modules/Platform/Android/Determine-Compiler-NDK.cmake:97 (message):
Android: No toolchain for ABI 'armeabi-v7a' found in the NDK:
I think it might be related to the fact that Android NDK now switched from GCC to Clang. So I tried an older NDK R16b. Now it gets a little bit further but still fails now with this error message:
CMake Error at C:/app/cmake/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message): The C compiler
"c:/app/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp
Run Build Command:"C:/Qt/Tools/mingw530_32/bin/mingw32-make.exe" "cmTC_9e009/fast"
C:/Qt/Tools/mingw530_32/bin/mingw32-make.exe -f CMakeFilescmTC_9e009.dirbuild.make CMakeFiles/cmTC_9e009.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o
c:appandroid-ndk-r16btoolchainsarm-linux-androideabi-4.9prebuiltwindows-x86_64binarm-linux-androideabi-gcc.exe
-target armv7-none-linux-androideabi --sysroot=C:/app/android-ndk-r16b/platforms/android-22/arch-arm -isystem C:appandroid-ndk-r16bplatformsandroid-22arch-armusrinclude
-isystem C:appandroid-ndk-r16bplatformsandroid-22arch-armusrincludearm-linux-androideabi
-g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIE -o CMakeFilescmTC_9e009.dirtestCCompiler.c.o -c C:MojeQtProjectstaglib_buildCMakeFilesCMakeTmptestCCompiler.c
arm-linux-androideabi-gcc.exe: error: armv7-none-linux-androideabi: No such file or directory
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-target'
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-fno-integrated-as'
arm-linux-androideabi-gcc.exe: error: unrecognized command line option '-fno-limit-debug-info'
CMakeFilescmTC_9e009.dirbuild.make:64: recipe for target 'CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_9e009.dir/testCCompiler.c.o] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Moje/QtProjects/taglib_build/CMakeFiles/CMakeTmp'
Makefile:120: recipe for target 'cmTC_9e009/fast' failed
mingw32-make.exe: *** [cmTC_9e009/fast] Error 2
I don't understand what is wrong with the test command and why it fails. Do you have any idea?
And after all is my approach to build a dynamic Android library correct or are there better ways to do it? I don't use Android Studio, I develop my application in QtCreator.
edited Nov 22 '18 at 15:39
JeCh
asked Nov 22 '18 at 11:44
JeChJeCh
335138
335138
Please, format build logs as a code (Ctrl+Kor{}button), not as a blockquote. The latter formatting doesn't preserve newlines; it is very difficult to read such logs.
– Tsyvarev
Nov 22 '18 at 12:21
add a comment |
Please, format build logs as a code (Ctrl+Kor{}button), not as a blockquote. The latter formatting doesn't preserve newlines; it is very difficult to read such logs.
– Tsyvarev
Nov 22 '18 at 12:21
Please, format build logs as a code (
Ctrl+K or {} button), not as a blockquote. The latter formatting doesn't preserve newlines; it is very difficult to read such logs.– Tsyvarev
Nov 22 '18 at 12:21
Please, format build logs as a code (
Ctrl+K or {} button), not as a blockquote. The latter formatting doesn't preserve newlines; it is very difficult to read such logs.– Tsyvarev
Nov 22 '18 at 12:21
add a comment |
1 Answer
1
active
oldest
votes
My issue was almost the same when I tried to build an Android .apk on my macOS with a console command. Whereas Visual Studio GUI builds ok, the msbuild makes an error:
error XA5101: C compiler for target Arm was not found.
It's discussed on Xamarin forum here.
The work-around found here and worked for me is to switch off BundleAssemblies parameter in Android.csproj:
<BundleAssemblies>False</BundleAssemblies>
Also my solutions with wrong NDK and toolchain paths were founded here. I installed the latest versions of Android SDK and NDK.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430291%2fcmake-configure-for-android-fails%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
My issue was almost the same when I tried to build an Android .apk on my macOS with a console command. Whereas Visual Studio GUI builds ok, the msbuild makes an error:
error XA5101: C compiler for target Arm was not found.
It's discussed on Xamarin forum here.
The work-around found here and worked for me is to switch off BundleAssemblies parameter in Android.csproj:
<BundleAssemblies>False</BundleAssemblies>
Also my solutions with wrong NDK and toolchain paths were founded here. I installed the latest versions of Android SDK and NDK.
add a comment |
My issue was almost the same when I tried to build an Android .apk on my macOS with a console command. Whereas Visual Studio GUI builds ok, the msbuild makes an error:
error XA5101: C compiler for target Arm was not found.
It's discussed on Xamarin forum here.
The work-around found here and worked for me is to switch off BundleAssemblies parameter in Android.csproj:
<BundleAssemblies>False</BundleAssemblies>
Also my solutions with wrong NDK and toolchain paths were founded here. I installed the latest versions of Android SDK and NDK.
add a comment |
My issue was almost the same when I tried to build an Android .apk on my macOS with a console command. Whereas Visual Studio GUI builds ok, the msbuild makes an error:
error XA5101: C compiler for target Arm was not found.
It's discussed on Xamarin forum here.
The work-around found here and worked for me is to switch off BundleAssemblies parameter in Android.csproj:
<BundleAssemblies>False</BundleAssemblies>
Also my solutions with wrong NDK and toolchain paths were founded here. I installed the latest versions of Android SDK and NDK.
My issue was almost the same when I tried to build an Android .apk on my macOS with a console command. Whereas Visual Studio GUI builds ok, the msbuild makes an error:
error XA5101: C compiler for target Arm was not found.
It's discussed on Xamarin forum here.
The work-around found here and worked for me is to switch off BundleAssemblies parameter in Android.csproj:
<BundleAssemblies>False</BundleAssemblies>
Also my solutions with wrong NDK and toolchain paths were founded here. I installed the latest versions of Android SDK and NDK.
edited Apr 10 at 11:32
answered Apr 10 at 11:17
PsijicPsijic
88
88
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430291%2fcmake-configure-for-android-fails%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please, format build logs as a code (
Ctrl+Kor{}button), not as a blockquote. The latter formatting doesn't preserve newlines; it is very difficult to read such logs.– Tsyvarev
Nov 22 '18 at 12:21