Compiling FFmpeg lib and add it to NDK sources on Windows8 - android-ndk

I've seen some articles about how to compile and uses FFmpeg for Android.
These are 2 good examples - example1 and example2
Unfortunately, non off them, or others I found helped me. In those two examples a build_android.sh is created and configure the FFmpeg's configuraion file and call to make. Every time when I'm running the script I'm getting the following error:
c:\android\development\android-ndk-r9\sources\ffmpeg>sh build_android.sh
c:/android/development/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebu
ilt/windows-x86_64/arm-linux-androideabi/bin/bin/arm-linux-androideabi-gcc is un
able to create an executable file.
C compiler test failed.
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user#ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solving the problem.
Makefile:2: config.mak: No such file or directory
Makefile:49: /common.mak: No such file or directory
Makefile:92: /libavutil/Makefile: No such file or directory
Makefile:92: /library.mak: No such file or directory
Makefile:169: /doc/Makefile: No such file or directory
Makefile:170: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile'. Stop.
Makefile:2: config.mak: No such file or directory
If someone encountered and solved this issue it'll be much appreciated!
After trying the suggested script I ran into a new problem that I couldn't solved, this is the output of the script:
.... Enabled components list....
In the end of the list I got the following:
Enabled indevs:
dv1394 v4l2i
fbdev
Enabled outdevs:
fbdev v4l2
License: LGPL version 2.1 or later
Creating config.mak, config.h, and doc/config.texi...
WARNING: C:/android/development/android-ndk-r9/toolchains/arm-linux-androideabi-
4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-pkg-config not found, libr
ary detection may fail.
make: *** No rule to make target libavfilter/libavfilter.so', needed by all-ye
s'. Stop.
make: *** No rule to make target install-libavfilter-shared', needed by instal
l-libs-yes'. Stop.

Can you paste what's in your build_android.sh file which you've copied inside the FFmpeg directory?
I've got the same error when one of the variables defined at the start of the script where set incorrectly. Check to see if your NDK or SYSROOT or TOOLCHAIN variables are set to a valid path!
I've tried using the following steps and it worked for me:
1) Download FFmpeg
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
2) Create a file called build_android.sh inside the FFmpeg directory
cd ffmpeg; touch build_ffmpeg_for_android.sh;
3) Add the following content to the file
#!/usr/bin/env bash
NDK=$HOME/Software/Android/android-ndk-r10/
SYSROOT=$NDK/platforms/android-19/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-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 -j4
make install
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
build_one
4) Make the script executable
chmod +x build_ffmpeg_for_android.sh
5) Start the build of FFmpeg for Android (ARM)
(run the script with Bash, i.e. /usr/bin/bash not /usr/bin/sh)
./build_ffmpeg_for_android.sh

I was getting the same errors as #powerX and I was able to solve the issue using a different method from #dZkF9RWJT6wN8ux.
Though I am using Ubuntu 13.10, I hope you find my answer helpful. With android NDK r9 and FFMPEG 2.2 "Muybridge" release, I was finally able to accomplish the third step entitled "Build FFMPEG" from #powerX example1 link: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
I finally fixed this by changing the SYSROOT variable in the build_android.sh file to point to ".../android-19/arch-arm" instead of .../android-9/arch-arm".
Hope this helps.

Related

How do I integrate Crashpad with my daemon application in linux? Is there any implementation guide?

How do I integrate Crashpad with my daemon application in linux? Is there any implementation guide? I did not find any official recommended steps on chromium project site.
You'll need to build Crashpad and link libbase.a, libclient.a and libutil.a with your application.
Additionally you'll need to add $CRASHPAD_DIR/include and $CRASHPAD_DIR/include/third_party/mini_chromium/mini_chromium as include directories.
The following clang++ command will build and link Crashpad with the source file main.cpp:
clang++ $PROJECT_DIR/main.cpp \
$CRASHPAD_DIR/lib/libclient.a \
$CRASHPAD_DIR/lib/libutil.a \
$CRASHPAD_DIR/lib/libbase.a \
-I$CRASHPAD_DIR/include \
-I$CRASHPAD_DIR/include/third_party/mini_chromium/mini_chromium \
-o$OUT_DIR/$MODULE_NAME \
-g \
-Wl,--build-id
Please note that the order in which you specify the Crashpad libraries is important! libbase.a needs to be the last library specified otherwise clang++ will exit with an error.
Additionally, the flags -g and -Wl,--build-id are required if you want function names and line numbers when you unwind the minidump file.
A sample application built with clang++ on Ubuntu can be found here. A full tutorial for building and integrating Crashpad with your own application and using dump_syms, symupload and minidump_stackwalk, can be found here.

