[vlc-commits] [Git][videolan/vlc][master] 12 commits: vlc_fixups: don't declare swab() on Android NDK25

Thomas Guillem (@tguillem) gitlab at videolan.org
Wed Aug 3 08:47:03 UTC 2022



Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
d5e1dd70 by Thomas Guillem at 2022-08-03T07:18:28+00:00
vlc_fixups: don't declare swab() on Android NDK25

Fix build on Android NDK25, where swab() is a static inline function
defined in <unistd.h>.

- - - - -
9e4252a5 by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: x264: with build with Android NDK25

Cross tools changed from ${ARCH}-linux-android${API}-${TOOL} to
llvm-${TOOL).

Example: aarch64-linux-android21-strings to llvm-strings.

- - - - -
b10f0705 by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: libplacebo: fix build with Android NDK25

execinfo.h is present but not necessary the functions (backtrace())
since it depends on the configured ANDROID_API.

It's not a clean and "upstreamable" patch, but the execinfo code is gone
upstream, so this patch is only temporary.

- - - - -
03f8817f by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: gnutls: fix build with Android NDK25

It needs the same patch than appleos. Maybe we should check for
aarch64 instead.

- - - - -
e196a6ff by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: rav1e: fix build on Android NDK25

I have absolutely no idea where "lgcc" is added between rav1e/cargo/cargo-c.

- - - - -
74222f93 by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: libaribcaption: update Hash

 - Fix Android build with NDK25
 - Fix va_list reuse
 - Add aribcc_renderer_set_merge_region_images()
 - Add aribcc_renderer_try_render()

- - - - -
7be5d4d8 by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: vpx: fix build with NDK25

Disable neon_asm since it rely on arm-linux-androideabi-as (removed in
NDK25).

Temporary commit.

- - - - -
46dcd6ea by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: ffmpeg: fix relocation out of range error on AArch64

ld: error: /home/tom/work/git/vlc-android/vlc/contrib/aarch64-linux-android/lib/libavcodec.a(videodsp.o):(function ff_prefetch_aarch64: .text+0x10): relocation R_AARCH64_CONDBR19 out of range: 13363404 is not in [-1048576, 1048575]; references ff_prefetch_aarch64
>>> referenced by videodsp.S:26 (libavcodec/aarch64/videodsp.S:26)
>>> defined in /home/tom/work/git/vlc-android/vlc/contrib/aarch64-linux-android/lib/libavcodec.a(videodsp.o)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Backport an existing patch from the master branch.

- - - - -
96b76894 by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: ffmpeg: enable back x86_64 asm on Android

Since relocation issues are now fixed.

- - - - -
047cc58a by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: x264: enable back x86_64 asm on Android

Since relocation issues are now fixed.

- - - - -
4386bd5f by Thomas Guillem at 2022-08-03T07:18:28+00:00
contrib: vpx: enable back i386/x86_64 asm on Android

Since relocation issues are now fixed.

- - - - -
488ee616 by Thomas Guillem at 2022-08-03T07:18:28+00:00
ci: android: use last image and last build script

Last image that contains the NDK25.

- - - - -


11 changed files:

- + contrib/src/ffmpeg/0001-lavc-aarch64-fix-relocation-out-of-range-error.patch
- contrib/src/ffmpeg/rules.mak
- contrib/src/gnutls/rules.mak
- contrib/src/libaribcaption/rules.mak
- + contrib/src/libplacebo/fix-android-build.patch
- contrib/src/libplacebo/rules.mak
- contrib/src/rav1e/rules.mak
- contrib/src/vpx/rules.mak
- contrib/src/x264/rules.mak
- extras/ci/gitlab-ci.yml
- include/vlc_fixups.h


Changes:

=====================================
contrib/src/ffmpeg/0001-lavc-aarch64-fix-relocation-out-of-range-error.patch
=====================================
@@ -0,0 +1,35 @@
+From 378ad2f8fd7c5b5d9d1b3170282ce6b8a289ba07 Mon Sep 17 00:00:00 2001
+From: Zhao Zhili <zhilizhao at tencent.com>
+Date: Mon, 13 Sep 2021 15:24:09 +0800
+Subject: [PATCH] lavc/aarch64: fix relocation out of range error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Use a temporary label instead of global function symbol for b.gt.
+
+Signed-off-by: Martin Storsjö <martin at martin.st>
+---
+ libavcodec/aarch64/videodsp.S | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/libavcodec/aarch64/videodsp.S b/libavcodec/aarch64/videodsp.S
+index 24067cc2af..fe2da0658e 100644
+--- a/libavcodec/aarch64/videodsp.S
++++ b/libavcodec/aarch64/videodsp.S
+@@ -19,10 +19,11 @@
+ #include "libavutil/aarch64/asm.S"
+ 
+ function ff_prefetch_aarch64, export=1
++1:
+         subs            w2,  w2,  #2
+         prfm            pldl1strm, [x0]
+         prfm            pldl1strm, [x0,  x1]
+         add             x0,  x0,  x1,  lsl #1
+-        b.gt            X(ff_prefetch_aarch64)
++        b.gt            1b
+         ret
+ endfunc
+-- 
+2.35.1
+


