Compiling FFMpeg for android - android

A lot of people have mentioned about compiling ffmpeg for android. But I recently tried many of them and did not find them working.
Here is what I tried.
https://github.com/guardianproject/android-ffmpeg-java
but in this I got the following errors.
/home/musil/Desktop/android-ndk-r10c-linux-x86_64/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --sysroot=/home/musil/Desktop/android-ndk-r10c-linux-x86_64/android-ndk-r10c/platforms/android-3/arch-arm -I../x264 -mfloat-abi=softfp -mfpu=neon -mcpu=cortex-a8 -c -o /tmp/ffconf.6LOSva5W.o /tmp/ffconf.YWZ9ftQ8.c
arm-linux-androideabi-gcc: error trying to exec 'cc1': execvp: No such file or directory
C compiler test failed.
Than I have tried other way mentioned on
http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
but in that I got the following error.
But in that the prefix install is /usr/local/ instead of ./arm/ and arch is x86 instead of arm. And it compiles but no arm folder is created.
Does anyone know how to compile ffmpeg for ndk-r10c.
Will be very helpful if someone can point out what I am doing wrong or how can I build the ffmpeg 2.4.1 for latest ndk.
Thanks

I am not sure why you see that error. I was able to successfully compile FFMpeg and you should be able to get the .so files for all architecture from this link https://github.com/android-native-libraries

Related

Compiling C files on Ubuntu and using them on Android

so today I've tried to use my C code in Android. I've made it work on intellij with regular generated dll files. From what I've understood, Android uses .so files instead of .dll files. So I've compiled with ubuntu and gcc, using the following commandline :
gcc -m32 -fPIC -o libilcore.so -shared -I/usr/lib/jvm/java-9-openjdk-amd64/include -I/usr/lib/jvm/java-9-openjdk-amd64/include/linux java.c -lc this went fine, no errors whatsoever and I got the .so file. I've put it in the jniLibs directory, and inside I made a armeabi directory, However when I try to load the library, it says
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/org.packagename.test-1/lib/arm/libilcore.so" has unexpected e_machine: 3
I have no clue on what this means, I've looked it up on google, its either the wrong way to compile on ubuntu or I've done something else wrong, can anyone please help?
Thank you in advance!

#include <exception> - No such file or directory

I am currently trying compiling GnuTLS (for wget) for Android with the Android cross-compile toolchain.
I already fixed many missing-library errors, but now I get the error
./includes/gnutls/gnutlsxx.h:26:21: fatal error: exception: No such file or directory
#include <exception>
I am using "arm-linux-androideabi-gcc (GCC) 4.9 20140827 (prerelease)" and am using this script https://gist.github.com/z3ntu/57b95b02ebe8e153d5a8 for settings up the env-variables.
You want to run the following command which will tell you where gcc's pre-processor is. Then ask that pre-processor here it's looking for C++ header files:
gcc -print-prog-name=cc1plus -v
then tweak your setup accordingly.
Actually I solved it myself... (still thanks for the help everybody!)
So for all who wonder how to compile GnuTLS for Android:
Create a standalone toolchain: Execute build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=<your_directory> --toolchain=arm-linux-androideabi-4.9 --stl=gnustl from the NDK root dir (maybe ~/Android/Sdk/ndk-bundle/)
Compile it with extra -lgnustl_shared in your LDFLAGS.

Can Gcc build a executable program?

All, Forgive me I am familiar with the C program for the Android/Linux platform. Now I am trying to use the Sourcery G++ Lite Edition
for ARM to build my sample C program and deploy it to the Linux of the Android platform.
Below is the instructions what I follow.
So far it works fine. But I have something I didn't understand well. please review it . thanks.
The Source code is a hello world program.
#include <stdio.h>
int main(int argc,char * argv[])
{
printf("Hello, Android!\n");
return 0;
}
In the development machine command console. run the following commands line.
arm-none-linux-gnueabi-gcc hello.c -static -o hellostatic
adb push hellostatic /data/test
adb shell
cd /data/test
.hellostatic
Hello, Android!
So here is my question.
Can gcc build a executable file from a c source code file? Seems It doesn't need link tool. Is it right? thanks.
Can gcc build a executable file from a c source code file?
yes, of course.
Seems It doesn't need link tool?
no, I extract the following sentences from gcc manual,
GCC is capable of preprocessing and compiling several
files either into several assembler input files, or into one assembler input file; then each
assembler input file produces an object file, and linking combines all the object files (those
newly compiled, and those specified as input) into an executable file.
At default gcc will do complie and link operation, unless you type particular options such like:
gcc -c file.c
this will just compile file.c to file.o
or:
gcc -o file file.c
this will complie file.c to file.o and also link it to make a executable file finally.
Although yanchong had already gave the nice answer , I also found a good read from here. I think it will help to understand the concepts of Compile, Link and Build. Thanks.

Android NDK arm-linux-androideabi-g++: error

