Closed juha-h closed 3 years ago
mobile-ffmpeg
build scripts do not support static libraries on Android. If you want use static libraries and modify the scripts to build them then I suggest you modify the files under android/jni
as well. We can not support all possible build combinations in top-level build scripts.
I haven't tested yet, but looks like the static libs were built OK. The only issue seemed to be that android.sh failed AFTER building them. If so, I can just ignore the failure and use the libs that appeared in prebuilt folder. Have I understood this correctly?
I checked the architecture of the resulting static libraries with objdump. Libs libvpx, x264, and x265 were all OK (elf64-little), but ffmpeg libs were not OK, for example:
$ objdump -f ./src/ffmpeg/libavdevice/libavdevice.a
In archive ./src/ffmpeg/libavdevice/libavdevice.a:
objdump: alldevices.o: file format not recognized
objdump: android_camera.o: file format not recognized
objdump: avdevice.o: file format not recognized
objdump: utils.o: file format not recognized
Any explanation for that or is it really as you tell that this project cannot be used to build static ffmpeg libraries?
I can just ignore the failure and use the libs that appeared in prebuilt folder. Have I understood this correctly?
Yeah, you can use ffmpeg
libs from prebuilt
folder.
Any explanation for that or is it really as you tell that this project cannot be used to build static ffmpeg libraries?
I don't know what is the last architecture built under the src/ffmpeg
folder. So, instead of doing that I suggest running objdump
on files under the prebuilt
folder with objdump
provided by NDK
.
Directory prebuilt/android-arm64/ffmpeg/lib
has these files after I enabled shared:
libavcodec.a libavfilter.so* libpostproc.a libswscale.so*
libavcodec.so* libavformat.a libpostproc.so* pkgconfig/
libavdevice.a libavformat.so* libswresample.a
libavdevice.so* libavutil.a libswresample.so*
libavfilter.a libavutil.so* libswscale.a
Shared libs are OK, for example:
./toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-objdump -f /usr/src/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg/lib/libavdevice.so
/usr/src/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg/lib/libavdevice.so: file format elf64-little
architecture: UNKNOWN!, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x0000000000000000
but static ones are not, for example:
./toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-objdump -f /usr/src/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg/lib/libavdevice.a
In archive /usr/src/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg/lib/libavdevice.a:
./toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-objdump: alldevices.o: File format not recognized
./toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-objdump: android_camera.o: File format not recognized
./toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-objdump: avdevice.o: File format not recognized
./toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-objdump: reverse.o: File format not recognized
./toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-objdump: utils.o: File format not recognized
Looks like I'm able to use shared ffmpeg libs in my project, so this issue can be closed.
You have a binary built for arm64
but you're using objdump
that supports i686
architecture.
/usr/src/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg/lib/libavdevice.a
i686-linux-android-objdump
I don't know whether it will resolve your File format not recognized
errors but at least use an objdump
variant that supports your binary format, e.g.aarch64-linux-android-objdump
for arm64
binaries.
Same result with aarch64-linux-android-objdump:
/opt/Android/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android/bin/objdump -f prebuilt/android-arm64/ffmpeg/lib/libavdevice.a
In archive prebuilt/android-arm64/ffmpeg/lib/libavdevice.a:
/opt/Android/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android/bin/objdump: alldevices.o: File format not recognized
...
Also android-studio build gave the same error when I tried to use these static ffmpeg libs.
But as I mentioned, looks like shared libs are also OK for me and I don't need the static ones.
Description I edited android-ffmpeg.sh ./configure arguments so that only static libs with the features that are need are build:
Build of the libs went fine, but mobile-ffmpeg (whatever that is) failed:
Expected behavior I would expect the build to succeed.
Current behavior See above. According to build.log, failure was due to a missing dynamic lib:
That, of course, does not exist because I didn't build shared libs. android.sh should check if shared libs have been build before trying to do something with them.
Screenshots If applicable, add screenshots to help explain your problem.
Logs Post logs here or paste them to Ghostbin and insert the link here.
Environment
Other Add any other context about the problem here.