Mobile-ffmpeg: WSL 2.0 Ubuntu build for Android fails with: checking whether the C compiler works... no

Created on 1 Sep 2020  路  12Comments  路  Source: tanersener/mobile-ffmpeg

Description
I tried to build mobile-ffmeg with next command
./android.sh --enable-lame --enable-libtheora --enable-libvorbis --enable-x264 --enable-libvpx --enable-opus --enable-gpl --disable-arm-v7a-neon

Expected behavior
Expected .so libs as output

Current behavior
Build fails with next logs:

Logs
https://ghostbin.co/paste/ck69x

Environment

  • Platform: [Android]
  • Architecture: [arm-v7a, arm64-v8a, x86, x86_64]
  • Source branch (if applicable) [master]
  • Android NDK version (if applicable) [17c]

Other
Also I donwloaded SDK 21 through Android Studio-> Sdk Manager, but your script says that it uses SDK 24:

Architectures: arm-v7a, arm64-v8a, x86-64
Libraries: cpu-features, lame, libiconv, libtheora, libvorbis, libvpx, x264, opus

Building arm-v7a platform on API level 24

libiconv: failed

Why?

All 12 comments

I am afraid NDK r.17c is not supported with master.

@alexcohn my bad. I thought I have seen somewhere in wiki's that r17 is recommended. Okay, actually I need ffmpeg for API 21+, it's v4.2 LTS release. I should build ffmpeg from that commit?

Also, I have a question about libtheora 1.1.1. It's not building separately on my side. It can't find sys/timeb.h when built with SDK 21. How did you solved it? 1.1.2 alpha also uses this sys/timeb.h

I would strongly suggest the latest release (4.4). If you need API 21+ support, use --lts build option for android.sh. It gives you 16+ at no significant cost.

I don't remember specific problems with libtheora; I hope you will see it all compile if you use --lts build.

What a beautiful thing to watch. So minimalistic. So pristine. Enjoying every line, actually
image

@alexcohn I have one more question. Some of the built libs and not in the required formet, e.g. On my side there are some-lib.so used(in-app), and in mobile-ffmpeg some-lib.a is being built. If I Just swap some static libs with shared libs in Android.mk will there be no consequences?

Which Android.mk uses static libs? Not mobile-ffmpeg, as far as I know.

@alexcohn yes, it's my app's internal make file, not mobile-ffmpeg's. Sorry For confusion. I already have ffmpeg manually built in my proj. Its very old and buildable only on sdk 16, so I can't buikd x64. I am trying to swap my old ffmpeg with your fresh ffmpeg, but my jni is built with some of ffmpeg libs that are static, but in mobile-ffmpeg I see this libs are shared. And question: can I control what the output in mobile-ffmpeg will be, shared or static?

I would suggest that you simply use shared ffmpeg libs in your project. The libraries built for mobile-ffmpeg should not cause any problem, but keep your eye on the extras that you need or don't.

It isn't hard to tweak the mobile-ffmpeg script to produce static libraries, but it may be more painful to work with them.

Sorry for offtopping again, but I still would like to try to change format of the procuced output of mobile-ffmpeg.

So, I need next libs in exactly that format:

libtheora.a
libtheoradec.a
libtheoraenc.a
libavcodec.a
libavdevice.a
libavfilter.a
libavformat.a
libavutil.a
libpostproc.a
libswresample.a
libswscale.a
libvpx.a
libmp3lame.so
libopus.so
libogg.so
libvorbisenc.so
libvorbisfile.so
libvorbis.so
libx264.so

But, mobile-ffmpeg produces next ones formats:

libtheora.a
libtheoradec.a
libtheoraenc.a
libavcodec.so
libavdevice.so
libavfilter.so
libavformat.so
libavutil.so
libpostproc.so (need to add --enable-postproc)
libswresample.so
libswscale.so
libvpx.a
libmp3lame.a
libopus.a
libogg.a
libvorbisenc.a
libvorbisfile.a
libvorbis.a
libx264.a

I tried to tweak my own app to adapt to your output, but it hasn't worked out.
So, I decided to tweak mobile-ffmpeg scripts to produce different output formats, so, I have modified next scripts:

cd mobile-ffmpeg
git diff:
https://gist.github.com/s7aycool/2387e4245e1f33b29ac53958e31cdf67

And as output I had exact formats I needed. But, there is a problem:

Ndk says that some of .a libs and some of .so are broken. It says that libavcodec.a is not an ELF format, furthermore I can't read lib with readelf -h libavcodec.a:

https://gist.github.com/s7aycool/29889542b2e49609b81b4f76f031aa0d

Question: how can I get needed output from mobile-ffmpeg, and keep files working?

@alexcohn okay, solved by building ffmpeg in .a, and other libs(lame, ogg) in .so. It's working now. Thanks for answers!

Also, my build fails with ndk 21r with usage of --lts. Without --lts it builds ok, but min Api 24 is not what I need:

command used:
./android.sh --enable-lame --enable-libtheora --enable-libvorbis --enable-x264 --enable-libvpx --enable-opus --enable-gpl --disable-arm-v7a-neon --lts
diff from your scripts: (not much diff actually, just some of libs with --enable-shared, and --enable-postproc in ffmpeg)
https://gist.github.com/s7aycool/9acdf473230a27a98afef8fb9a0d1af0

Error:
ffmpeg: failed

Error from build.log:

INFO: Cleaning workspace for ffmpeg
armv7a-linux-androideabi16-clang is unable to create an executable file.
C compiler test failed
Was this page helpful?
0 / 5 - 0 ratings

Related issues

krislyy picture krislyy  路  5Comments

shaheercs picture shaheercs  路  6Comments

vlazdra picture vlazdra  路  6Comments

chaocharleswang picture chaocharleswang  路  4Comments

khacchungory picture khacchungory  路  7Comments