I am trying to compile android-NDK project which uses L2CAP Bluetooth profile.When I compile in eclipse with android-ndk-r8d-windows and android-sdk-4.2 I am getting following error
arm-linux-androideabi-g++: error: libbluetooth.so: No such file or directory
make: *** [obj/local/armeabi/libl2cap_BTComm.so] Error 1
Please help me in solving this
I got the same problem in Ubuntu 12.04 while building the ndk project using ndk-build.
The problem is the missing g++ compiler. After install a GNU C++ compiler it works now.
Interestingly, when I recompile the whole project from fresh it got the same complain again.
(before I was using cygwin and ubuntu to compile the same project and it was working)
Its been over a year now since the last reply but I think the answer is to use the -l option of g++ to add the directory with the lib to g++'s search paths.

compile ffmpeg with android ndk r5b

compile ffmpeg with android ndk r5b.
ffmpeg 0.6.1
android ndk r5b
cygwin 1.7
build reference url : http://www.cnblogs.com/scottwong/archive/2010/12/17/1909455.html
but, ffmpeg ./configure result error! (below config.err file)
check_cc
BEGIN /tmp/ffconf.GlDiY1P8.c
1 int main(void){ return 0; }
END /tmp/ffconf.GlDiY1P8.c
/android-ndk-r5b/toolchains/arm-eabi-4.4.0/prebuilt/windows/bin/arm-eabi-gcc -fPIC -DANDROID -c -o /tmp/ffconf.1kQLpGaU.o /tmp/ffconf.GlDiY1P8.c
arm-eabi-gcc.exe: /tmp/ffconf.GlDiY1P8.c: No such file or directory
arm-eabi-gcc.exe: no input files
C compiler test failed.
so, i just try test code.
// test.c code
int main(){
return 0;
}
/android-ndk-r5b/toolchains/arm-eabi-4.4.0/prebuilt/windows/bin/arm-eabi-gcc -fPIC -DANDROID -c -o ./test.o ./test.c
ok!!!! no problem.
but,
cp ./test.c /tmp (copy to /tmp)
/android-ndk-r5b/toolchains/arm-eabi-4.4.0/prebuilt/windows/bin/arm-eabi-gcc -fPIC -DANDROID -c -o ./test.o /tmp/test.c
arm-eabi-gcc.exe: /tmp/test.c: No such file or directory
arm-eabi-gcc.exe: no input files
fail!!!
difference is only file path. /tmp directory exist, and permission is right. /home/test.c is same result.
what's wrong?
I have had a hard time to get it working in Windows, but finally I've managed to do it!
The previous posts were correct - there's a problem with Cygwin paths and Windows paths.
I have tried the solution described in the post above as the very first thing, but it was not working. Finally I've understand the reason: even if you put into your build_android.sh file the Windows path, the config for FFmpeg still contains the wrong path.
So in my case I have changed partially the config file in FFmpeg root directory from:
#set temporary file name
: ${TMPDIR:=$TEMPDIR}
: ${TMPDIR:=$TMP}
: ${TMPDIR:=/tmp}
to this:
# set temporary file name
#: ${TMPDIR:=$TEMPDIR}
#: ${TMPDIR:=$TMP}
: ${TMPDIR:=D:/InstallTools/Android/Cygwin_Root/tmp}
After this, I got it compiling.
You don't set the tmp directory. You can set it in /etc/profile or just in the terminal with export TMPDIR=/your/tmp/directory.
Notice:
1. If you compile with cygwin, the directory must be like D:/tmp. You can't use /cygdrive/d/tmp.
2. You must have the permission of the folder.
I could not get this to work either, I had the exact same problem. However I was able to compile using "android-ndk-r4". I am not sure at the moment what is causing the problem but if I ever get around to figuring it out I'll post that too.
So for now workaround is to use ndk r4.
I managed to build it, using NDK R6, cygwin. Indeed, it does not support /cydrive/ paths, simply use paths like windows; example below:
NDK=e:/AndroidSDK/NDK6
PLATFORM=$NDK/platforms/android-9/arch-arm/
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows
If you have not solved this problem, check the last part of config.log in the ffmpeg directory; it is most likely a path or CC parameter problem.
I have been having the exact same problem with r6. I have tried Lambage's suggestion with r4 but still could not get this to work.
I have been looking into the problem quite a lot and I think I've discovered the reason.
1)configure is calling the android cross compiler which is a windows .exe file.
2)It is calling it through cygwin which uses unix file naming conventions. E.G /cygdrive/c/directory instead of C:\directory
3)It says in the android NDK toolchain documentation that the cross compilers do NOT accept cygwin style filepaths (source: NDK/docs/STANDALONE_TOOLCHAIN.html):
5.1/ Windows support:
The Windows binaries do not depend on Cygwin. The good news is that they
are thus faster, the bad news is that they do not understand the Cygwin
path specification like /cygdrive/c/foo/bar (instead of C:/foo/bar).
I'm still trying to find a way to do this. If i solve it then I'll come back and edit this post...tbc

Categories

Resources