Solved Building protobuff libs for Android 64 bit (ARM64-v8a) Qt 5.12.4
-
Thanks for this.
It's working fine.
Little remark from Nov 2020, the scriptmake_standalone_toolchain.py
is no longer needed:#$ $NDK/build/tools/make_standalone_toolchain.py --arch arm64 --api 28 --stl=libc++ --install-dir=/home/bruel/apps/protobuf/build #WARNING:__main__:make_standalone_toolchain.py is no longer necessary. The #$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin directory contains target-specific scripts that perform #the same task. For example, instead of: # # $ python $NDK/build/tools/make_standalone_toolchain.py \ # --arch arm64 --api 28 --install-dir toolchain # $ toolchain/bin/clang++ src.cpp # #Instead use: # # $ $NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang++ src.cpp
So for arm64, you can go directly like this
CC=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android$ANDROID_API-clang CXX=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android$ANDROID_API-clang++ CFLAGS="-fPIE -fPIC" LDFLAGS="-pie -llog" ../configure --host=aarch64-linux-android --prefix=$APPS_DIR/protobuf/release/arm64 --with-protoc=~/apps/protobuf/release/x86_64/bin/protoc
For those interested, here is my script to build on Linux for x86_64, arm64 and armv7a.
-
Hi @mbruel
That's cool,
I had a critical time & had to go withmake_standalone_toolchain.py
at that time.Thanks for the updated script on this Building protobuff libs for Android 64 bit (ARM64-v8a) Qt 5.12.4.
-
In fact with the method I've posted just above, I can build the Android arm64 library but when I deploy it to a device it's crashing with this:
E AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread E AndroidRuntime: Process: fr.mbruel.ClementineRemote, PID: 24487 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_Unwind_Resume" referenced by "/data/app/fr.mbruel.ClementineRemote-eCT926MVQi5HkO3nFNVzEg==/lib/arm64/libprotobuf.so"... E AndroidRuntime: at java.lang.Runtime.load0(Runtime.java:938) E AndroidRuntime: at java.lang.System.load(System.java:1631) E AndroidRuntime: at org.qtproject.qt5.android.QtNative$3.run(QtNative.java:348) E AndroidRuntime: at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:87) E AndroidRuntime: at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61) E AndroidRuntime: at java.lang.Thread.run(Thread.java:919)
Any idea why?
I'm using protobuf 3.13. I've tried the latest 3.17 but I've the same issue...
I'm building using this command:NDK=~/android/android-ndk-r21 ANDROID_API=29 CC=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android$ANDROID_API-clang CXX=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android$ANDROID_API-clang++ CFLAGS="-fPIE -fPIC" LDFLAGS="-pie -llog" ../configure --host=aarch64-linux-android --prefix=~/apps/protobuf/release/arm64 --with-protoc=~/apps/protobuf/release/x86_64/bin/protoc
-
@mbruel said in Building protobuff libs for Android 64 bit (ARM64-v8a) Qt 5.12.4:
cannot locate symbol "_Unwind_Resume"
I've updated the NDK to the r21e and the crash is gone! \o/