Platform suffix without specifying it in the .pro files
-
Hi all,
I am trying to compile an application both for Linux Desktop and for Android.
For some reason, when compiling for Android, even if in my TARGET variable there is written mylibrary, the output of the compilation process is mylibrary_ARCHITECTURE.so
is it possible to remove this forced extension somehow?
I have also tried to add this
android{ EXTENSION = _$${QT_ARCH}.so LIBS += -lmy_lib$$EXTENSION }else { LIBS += -lmy_lib }
but I have got issues when linking the library to a test like:
....Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -target aarch64-linux-android23 -fno-limit-debug-info -Wl,-soname,libtest_my_lib_arm64-v8a.so -Wl,--build-id=sha1 -Wl,--no-undefined -Wl,-z,noexecstack -shared -o ../bin/libtest_my_lib_arm64-v8a.so ../build/main.o -L/home/test/my_lib/lib -lmy_lib_arm64-v8a.so /opt/Qt/6.3.0/android_arm64_v8a/lib/libQt6Core_arm64-v8a.so -llog -pthread -llog -lz -lm -ldl -lc ld: error: unable to find library -lmy_lib_arm64-v8a.so
Any hints?
-
where is your lib located? I think the paths to the lib are different in both builds. You may need to add the paths after -L as well.
-
thank you for your reply.
I am using the -L flag too. In fact, if I compile for Desktop only it works. It is a really strange behavior
-
@genner sorry You have to add it to Android project with
LIBS += fullpath/libname.sodo not forget to add it to here as well.
ANDROID_EXTRA_LIBS = -
@JoeCFD Thank you. It is still not working (it does not find the library). I am going to investigate more, but I find it really strange that it is not possible to leave the TARGET with the name I want