How to install shared library and include files manually in linux?

I am trying to build and install TBB library from source so that it can be used for OpenCV to take advantages of multiple cores on my raspberry pi.
I was able to build TBB from source without any problems using this steps.
(Source : How do I build OpenCV with TBB on Raspberry Pi?)
wget -O ~/tbb43_20150316oss_src.tgz --no-check-certificate https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb43_20150316oss_src.tgz
tar -xvzf tbb43_20150316oss_src.tgz
cd tbb43_20150316oss
make tbb CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0"
However, it's not getting detected while cmake step of building OpenCV.
Where do I add generated .so files and .h files to system paths so that cmake can detect it ?
Thanks.
Run 'make install' in the TBB source directory after running make it should install the files to the correct locations.
You can use the CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH environment variables to help CMake find your custom-built TBB by prefixing your cmake command like so:
CMAKE_INCLUDE_PATH=~/tbb43_20150611oss/include/ \
CMAKE_LIBRARY_PATH=~/tbb43_20150611oss/build/*_release/ \
cmake -DWITH_TBB=ON -DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_NEW_PYTHON_SUPPORT=ON \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DBUILD_EXAMPLES=ON ..
As a work around, I created tbb.pc file to /usr/lib/pkgconfig/.
Here is a sample of that file. https://github.com/openembedded/meta-oe/blob/master/meta-oe/recipes-support/tbb/tbb/tbb.pc
Change prefix, libdir and include dir path according to your own tbb path and you're good to go. Hope it helps.

Error while configuring glibc: Need linker with .init_array/.fini_array support

I am new to linux or LFS. I am building LFS 7.3 on virtual machine. I use Ubuntu 12.10.
For unknown reason, I can't partition the hard drive using cfdisk, so I create partition while installing the OS. I change the $LFS to /home/lost+found (the new partition).
Other than that, I followed all the tutorial in the LFS book precisely and I have successfully installed until point 5.6 in the book.
Now I am stuck at installing the first Glibc-2.17.
I use the following command to configure:
../glibc-2.17/configure \
--prefix=/tools \
--host=$LFS_TGT \
--build=$(../glibc-2.17/scripts/config.guess) \
--disable-profile \
--enable-kernel=2.6.25 \
--with-headers=/tools/include \
libc_cv_forced_unwind=yes \
libc_cv_ctors_header=yes \
libc_cv_c_cleanup=yes
I've tried to install gawk, and the error message did change. But I still got the following error when configuring:
checking for .preinit_array/.init_array/.fini_array support... no
configure: error: Need linker with .init_array/.fini_array support.
user#user:/home/lost+found/glibc-build$
What is probably wrong?
your probably trying to use bad Compiler flags -- over optimization or -fPIC or some kind of SSP/ hardening . Try the default optimization flags and see if it compiles ok
echo $CFLAGS
echo $CXXFLAGS
echo $CPPFLAGS
and examine the configparm file in your glibc build folder for your specs
It seems I forgot some special configuration for 64-bit host. I tried to install again using ubuntu 32-bit and everything works fine.

Prerequisites for gcc-4.7.2: ppl-0.11 fails to find gmp-4.3.2

I'm trying to build prerequisites for gcc-4.7.2.
Both ppl-0.11 and gmp-4.3.2 are the recommended versions in <gcc_src>/gcc-4.7.2/gcc/doc/HTML/prerequisites.html
I have built and installed gmp-4.3.2 (with --enable-cxx set)
Attempting to configure ppl-0.11 fails.
configure: error: Cannot find GMP version 4.1.3 or higher.
GMP is the GNU Multi-Precision library:
see http://www.swox.com/gmp/ for more information.
When compiling the GMP library, do not forget to enable the C++ interface:
add --enable-cxx to the configuration options.
This is my configure line:
./configure \
--prefix=$PREFIX \
--with-gmp=$PREFIX \
--with-gmp-prefix=$PREFIX \
If I look in the directory where I specified with-gmp, here is the installed gmp:
$ grep MP_VERSION $PREFIX/include/gmp*
$PREFIX/include/gmp.h:#define __GNU_MP_VERSION 4
$PREFIX/include/gmp.h:#define __GNU_MP_VERSION_MINOR 3
$PREFIX/include/gmp.h:#define __GNU_MP_VERSION_PATCHLEVEL 2
.
$ l $PREFIX/include/gmp*
$PREFIX/include/gmp.h
$PREFIX/include/gmpxx.h
.
$ l /$PREFIX/lib/libgmp*
$PREFIX/lib/libgmp.a
$PREFIX/lib/libgmp.la
$PREFIX/lib/libgmp.so -> libgmp.so.3.5.2
$PREFIX/lib/libgmp.so.3 -> libgmp.so.3.5.2
$PREFIX/lib/libgmp.so.3.5.2
$PREFIX/lib/libgmpxx.a
$PREFIX/lib/libgmpxx.la
$PREFIX/lib/libgmpxx.so -> libgmpxx.so.4.1.2
$PREFIX/lib/libgmpxx.so.4 -> libgmpxx.so.4.1.2
$PREFIX/lib/libgmpxx.so.4.1.2
Am I missing something?
As far as I can tell, GMP is available and of the requisite version
Depending on what distro you are running, have you tried to install the gmp-devel package (i.e. yum install gmp-devel on Fedora/RedHat etc)?
PPL will by default try to use default locations for GMP. If you use crosstool-ng, you must do either a cross-native or canadian-cross build. If you are doing this manually, specify CXXFLAGS to PPL's ./configure, with a -I<path-to-gmp-header> and a -Wl,-L<path-to-gmp-libs>. This allows the PPL ./configure to find the correct version of GMP.
Apparently a PPL configure with,
--prefix=$PREFIX \
--with-gmp=$PREFIX \
--with-gmp-prefix=$PREFIX \
Is not enough. I sleuthed through the ./configure script and was hacking up crosstool-ng before I realized that I was no longer building a cross-compiler, but a canadian-cross when I wasn't using my distro gcc, but another host compiler with a lower glibc shared library. This is useful if you want your compiler to run on a larger class of machines. It is unlikely that the glibc version of the build compiler will effect much.
I still had to patch 120-ppl.sh in crosstool-ng,
do_ppl_for_build() {
...
ppl_cxxflags="${CT_CFLAGS_FOR_BUILD}"
+ ppl_cxxflags+=" -I${CT_BUILDTOOLS_PREFIX_DIR}/include "
+ ppl_cxxflags+=" -Wl,-L${CT_BUILDTOOLS_PREFIX_DIR}/lib "
if [ "${CT_PPL_NEEDS_FPERMISSIVE}" = "y" ]; then
ppl_cxxflags+=" -fpermissive"
fi
So I also faced the same issue and what I did was:
1) Went inside gmp-4.3.2 folder
2) make distclean
3) ./configure --prefix=/home/sen/Documents/mingw/downloads/gmp_build --enable-cxx
4) make && make install
5) Went inside ppl-0.11 folder
6) ./configure --prefix=/home/sen/Documents/mingw/downloads/ppl_build --with-gmp-prefix=/home/sen/Documents/mingw/downloads/gmp_build --enable-cxx
7) make & make install
Took some 10-20 mins to compile and things were fine.
Thanks,
Sen
After years, the issue has been run into. The solution is firstly to download last version of gmp. Then, copy the path as in like the picture. Don't forget to ./configure with --enable-cxx, which is really important point. ./configure --enable-cxx. Now time is to ppl installation, ./configure -help indicates that --with-gmp=DIR search for libgmp/libgmpxx in DIR/include and DIR/lib. So write ./configure --with-gmp=<<dir of gmp as shown in first picture, you may have a different path>>
I wrote, respectively, ./configure --with-gmp=/usr/local/include, make, sudo make install then it works like a charm!

Make Problem in Qt for Embedded Linux Installation

I'm following this article to install qt for embedded linux on my host machine (which runs Ubuntu). So far, I successfully ./configure'd it but when I type "make" or "make install" it gives this error:
make: * No targets specified and no makefile found. Stop.
I'm a Linux newbie so I don't know if I'm missing obvious here, so I'd appreciate if you could help me.
Changing command line to this solved my problem. ./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix \ /usr/local/qt -little-endian -webkit -no-qt3support -no-cups -no-largefile \ -optimized-qmake -no-openssl -nomake tools -qt-mouse-tslib -qt-kbd-linuxinput

Resources