GNOME Bugzilla – Bug 759737
android: Update to clang toolchain
Last modified: 2018-11-03 10:20:23 UTC
https://android.googlesource.com/platform/ndk.git/+/master/CHANGELOG.md The gcc toolchain is now officially deprecated in favor of clang. Switching to clang requires some more changes in cerbero though. We should do that soonish.
Created attachment 317970 [details] [review] WIP: Switch to clang toolchain Fails to create shared libraries for whatever reason
The problem here is that we a) have to use ld.mcld and b) that one is not detected as GNU ld so libtool does not know how to create shared libraries with it.
NDK r13 will (AFAIU) only contain clang and no gcc anymore.
Sorry, I misspoke about this. The exact wording is: "The ndk-build command defaults to using Clang in r13. We will remove GCC in a subsequent release." But we do need to have some solution in place soon, and also need to make sure that ndk-build things work fine on the app side of things.
We might have to do this sooner, rather than later, anyway. With NDK r13, I see the following linker error: GStreamer : [GEN] => gst-build-armeabi-v7a/gstreamer_android.c GStreamer : [COMPILE] => gst-build-armeabi-v7a/gstreamer_android.c GStreamer : [LINK] => gst-build-armeabi-v7a/libgstreamer_android.so /home/arun/code/android/android-ndk-r13/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.gold: error: conditional branch to PLT in THUMB-2 not supported yet. libswresample/arm/audio_convert_neon.S:137: error: unexpected opcode while processing relocation R_ARM_THM_JUMP19 clang: error: linker command failed with exit code 1 (use -v to see invocation) /home/arun/code/gstreamer/cerbero/build/dist/android_universal/armv7/share/gst-android/ndk-build//gstreamer-1.0.mk:230: recipe for target 'buildsharedlibrary_armeabi-v7a' failed
(In reply to Arun Raghavan from comment #5) > We might have to do this sooner, rather than later, anyway. With NDK r13, I > see the following linker error: > > GStreamer : [GEN] => gst-build-armeabi-v7a/gstreamer_android.c > GStreamer : [COMPILE] => gst-build-armeabi-v7a/gstreamer_android.c > GStreamer : [LINK] => gst-build-armeabi-v7a/libgstreamer_android.so > /home/arun/code/android/android-ndk-r13/toolchains/arm-linux-androideabi-4.9/ > prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm- > linux-androideabi/bin/ld.gold: error: conditional branch to PLT in THUMB-2 > not supported yet. > libswresample/arm/audio_convert_neon.S:137: error: unexpected opcode while > processing relocation R_ARM_THM_JUMP19 > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > /home/arun/code/gstreamer/cerbero/build/dist/android_universal/armv7/share/ > gst-android/ndk-build//gstreamer-1.0.mk:230: recipe for target > 'buildsharedlibrary_armeabi-v7a' failed a workaround is to set NDK_TOOLCHAIN_VERSION := 4.9 in Application.mk, the defaul value is clang, maybe this could be documented until the switch to clang
See https://bugzilla.gnome.org/show_bug.cgi?id=790753 also
I'm blocked here.even set NDK_TOOLCHAIN_VERSION := 4.9, still failed with git master: ---- /home/shakin/work/src/ssc/gstreamer/cerbero/build/android-ndk-16/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.gold: error: conditional branch to PLT in THUMB-2 not supported yet. libswresample/arm/audio_convert_neon.S:137: error: unexpected opcode while processing relocation R_ARM_THM_JUMP19 /home/shakin/work/src/ssc/gstreamer/cerbero/build/android-ndk-16/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.gold: error: conditional branch to PLT in THUMB-2 not supported yet. crypto/poly1305/poly1305-armv4.s:510: error: unexpected opcode while processing relocation R_ARM_THM_JUMP19 collect2: error: ld returned 1 exit status make: *** [buildsharedlibrary_armeabi-v7a] Error 1 BTW,I tried to set NDK r16=>r12b, and compiling libiconv failed. It seems a regression(incompatible with the previous NDK version) ? -- checking how to run the C preprocessor... arm-linux-androideabi-cpp configure: error: in `/home/shakin/work/src/ssc/gstreamer/cerbero/build/sources/android_armv7/libiconv-1.15': configure: error: C preprocessor "arm-linux-androideabi-cpp" fails sanity check See `config.log' for more details Recipe 'libiconv' failed at the build step 'configure' Select an action to proceed: [0] Enter the shell [1] Rebuild the recipe from scratch [2] Rebuild starting from the failed step [3] Skip recipe [4] Abort
Created attachment 369571 [details] libiconv_config_failed_with_ndk_r12b
(In reply to Nicola from comment #6) > (In reply to Arun Raghavan from comment #5) > > We might have to do this sooner, rather than later, anyway. With NDK r13, I > > see the following linker error: > > > > GStreamer : [GEN] => gst-build-armeabi-v7a/gstreamer_android.c > > GStreamer : [COMPILE] => gst-build-armeabi-v7a/gstreamer_android.c > > GStreamer : [LINK] => gst-build-armeabi-v7a/libgstreamer_android.so > > /home/arun/code/android/android-ndk-r13/toolchains/arm-linux-androideabi-4.9/ > > prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm- > > linux-androideabi/bin/ld.gold: error: conditional branch to PLT in THUMB-2 > > not supported yet. > > libswresample/arm/audio_convert_neon.S:137: error: unexpected opcode while > > processing relocation R_ARM_THM_JUMP19 > > clang: error: linker command failed with exit code 1 (use -v to see > > invocation) > > /home/arun/code/gstreamer/cerbero/build/dist/android_universal/armv7/share/ > > gst-android/ndk-build//gstreamer-1.0.mk:230: recipe for target > > 'buildsharedlibrary_armeabi-v7a' failed > > a workaround is to set > > NDK_TOOLCHAIN_VERSION := 4.9 > > in Application.mk, the defaul value is clang, maybe this could be documented > until the switch to clang This workdaround doesn't work here with NDK 16b and gst 1.14 binaries. However the one recommended in https://github.com/android-ndk/ndk/issues/337 does work, replace gold with bfd linker in armv7 gstreamer1.0.mk file.
The r17b release states that GCC and gnustl/stlport will be removed in r18: https://developer.android.com/ndk/downloads/revision_history
I have made a very preliminary port of GStreamer 1.12.4 to Clang for the ARM v7 under Android for a Linux development environment. It's just the core plugins and base code needed for the current project my company is working on, but we thought it might serve as a useful skeleton for a port. https://github.com/swestrup/gstreamer_clang
Thanks, that might be useful for someone but that's not what is the scope of this bug here :) You seem to build GStreamer and some deps via gradle and bash scripts directly into the application, but what we want here is to switch cerbero to use clang for Android instead of gcc.
(In reply to Sebastian Dröge (slomo) from comment #13) > Thanks, that might be useful for someone but that's not what is the scope of > this bug here :) > > You seem to build GStreamer and some deps via gradle and bash scripts > directly into the application, but what we want here is to switch cerbero to > use clang for Android instead of gcc. Yes, but you were the one who specifically asked me to post my URL to this bugzilla entry!
(In reply to Stirling Westrup from comment #14) > (In reply to Sebastian Dröge (slomo) from comment #13) > > Thanks, that might be useful for someone but that's not what is the scope of > > this bug here :) > > > > You seem to build GStreamer and some deps via gradle and bash scripts > > directly into the application, but what we want here is to switch cerbero to > > use clang for Android instead of gcc. > > Yes, but you were the one who specifically asked me to post my URL to this > bugzilla entry! True, from your mail I understood something different :)
NDK r18 removed the GCC toolchain
*** Bug 797194 has been marked as a duplicate of this bug. ***
*** Bug 797242 has been marked as a duplicate of this bug. ***
This involves changes in cerbero (for using clang instead of gcc) but also in the ndk-build pieces: the compiler commandline we pass works for gcc but not for clang.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/cerbero/issues/26.