After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 759737 - android: Update to clang toolchain
android: Update to clang toolchain
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: cerbero
git master
Other Linux
: Normal blocker
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 797194 797242 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-12-21 13:28 UTC by Sebastian Dröge (slomo)
Modified: 2018-11-03 10:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
WIP: Switch to clang toolchain (9.46 KB, patch)
2015-12-28 13:28 UTC, Sebastian Dröge (slomo)
none Details | Review
libiconv_config_failed_with_ndk_r12b (60.74 KB, text/x-log)
2018-03-12 11:22 UTC, rland
  Details

Description Sebastian Dröge (slomo) 2015-12-21 13:28:38 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.
Comment 1 Sebastian Dröge (slomo) 2015-12-28 13:28:14 UTC
Created attachment 317970 [details] [review]
WIP: Switch to clang toolchain

Fails to create shared libraries for whatever reason
Comment 2 Sebastian Dröge (slomo) 2015-12-28 15:52:37 UTC
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.
Comment 3 Sebastian Dröge (slomo) 2016-09-01 06:22:50 UTC
NDK r13 will (AFAIU) only contain clang and no gcc anymore.
Comment 4 Arun Raghavan 2016-09-01 06:24:38 UTC
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.
Comment 5 Arun Raghavan 2016-10-14 03:45:25 UTC
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
Comment 6 Nicola 2017-09-14 14:00:46 UTC
(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
Comment 7 Sebastian Dröge (slomo) 2017-11-23 08:30:54 UTC
See https://bugzilla.gnome.org/show_bug.cgi?id=790753 also
Comment 8 rland 2018-03-12 11:21:05 UTC
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
Comment 9 rland 2018-03-12 11:22:34 UTC
Created attachment 369571 [details]
libiconv_config_failed_with_ndk_r12b
Comment 10 Philippe Normand 2018-04-22 09:58:23 UTC
(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.
Comment 11 Nirbheek Chauhan 2018-06-18 05:27:08 UTC
The r17b release states that GCC and gnustl/stlport will be removed in r18: https://developer.android.com/ndk/downloads/revision_history
Comment 12 Stirling Westrup 2018-07-04 20:17:12 UTC
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
Comment 13 Sebastian Dröge (slomo) 2018-07-05 05:58:27 UTC
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.
Comment 14 Stirling Westrup 2018-07-05 06:56:42 UTC
(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!
Comment 15 Sebastian Dröge (slomo) 2018-07-05 15:20:09 UTC
(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 :)
Comment 16 Mikel Pérez 2018-09-24 10:31:14 UTC
NDK r18 removed the GCC toolchain
Comment 17 Sebastian Dröge (slomo) 2018-09-24 10:47:43 UTC
*** Bug 797194 has been marked as a duplicate of this bug. ***
Comment 18 Sebastian Dröge (slomo) 2018-10-03 15:37:18 UTC
*** Bug 797242 has been marked as a duplicate of this bug. ***
Comment 19 Sebastian Dröge (slomo) 2018-10-06 07:38:38 UTC
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.
Comment 20 GStreamer system administrator 2018-11-03 10:20:23 UTC
-- 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.