Building Qt with -xplatform android-clang in GNU/Linux fails
-
Trying to build Qt with
Command line: -confirm-license -opensource -silent -prefix /opt/android-qt5/arm64-v8a -docdir /opt/android-qt5/arm64-v8a/doc -xplatform android-clang -nomake tests -nomake examples -android-ndk /opt/android-ndk -android-sdk /opt/android-sdk -android-ndk-host linux-x86_64 -android-toolchain-version 4.9 -skip qttranslations -skip qtserialport -no-warnings-are-errors -no-pkg-config -qt-zlib -qt-freetype -android-arch arm64-v8a -android-ndk-platform android-21 executing config test use_gold_linker
Building the first test
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -D__ANDROID_API__=21 -target aarch64-none-linux-android -gcc-toolchain /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -DANDROID_HAS_WSTRING --sysroot=/opt/android-ndk/sysroot -isystem /opt/android-ndk/sysroot/usr/include/aarch64-linux-android -isystem /opt/android-ndk/sources/cxx-stl/llvm-libc++/include -isystem /opt/android-ndk/sources/android/support/include -isystem /opt/android-ndk/sources/cxx-stl/llvm-libc++abi/include -fstack-protector-strong -DANDROID -fuse-ld=gold -o conftest-out conftest.cpp
Gives me the following error
> /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: cannot open crtbegin_dynamic.o: No such file or directory > /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: cannot open crtend_android.o: No such file or directory > /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: cannot find -lstdc++ > /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: cannot find -lm > /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: cannot find -ldl > /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: cannot find -lc > /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: cannot find -ldl > clang++: error: linker command failed with exit code 1 (use -v to see invocation) test config.qtbase.tests.use_gold_linker FAILED
Any help?
-
Ok, found many problems with the build, some heavy patch are required, here is the progress (there are some hardcoded paths for testing).
Would not mind some help :-)
-
@hipersayan_x so it is not an issue anymore? Please mark your post as solved if such. Thanks
-
@Pablo-J.-Rogina I will consider solved once it fully compile, and it does not right now. Will post updates later.
-
Ok, solved! for those having problem compiling with NDK r18 the following files must be modified:
qtbase/mkspecs/android-clang/qmake.conf:
In QMAKE_CFLAGS change
--sysroot=$$NDK_ROOT/sysroot
with
--sysroot=$$ANDROID_PLATFORM_ROOT_PATH
and add -isystem $$NDK_ROOT/sysroot/usr/include at the end.
And in ANDROID_CXX_STL_LIBS change -lc++ with -lc++_shared.qtlocation/src/plugins/geoservices/geoservices.pro:
Remove all lines related to qtConfig(geoservices_mapboxgl).