Skip to content

Commit 3f2566c

Browse files
Huts, RomanHuts, Roman
authored andcommitted
Repair corrupted FFmpeg binaries
1 parent 31f23e2 commit 3f2566c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+36
-8
lines changed

Thirdparty/ffmpeg/ffmpeg-4.3.2/Build.txt

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ Build 64 with gcc under Linux
157157
extralinkflags='--extra-ldflags=-Wl,-rpath=$ORIGIN,-L/home/rhuts/Desktop/ffmpeg/zlib-1.2.11/bin/lib64,-L/home/rhuts/Desktop/ffmpeg/openssl-1.1.1c/lnx64/lib,-L/home/rhuts/Desktop/ffmpeg/aom/aom_build_lnx64/lib'
158158
export PKG_CONFIG_PATH=path/to/aom_build_lnx64/lib/pkgconfig
159159
2. Run ./ffmpeg-build-linux release 64 linux
160+
3. Run patchelf to set binaries runpath to current working directory
161+
NOTE: ffmpeg doesn't set runpath to current directly correctly with flag -rpath=$ORIGIN, we still need to use other tools to achieve this. I recommend patchelf. Please do this for all the generated binaries.
162+
eg. sudo patchelf --set-rpath '$ORIGIN' libswscale.so.5
163+
(to check the binary's runpath, objdump -p libswscale.so.5 | grep RUN)
160164

161165

162166
Build 32 with gcc under Linux
@@ -167,9 +171,22 @@ NOTE: WITH ALL THE CHANGES, IT LOOKS LIKE THE 32 BIT LINUX BUILD STILL PRODUCESS
167171
extracflags='--extra-cflags=-I/home/rhuts/Desktop/ffmpeg/zlib-1.2.11/bin/lib32,-I/home/rhuts/Desktop/ffmpeg/openssl-1.1.1c/lnx32/include'
168172
extralinkflags='--extra-ldflags=-Wl,-rpath=$ORIGIN,-L/home/rhuts/Desktop/ffmpeg/zlib-1.2.11/bin/lib32,-L/home/rhuts/Desktop/ffmpeg/openssl-1.1.1c/lnx32/lib'
169173
2. Run ./ffmpeg-build-linux release 32 linux
174+
3. Run patchelf to set binaries runpath to current working directory
175+
eg. sudo patchelf --set-rpath '$ORIGIN' libswscale.so.5
170176

171177

172178

179+
Build ARM64 with gcc under Linux
180+
-----------------------------
181+
It's same as what we have on x64
182+
1. add path to zlib and openssl by modifying the ffmpeg-build-linux
183+
extracflags='--extra-cflags=-I/home/rhuts/Desktop/ffmpeg/zlib-1.2.11/bin/lib64,-I/home/rhuts/Desktop/ffmpeg/openssl-1.1.1c/lnx64/include,-I/home/rhuts/Desktop/ffmpeg/aom/aom_build_lnx64/include'
184+
extralinkflags='--extra-ldflags=-Wl,-rpath=$ORIGIN,-L/home/rhuts/Desktop/ffmpeg/zlib-1.2.11/bin/lib64,-L/home/rhuts/Desktop/ffmpeg/openssl-1.1.1c/lnx64/lib,-L/home/rhuts/Desktop/ffmpeg/aom/aom_build_lnx64/lib'
185+
export PKG_CONFIG_PATH=path/to/aom_build_lnx64/lib/pkgconfig
186+
2. Run ./ffmpeg-build-linux release arm64 linux
187+
3. Run patchelf to set binaries runpath to current working directory
188+
eg. sudo patchelf --set-rpath '$ORIGIN' libswscale.so.5
189+
173190
Compile zlib for EXR support
174191
----------------------------
175192
Grab the zlib sources version 1.2.11. (http://zlib.net/)
@@ -191,9 +208,10 @@ Linux:
191208
64 bit:
192209
1. ./configure --static --64
193210
2. make
194-
195211
(to check x86/x64 for compiled library version in Linux: "objdump -f libz.a | grep ^architecture")
196-
212+
ARM64 Linux:
213+
1. ./configure --static
214+
2. make
197215

198216

199217
Compile openssl
@@ -273,6 +291,8 @@ perl Configure linux-x86 -m32 --prefix=/home/rhuts/Desktop/ffmpeg/openssl-1.1.1c
273291
$ make test // validate the build
274292
$ make install // copy required files to specified output directory
275293

294+
ARM64:
295+
$ ./config --prefix=/home/rhuts/Desktop/ffmpeg/openssl-1.1.1c/lnx64 no-shared zlib --with-zlib-include=/home/rhuts/Desktop/ffmpeg/zlib-1.2.11/bin/lib64 --with-zlib-lib=/home/rhuts/Desktop/ffmpeg/zlib-1.2.11/bin/lib64/libz.a '-Wl,-rpath,$(LIBRPATH)'
276296

277297

278298
Compile libaom
@@ -309,10 +329,11 @@ However to generate pkg-config file aom.pc, will still need to cmake with msys2
309329
$ make install
310330
$ Move aom.lib under path/to/aom_build_x64/lib
311331

312-
3. Linux
332+
3. Linux or ARM64 Linux
313333
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu Most of pre requirements can be found in Get the Dependencies section
314334
However, -DBUILD_SHARED_LIBS is not enough for static lib build.
315335
To avoid error "can not be used when making a shared object; recompile with -fPIC/usr/bin/ld: final link failed: bad value" Please use the following cmake cmd
336+
The flag -march=znver2 is optional for performance, you can adject with your GPU
316337

317338
64 bit:
318339
$ git clone --depth 1 https://aomedia.googlesource.com/aom
Binary file not shown.

Thirdparty/ffmpeg/ffmpeg-4.3.2/ffmpeg-build-linux

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ else
3636
lib_arch=X64
3737
flg_output=linux64
3838
fi
39-
39+
if [ "$bitness" = "arm64" ]
40+
then
41+
bld_arch=aarch64
42+
lib_arch=aarch64
43+
flg_output=linuxARM64
44+
fi
4045

4146

4247
#--------------------------------------------------------
@@ -54,6 +59,7 @@ then
5459
shared_lib_ext=so.*
5560
exe_ext=
5661
rpath=--enable-rpath
62+
sndio=--disable-sndio
5763
else
5864
fftoolchain=
5965
extralinkflags=--extra-ldflags=-static-libgcc
@@ -63,6 +69,7 @@ else
6369
shared_lib_ext=dll
6470
exe_ext=exe
6571
rpath=
72+
sndio=
6673
fi
6774

6875
if test "$build_type" == "release"
@@ -115,7 +122,7 @@ make clean
115122

116123
#MSYS2 Win build
117124

118-
$fldr_src_ffmpeg/configure $fftoolchain --arch=$bld_arch --enable-shared --enable-$thread_flag --enable-avresample --enable-version3 --enable-openssl --enable-libaom $debug_flags $extracflags $extralinkflags $rpath
125+
$fldr_src_ffmpeg/configure $fftoolchain --arch=$bld_arch --enable-shared --enable-$thread_flag --enable-avresample --enable-version3 --enable-openssl --enable-libaom $debug_flags $extracflags $extralinkflags $rpath $sndio
119126

120127
# do not use -j6 - conflict writing PDBs
121128
if [ "$toolchain" == "linux" ]

0 commit comments

Comments
 (0)