=====================================
contrib/src/ffmpeg/rules.mak
=====================================
@@ -153,9 +153,6 @@ ifdef HAVE_ANDROID
 ifeq ($(ANDROID_ABI), x86)
 FFMPEGCONF +=  --disable-mmx --disable-mmxext --disable-inline-asm
 endif
-ifeq ($(ANDROID_ABI), x86_64)
-FFMPEGCONF +=  --disable-mmx --disable-mmxext --disable-inline-asm
-endif
 endif
 
 # Windows
@@ -228,6 +225,7 @@ ffmpeg: ffmpeg-$(FFMPEG_BASENAME).tar.xz .sum-ffmpeg
 	$(APPLY) $(SRC)/ffmpeg/0001-avcodec-vp9-Do-not-destroy-uninitialized-mutexes-con.patch
 	$(APPLY) $(SRC)/ffmpeg/0001-ffmpeg-add-target_os-support-for-emscripten.patch
 	$(APPLY) $(SRC)/ffmpeg/0001-dxva2_hevc-don-t-use-frames-as-reference-if-they-are.patch
+	$(APPLY) $(SRC)/ffmpeg/0001-lavc-aarch64-fix-relocation-out-of-range-error.patch
 	$(MOVE)
 
 .ffmpeg: ffmpeg


=====================================
contrib/src/gnutls/rules.mak
=====================================
@@ -41,6 +41,9 @@ gnutls: gnutls-$(GNUTLS_VERSION).tar.xz .sum-gnutls
 ifdef HAVE_DARWIN_OS
 	$(APPLY) $(SRC)/gnutls/gnutls-fix-aarch64-compilation-appleos.patch
 endif
+ifdef HAVE_ANDROID
+	$(APPLY) $(SRC)/gnutls/gnutls-fix-aarch64-compilation-appleos.patch
+endif
 
 	$(UPDATE_AUTOCONFIG)
 	$(MOVE)


=====================================
contrib/src/libaribcaption/rules.mak
=====================================
@@ -1,4 +1,4 @@
-LIBARIBCC_HASH := c84612b78181d9369075ec8712683c6b10d9da71
+LIBARIBCC_HASH := fab6e2a857dbda2eabca5c9b53d7a67e5c00c626
 LIBARIBCC_VERSION := git-$(LIBARIBCC_HASH)
 LIBARIBCC_GITURL := https://github.com/xqq/libaribcaption.git
 


=====================================
contrib/src/libplacebo/fix-android-build.patch
=====================================
@@ -0,0 +1,12 @@
+diff -Naur libplacebo/src/meson.build libplacebo.new/src/meson.build
+--- libplacebo/src/meson.build	2022-02-03 16:30:55.000000000 +0100
++++ libplacebo.new/src/meson.build	2022-07-22 08:22:49.573761162 +0200
+@@ -69,7 +69,7 @@
+ endif
+ 
+ unwind = dependency('libunwind', required: get_option('unwind'))
+-has_execinfo = cc.has_header('execinfo.h')
++has_execinfo = false
+ conf_internal.set('PL_HAVE_UNWIND', unwind.found())
+ conf_internal.set('PL_HAVE_EXECINFO', has_execinfo)
+ if unwind.found()


=====================================
contrib/src/libplacebo/rules.mak
=====================================
@@ -37,6 +37,9 @@ libplacebo: $(PLACEBO_ARCHIVE) .sum-libplacebo
 	$(UNPACK)
 	$(APPLY) $(SRC)/libplacebo/0001-vulkan-blacklist-metal-structs-from-utils_gen.py.patch
 	$(APPLY) $(SRC)/libplacebo/0002-pl_thread-use-gettimeofday-for-back-compat.patch
+ifdef HAVE_ANDROID
+	$(APPLY) $(SRC)/libplacebo/fix-android-build.patch
+endif
 	$(MOVE)
 
 .libplacebo: libplacebo crossfile.meson


=====================================
contrib/src/rav1e/rules.mak
=====================================
@@ -33,4 +33,8 @@ endif
 
 .rav1e: rav1e .cargo
 	+cd $< && $(CARGOC_INSTALL) --no-default-features $(RAV1E_FEATURES)
