ld errors for arm64-v8a and armeabi-v7a Android builds on x86-64 machine
-
Hello, folks!
I have built Qt5.15.12 for Android on Unbuntu and macOS(both x86_64) and now trying to build an app for 3 archs with 'ANDROID_ABIS=armeabi-v7a arm64-v8a x86_64'
x86_64 build is compiling and linking without any problems, but on a final step of armeabi-v7a:
/opt/android-sdk/ndk/23.2.8568313/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -target armv7a-linux-androideabi33 -fno-limit-debug-info -Wl,--exclude-libs,libunwind.a -Wl,-soname,libqueen-ladybug_armeabi-v7a.so -Wl,-rpath-link=/opt/qt/5.15.12.CE0/android/lib -Wl,--build-id=sha1 -Wl,--no-undefined -Wl,-z,noexecstack -shared -o my_app.so ... /opt/qt/5.15.12.CE0/android/lib/libQt5Core_armeabi-v7a.so -lGLESv2 -llog -lz -lm -ldl -lc
... and armv64-8a:
/opt/android-sdk/ndk/23.2.8568313/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -target aarch64-linux-android33 -fno-limit-debug-info -Wl,-soname,libqueen-ladybug_arm64-v8a.so -Wl,-rpath-link=/opt/qt/5.15.12.CE0/android/lib -Wl,--build-id=sha1 -Wl,--no-undefined -Wl,-z,noexecstack -shared -o my_app.so ... /opt/qt/5.15.12.CE0/android/lib/libQt5Core_arm64-v8a.so -lGLESv2 -llog -lz -lm -ldl -lc
I am facing with ld errors:
cannot open crtbegin_so.o: No such file or directory
unable to find library -lGLESv2
unable to find library -llog
unable to find library -lc++
cannot open crtend_so.o: No such file or directoryQt was configured on macOS like:
./configure -xplatform android-clang \ -disable-rpath \ -prefix /opt/qt/5.15.12.CE0/android \ -android-sdk /opt/android/sdk \ -android-ndk /opt/android/ndk/r22b \ -android-ndk-host darwin-x86_64 \ -sysconfdir /etc/xdg \ -no-dbus \ -opengl es2 \ -no-qpa-platform-guard \ -sql-sqlite \ -ssl \ -I/usr/local/opt/openssl/include \ -L/usr/local/opt/openssl \ -nomake tests \ -nomake examples \ -verbose \ -opensource \ -confirm-license
...and Ubuntu:
./configure -xplatform android-clang \ -release \ -prefix /opt/qt/5.15.12.CE0/android \ -android-sdk /opt/android/sdk \ -android-ndk /opt/android/ndk/r22b \ -android-ndk-host linux-x86_64 \ -sysconfdir /etc/xdg \ -no-dbus \ -opengl es2 \ -sql-sqlite \ -ssl -I/usr/local/opt/openssl/include \ -L/usr/local/opt/openssl \ -nomake tests \ -nomake examples \ -verbose \ -opensource \ -confirm-license
What I am missing?
Thank you! -
@danilabagroff It is pretty messy to build qt app for Android. Better to use qt-creator to build your android app.
unable to find library -lGLESv2 unable to find library -llog unable to find library -lc++
show their paths are not set properly.
-
@JoeCFD said in ld errors for arm64-v8a and armeabi-v7a Android builds on x86-64 machine:
unable to find library -lGLESv2
unable to find library -llog
unable to find library -lc++Are these libraries supposed to be located somewhere in the sysroot of relevant arch? Could you give me a specific location to check? Thank you :)
-
@danilabagroff try to use qt creator in a similar OS and write down the command and env settings for build. Use them in your command line build.
or
locate libGLESv2
locate liblog
locate libc++
to find the right paths for these libs and add the paths with -L in front of them in your command. -
@danilabagroff Build your app in your local computer with QtCreator and get the command for build from qtcreator output. Run the same command in your server. That is what I am doing.
-
@JoeCFD This is exactly how I have started - just copy-pasted all commands from QtC on my dev machine(which is macOS/arm64 and can be an important difference, because CI/CD machines are x86_64).
I have been trying to build a final app a lot against different NDKs and experiencing ld error with 22.1.7171670, **23.**2.8568313 for non x86_64 despite fact that corresponding libraries(GLESv2, log, c++) are exist in all relevant sysroots.
Finally, I gave a try and successfully had built the test app for all archs against 25.1.8937393 with different warnings and I am not sure that everything(Qt, Android SDK, NDK, Graddle, etc) is legally compatible. Could be this point be a clue? What is the difference between 25.1.8937393 and 22.1.7171670 sysroots?
I am okay to stay with 25.1 but not sure how to check all dependencies though and cannot simply ignore fact that 22.1.7 is recommended by Qt for Qt5.15.12 itself.
Best,
Dani -
@danilabagroff Try to build your app from command line on your local machine with the commands displayed in qt creator and make sure all env variables are set as in Qt Creator. You are able to see all env variables set in QtCreator.