Recently spent a day to ffmpeg/tools/build_stagefright implementation success, mainly cross-compiling the need for a variety of dynamic library support is not linked, resulting in various error, basically the network asked questions I have met, hereby recorded.
Compilation environment: Ubuntu 14.04 + Android NDK + ffmpeg source.
First step: Move Ffmpeg/tools/build_stagefright to FFmpeg, modify execute permissions.
chmod u+x build_stagefright
Step Two: Open the Build_stagefright file and configure the Android NDK path.
#!/bin/bash export NDK=/to/your/ndk/pathif"$NDK"" then echo ndk variable not set, assuming ${home}/android-ndk-r8d export NDK =${home}/android-ndk-r8d fi
Step three: Build_stagefright in the http://download.cyanogenmod.com/get/ Update-cm-7.0.3-n1-signed.zip failed, so you have to manually download the Update-cm-7.0.3-n1-signed.zip, with a downloadable address http://sourceforge.net/ Projects/nexusoneandroid/files/update-cm-7.0.3-n1-signed.zip/stats/timeline
Fourth step: Modify toolchain= ' echo $NDK/toolchains/arm-linux-androideabi-4.3.3/prebuilt/*-x86 ' for toolchain= ' echo $NDK/ Toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64 ', otherwise it will appear ARM-LINUX-ANDROIDEABI-GCC is unable to create An executable file. C compiler test failed. Such a mistake
Fifth Step: Vim Configure change enabled libstagefright_h264 && require_cpp libstagefright_h264 to Enabled Libstagefright & ;& require_cpp libstagefright_h264, otherwise error:libstagefright_h264 not found will appear
Sixth step: The Build_stagefright in the extra_cflags= "$EXTRA _cflags-i$ndk/sources/cxx-stl/gnu-libstdc++/include-i$ndk/sources/ cxx-stl/gnu-libstdc++/libs/$ABI/include "to extra_cflags=" $EXTRA _cflags-i$ndk/sources/cxx-stl/gnu-libstdc++/4.8/ include-i$ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/$ABI/include "
Seventh step: The extra_ldflags= in Build_stagefright "-wl,--fix-cortex-a8-l$android_libs-wl,-rpath-link, $ANDROID _libs-l$ndk/ sources/cxx-stl/gnu-libstdc++/libs/$ABI "Change to extra_ldflags="-wl,--fix-cortex-a8-l$android_libs-wl,-rpath-link,$ android_libs-l$ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/$ABI "
Eighth step: The extra_ldflags= in Build_stagefright "-wl,--fix-cortex-a8-l$android_libs-wl,-rpath-link, $ANDROID _libs-l$ndk/ sources/cxx-stl/gnu-libstdc++/libs/$ABI "continue to modify the external libraries required to add cross-compilation. The final modification is:
extra_ldflags= "-wl,--fix-cortex-a8-l$android_libs-wl,-rpath-link, $ANDROID _libs-l$ndk/sources/cxx-stl/ gnu-libstdc++/4.8/libs/$ABI-lstagefright-lstdc++-lutils-lbinder-lgnustl_static-lgnustl_shared "
The eighth step solves the problem caused by most cross-compilation without linking the corresponding library.
The final modified build_stagefright content is as follows:
#!/bin/Bashexport NDK=$ANDROID _NDKif["$NDK"=""]; Then EchoNDK variable not set, assuming ${home}/android-NDK Export NDK=${home}/android-NDKfiEcho "fetching Android System headers"git clone--depth=1--branch gingerbread-release git://Github.com/cyanogenmod/android_frameworks_base.git. /android-source/frameworks/basegit clone--depth=1--branch gingerbread-release git://Github.com/cyanogenmod/android_system_core.git. /android-source/system/coreEcho "fetching Android libraries for linking"# Libraries from any Froyo/gingerbread device/emulator should work# fine, since the symbols used should is available on most of them.if[!-D".. /android-libs"]; Then if[!-F".. /update-cm-7.0.3-n1-signed.zip"]; Then wgethttp//download.cyanogenmod.com/get/update-cm-7.0.3-n1-signed.zip-p. / fi Unzip.. /update-cm-7.0.3-n1-signed.ZipSystem/lib/* -D: /MV.. /system/lib. /android-libs rmdir. /systemfisysroot= $NDK/platforms/android-9/arch-arm# Expand The prebuilt/* path into the correct onetoolchain= ' echo $NDK /toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64 ' Export path= $TOOLCHAIN/bin: $PATHANDROID _source=. /android-sourceandroid_libs=. /android-libsabi= "armeabi-v7a" RM-RF. /build/stagefrightmkdir-p. /build/stagefrightdest=. /build/stagefrightflags= "--target-os=linux--cross-prefix=arm-linux-androideabi---arch=arm--cpu=armv7-a" FLAGS= " $FLAGS--sysroot= $SYSROOT "flags=" $FLAGS--disable-avdevice--disable-decoder=h264--disable-decoder=h264_vdpau-- enable-libstagefright-h264 "extra_cflags="-i$android_source/frameworks/base/include-i$android_source/system/ Core/include "extra_cflags=" $EXTRA _cflags-i$android_source/frameworks/base/media/libstagefright "EXTRA_CFLAGS=" $ Extra_cflags-i$android_source/frameworks/base/include/media/stagefright/openmax "EXTRA_CFLAGS=" $EXTRA _cflags-i$ ndk/sources/cxx-stl/gnu-libstdc++/4.8/include-i$ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/$ABI/include "extra_cflags=" $EXTRA _cflags-march=armv7-a- Mfloat-abi=softfp-mfpu=neon "extra_ldflags="-wl,--fix-cortex-a8-l$android_libs-wl,-rpath-link, $ANDROID _libs-l$ ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/$ABI-lstagefright-lstdc++-lutils-lbinder-lgnustl_static-lgnustl_ Shared "#EXTRA_LDFLAGS =" $EXTRA _ldflags-lcutils-ldl-lstlport-lc-lm-lz-ldl-llog-lstdc++-lstagefright-lbinder-lst lport-lstdc++-lstl "extra_cxxflags="-wno-multichar-fno-exceptions-fno-rtti "dest=" $DEST/$ABI "FLAGS=" $FLAGS-- prefix= $DEST "mkdir-p $DESTecho $FLAGS--extra-cflags=" $EXTRA _cflags "--extra-ldflags=" $EXTRA _ldflags "-- extra-cxxflags= "$EXTRA _cxxflags" > $DEST/info.txt./configure $FLAGS--extra-cflags= "$EXTRA _cflags"-- extra-ldflags= "$EXTRA _ldflags"--extra-cxxflags= "$EXTRA _cxxflags" | Tee $DEST/configuration.txt[$PIPESTATUS = = 0] | | Exit 1make Cleanmake-j4 | | Exit 1
The Nineth step, execute./build_stagefright compile, the final output of the following content is the compilation success:
CC ffprobe.occ Ffserver.oar libavfilter/Libavfilter.aar Libavformat/Libavformat.aar Libavcodec/Libavcodec.aar libswresample/Libswresample.aar Libswscale/Libswscale.aar Libavutil/Libavutil.ahostld Doc/Print_optionsgentexi Doc/Avoptions_format.texigentexi Doc/avoptions_codec.texipod Doc/ffmpeg.podpod Doc/ffprobe.podpod Doc/ffserver.podpod Doc/ffmpeg-all.podpod Doc/ffprobe-all.podpod Doc/ffserver-all.podpod Doc/ffmpeg-utils.podpod Doc/ffmpeg-scaler.podpod Doc/ffmpeg-resampler.podpod Doc/ffmpeg-codecs.podpod Doc/ffmpeg-bitstream-filters.podpod Doc/ffmpeg-formats.podpod Doc/ffmpeg-protocols.podpod Doc/ffmpeg-filters.podpod Doc/libavutil.podpod Doc/libswscale.podpod Doc/libswresample.podpod Doc/libavcodec.podpod Doc/libavformat.podpod Doc/Libavfilter.podman Doc/ffmpeg.1Man Doc/ffprobe.1Man Doc/ffserver.1Man Doc/ffmpeg-all.1Man Doc/ffprobe-all.1Man Doc/ffserver-all.1Man Doc/ffmpeg-utils.1Man Doc/ffmpeg-scaler.1Man Doc/ffmpeg-resampler.1Man Doc/ffmpeg-codecs.1Man Doc/ffmpeg-bitstream-filters.1Man Doc/ffmpeg-formats.1Man Doc/ffmpeg-protocols.1Man Doc/ffmpeg-filters.1Man Doc/libavutil.3Man Doc/libswscale.3Man Doc/libswresample.3Man Doc/libavcodec.3Man Doc/libavformat.3Man Doc/libavfilter.3LD ffmpeg_gld ffprobe_gld ffserver_gcp ffprobecp ffmpegstrip ffprobestrip FFMPEGCP Ffserverst RIP Ffserver
[Original]ffmpeg compiled Android hard decode support library Libstagefright