65,199
社区成员




#!/bin/bash
NDK=/home/sno/androidStudio/android-ndk-r6
PLATFORM=$NDK/platforms/android-9/arch-arm/
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
ANDROID23HEADER1=/home/sno/binxxx/android_source2.3.3/frameworks/base/include
ANDROID23HEADER2=/home/sno/binxxx/android_source2.3.3/system/core/include
ANDROID23HEADER3=/home/sno/binxxx/android_source2.3.3/frameworks/base/media/libstagefright
ANDROID23HEADER4=/home/sno/binxxx/android_source2.3.3/frameworks/base/
ANDROID23HEADER5=/home/sno/binxxx/android_source2.3.3/frameworks/base/include/media/stagefright/openmax
SYSROOT=$NDK/platforms/android-9/arch-arm
# Expand the prebuilt/* path into the correct one
TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86`
export PATH=$TOOLCHAIN/bin:$PATH
ANDROID_SOURCE=../android-source
ANDROID_LIBS=../android-libs
ABI="armeabi-v7a"
rm -rf ../build/stagefright
mkdir -p ../build/stagefright
DEST=../build/stagefright
FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm --cpu=armv7-a"
FLAGS="$FLAGS --sysroot=$SYSROOT"
FLAGS="$FLAGS --disable-avdevice --enable-parsers --enable-decoders --enable-demuxers --enable-network --enable-protocols --enable-protocol=file --enable-swscale --enable-swresample --enable-avformat --enable-avcodec --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-devices --disable-avdevice --disable-postproc --disable-avfilter --disable-swscale-alpha --disable-bsfs --disable-encoders --disable-muxers --disable-indevs --disable-debug --disable-doc --disable-demuxer=srt --disable-demuxer=microdvd --disable-demuxer=jacosub --disable-demuxer=dts --disable-decoder=ass --disable-decoder=srt --disable-decoder=microdvd --disable-decoder=jacosub --enable-bzlib --enable-zlib --enable-pic --enable-optimizations --disable-decoder=h264 --disable-decoder=h264_vdpau --enable-libstagefright-h264 --enable-decoder=libstagefright"
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++/include -I$NDK/sources/cxx-stl/gnu-libstdc++/libs/$ABI/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8 -L$ANDROID_LIBS -L$PLATFORM/usr/lib -rpath-link,$ANDROID_LIBS -L$NDK/sources/cxx-stl/gnu-libstdc++/libs/$ABI"
EXTRA_CXXFLAGS="-Wno-multichar -fexceptions -frtti -lstdc++ -lstlport -lcutils -lstagefright -lbinder -lc -lm -lz -ldl -llog"
DEST="$DEST/$ABI"
FLAGS="$FLAGS --prefix=$DEST"
mkdir -p $DEST
echo $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 1
#make clean
make -j4 || exit 1
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
$PREBUILT/bin/arm-linux-androideabi-ld -fexceptions -frtti -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -L$NDK/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a -L$ANDROID_LIBS -soname libffmpeg.so -shared -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o ./libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a libswresample/libswresample.a -lc -lm -lz -ldl -llog -lstdc++ -lstlport -lcutils -lstagefright -lbinder -lstdc++ -lstlport --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
---------以下是我的终端出错信息:
WARNING: arm-linux-androideabi-pkg-config not found, library detection may fail.
WARNING: Compiler does not indicate floating-point ABI, guessing soft.
libavcodec/libavcodec.a(libstagefright.o): In function `Stagefright_decode_frame(AVCodecContext*, void*, int*, AVPacket*)':
libstagefright.cpp:(.text+0x42c): undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base const*)'
libstagefright.cpp:(.text+0x488): undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
libstagefright.cpp:(.text+0x5f0): undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base const*)'
libstagefright.cpp:(.text+0x924): undefined reference to `__cxa_end_cleanup'
libavcodec/libavcodec.a(libstagefright.o): In function `decode_thread(void*)':
libstagefright.cpp:(.text+0xce4): undefined reference to `android::RefBase::decStrong(void const*) const'
libstagefright.cpp:(.text+0x1214): undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
libstagefright.cpp:(.text+0x1224): undefined reference to `std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
libavcodec/libavcodec.a(libstagefright.o): In function `CustomSource::getFormat()':
libstagefright.cpp:(.text._ZN12CustomSource9getFormatEv[_ZN12CustomSource9getFormatEv]+0x20): undefined reference to `android::RefBase::incStrong(void const*) const'
libavcodec/libavcodec.a(libstagefright.o):(.ARM.extab.text.unlikely+0x0): undefined reference to `__gxx_personality_v0'
libavcodec/libavcodec.a(libstagefright.o): In function `std::_Rb_tree<long long, std::pair<long long const, TimeStamp>, std::_Select1st<std::pair<long long const, TimeStamp> >, std::less<long long>, std::allocator<std::pair<long long const, TimeStamp> > >::_M_insert_unique(std::pair<long long const, TimeStamp> const&)':
libstagefright.cpp:(.text._ZNSt8_Rb_treeIxSt4pairIKx9TimeStampESt10_Select1stIS3_ESt4lessIxESaIS3_EE16_M_insert_uniqueERKS3_[_ZNSt8_Rb_treeIxSt4pairIKx9TimeStampESt10_Select1stIS3_ESt4lessIxESaIS3_EE16_M_insert_uniqueERKS3_]+0xd0): undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
libavcodec/libavcodec.a(libstagefright.o):(.data.rel.ro._ZTV12CustomSource[_ZTV12CustomSource]+0x10): undefined reference to `android::RefBase::onFirstRef()'
libavcodec/libavcodec.a(libstagefright.o):(.data.rel.ro._ZTV12CustomSource[_ZTV12CustomSource]+0x14): undefined reference to `android::RefBase::onLastStrongRef(void const*)'
libavcodec/libavcodec.a(libstagefright.o):(.data.rel.ro._ZTV12CustomSource[_ZTV12CustomSource]+0x18): undefined reference to `android::RefBase::onIncStrongAttempted(unsigned int, void const*)'
libavcodec/libavcodec.a(libstagefright.o):(.data.rel.ro._ZTV12CustomSource[_ZTV12CustomSource]+0x1c): undefined reference to `android::RefBase::onLastWeakRef(void const*)'
libavcodec/libavcodec.a(libstagefright.o):(.data.rel.ro._ZTI12CustomSource[_ZTI12CustomSource]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
libavcodec/libavcodec.a(libstagefright.o):(.data.rel.ro._ZTI12CustomSource[_ZTI12CustomSource]+0x8): undefined reference to `typeinfo for android::MediaSource'
libavcodec/libavcodec.a(libstagefright.o):(.data.rel.ro._ZTIN7android4ListIP5FrameEE[_ZTIN7android4ListIP5FrameEE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'