1

I'm trying to build ffmpeg in Android NDK under Windows to put into an app but having issues. I found various guides on how to do this but they were all many years old and no longer worked.

What I've done so far is install NDK and downloaded the latest ffmpeg 3.1.2 source code into the sources folder. I also installed cygwin.

I then created a script, build_android.sh, with the code (taken from another guide):

#!/bin/bash NDK=/cygdrive/c/Android/ndk/android-ndk-r12b SYSROOT=$NDK/platforms/android-24/arch-arm64/ TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 function build_one { ./configure \ --prefix=$PREFIX \ --disable-shared \ --enable-static \ --disable-doc \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --disable-avdevice \ --disable-doc \ --disable-symver \ --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \ --target-os=linux \ --arch=arm \ --enable-cross-compile \ --sysroot=$SYSROOT \ --extra-cflags="-Os -fpic $ADDI_CFLAGS" \ --extra-ldflags="$ADDI_LDFLAGS" \ $ADDITIONAL_CONFIGURE_FLAG make clean make make install } CPU=arm PREFIX=$(pwd)/android/$CPU ADDI_CFLAGS="-marm" build_one 

When I run this I get:

Makefile:198: /tests/Makefile: No such file or directory make: *** No rule to make target '/tests/Makefile'. Stop. 

Anyone know how to successfully build ffmpeg in NDK or have any guides that work with the latest version?

Thanks, Oliver

1 Answer 1

1

"tests" is a subfolder in the ffmpeg folder. It is required for build, but it looks like it is missing. Ensure you've pulled down the entire ffmpeg source tree.

Your build_android.sh looks fine to me.

Sign up to request clarification or add additional context in comments.

9 Comments

Thanks for your response That was actually the first thing I checked, the tests sub-folder and Makefile both exist under the ffmpeg source folder but strangely when building it gives the message that it can't find it
I notice that it's looking for "tests" in the root. I would've expected it to say "No rule to make target 'tests/Makefile'" instead. Can you edit the "make install" line to include the "--debug=v" switch, and relate some of the output? You might also edit line 198 of ffmpeg/Makefile to point explicitly at the correct tests folder, until we figure this out.
Thanks for your help - I took a look at Makefile line 198 - the line is: include $(SRC_PATH)/tests/Makefile So it looks like SRC_PATH isn't set. I tried setting it in build_android.sh but it had no affect. Do you know how I should set this?
SRC_PATH is set by the ./configure script (from build_android.sh). It echoes it to the screen as the second line of output ("source path"). On mine, "source path" is ".". How does your ./configure output look? Did it throw any errors? In some cases, if the ffmpeg full path has a space in it, the build will fail.
I've managed to get a very close to getting it building by changing the directory from /cygdrive/c/ to c:/ which seemed to get it building. I also added --enable-jni and changed target os to android. But now after a while of compilation I get: ffserver.c: In function ‘main’: ffserver.c:4003:5: error: implicit declaration of function ‘sigaction’ [-Werror=implicit-function-declaration] sigaction(SIGCHLD, &sigact, 0); Any idea how to fix that? I might look into just disabling the ffserver component as I don't think I need it just for what I want to do
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.