+# No gcc in Android NDK25
+ifdef HAVE_ANDROID
+	sed -i -e 's/ -lgcc//g' $(PREFIX)/lib/pkgconfig/rav1e.pc
+endif
 	touch $@


=====================================
contrib/src/vpx/rules.mak
=====================================
@@ -136,11 +136,6 @@ endif
 endif
 endif
 
-ifneq ($(filter i386 x86_64,$(ARCH)),)
-# broken text relocations or invalid register for .seh_savexmm with gcc8
-VPX_CONF += --disable-mmx
-endif
-
 ifdef WITH_OPTIMIZATION
 VPX_CFLAGS += -DNDEBUG
 else
@@ -162,6 +157,11 @@ ifdef HAVE_ANDROID
 ifneq ($(shell $(VPX_CROSS)gcc -v >/dev/null 2>&1 || echo FAIL),)
 VPX_HOSTVARS = $(HOSTVARS)
 endif
+
+# Depends on "arm-linux-androideabi-as" that is removed in NDK25
+ifeq ($(ARCH),arm)
+VPX_CONF += --disable-neon_asm
+endif
 endif
 
 .vpx: libvpx


=====================================
contrib/src/x264/rules.mak
=====================================
@@ -49,13 +49,11 @@ ifndef HAVE_DARWIN_OS
 X264CONF += --cross-prefix="$(HOST)-"
 endif
 ifdef HAVE_ANDROID
+X264CONF += --cross-prefix="$(subst ar,,$(AR))"
 # broken text relocations
 ifeq ($(ANDROID_ABI), x86)
 X264CONF += --disable-asm
 endif
-ifeq ($(ANDROID_ABI), x86_64)
-X264CONF += --disable-asm
-endif
 endif
 endif
 ifdef HAVE_DARWIN_OS


=====================================
extras/ci/gitlab-ci.yml
=====================================
@@ -24,7 +24,7 @@ variables:
     VLC_WIN_LLVM_IMAGE: registry.videolan.org/vlc-debian-llvm-mingw:20220705072259
     VLC_UWP_LLVM_IMAGE: registry.videolan.org/vlc-debian-llvm-uwp:20220713124227
     VLC_DEBIAN_IMAGE: registry.videolan.org/vlc-debian-unstable:20210803114245
-    VLC_ANDROID_IMAGE: registry.videolan.org/vlc-debian-android:20220505164734
+    VLC_ANDROID_IMAGE: registry.videolan.org/vlc-debian-android:20220728132611
     VLC_SNAP_IMAGE: registry.videolan.org/vlc-ubuntu-focal:20220505174948
     VLC_RASPBIAN_IMAGE: registry.videolan.org/vlc-ubuntu-raspberry:20220505175523
     VLC_WASM_EMSCRIPTEN: registry.videolan.org/vlc-debian-wasm-emscripten:20210915101305
@@ -447,11 +447,12 @@ tvos-arm64:
     image:
         name: $VLC_ANDROID_IMAGE
     script: |
-        wget https://code.videolan.org/videolan/vlc-android/raw/fd4d934ad31d37f3eeaa834214ca16eb0d4ecb6a/buildsystem/compile-libvlc.sh
+        git clone https://code.videolan.org/videolan/libvlcjni.git
+        (cd libvlcjni && git checkout 005bcdb4be46509fe9d8428d4ff5bcdc7d8a8d99)
         if [ -n "$VLC_PREBUILT_CONTRIBS_URL" ]; then
-            /bin/sh ./compile-libvlc.sh -a $ANDROID_ARCH --with-prebuilt-contribs
+            /bin/sh ./libvlcjni/buildsysten/compile-libvlc.sh -a $ANDROID_ARCH --with-prebuilt-contribs
         else
-            /bin/sh ./compile-libvlc.sh -a $ANDROID_ARCH --package-contribs
+            /bin/sh ./libvlcjni/buildsystem/compile-libvlc.sh -a $ANDROID_ARCH --package-contribs
         fi
 
 android-arm:


=====================================
include/vlc_fixups.h
=====================================
@@ -375,8 +375,11 @@ extern "C" {
 #endif
 
 #ifndef HAVE_SWAB
+/* Android NDK25 have swab but configure fails to detect it */
+#ifndef __ANDROID__
 void swab (const void *, void *, ssize_t);
 #endif
+#endif
 
 /* Socket stuff */
 #ifndef HAVE_INET_PTON



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2322d55db35f8e44cba771600dd764816d4d0f42...488ee616e5c94e516563095c6b3ac3a85cf72871

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2322d55db35f8e44cba771600dd764816d4d0f42...488ee616e5c94e516563095c6b3ac3a85cf72871
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list