1.在ubuntu下进行的编译
2.使用的是ndk-r6版本
3.首先用ndk编译生成了libx264.a静态库
4.编译ffmpeg
shell如下:
#!/bin/bash PKG_CONFIG_PATH="/home/sfj/ffmpeg-x264/ffmpeg-0.8.1/jni/lib/pkgconfig" exportPKG_CONFIG_PATH PREBUILT=/home/sfj/ndk6/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86 PLATFORM=/home/sfj/ndk6/android-ndk-r6/platforms/android-9/arch-arm ./configure \ --cc=$PREBUILT/bin/arm-linux-androideabi-gcc\ --cross-prefix=$PREBUILT/bin/arm-linux-androideabi-\ --extra-cflags="-I/home/sfj/ffmpeg-x264/ffmpeg-0.8.1/jni/include -fPIC -DANDROID" \ --extra-ldflags="-L/home/sfj/ffmpeg-x264/ffmpeg-0.8.1/jni/lib -Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib$PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o$PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl" \ --bindir="/home/sfj/ffmpeg-x264/ffmpeg-0.8.1/jni/bin"\ --extra-libs="-ldl"\ --target-os=linux\ --arch=arm \ --enable-version3\ --enable-gpl \ --enable-nonfree\ --disable-stripping\ --disable-ffmpeg\ --disable-ffplay\ --disable-ffserver\ --disable-ffprobe\ --enable-muxers\ --disable-devices\ --disable-protocols\ --enable-protocol=file\ --enable-libx264\ --enable-encoder=libx264\ --enable-decoder=h264\ --enable-avfilter\ --enable-network\ --enable-avdevice\ --disable-asm \ --enable-cross-compile\ --strip=$PREBUILT/bin/arm-linux-androideabi-strip\
shell结束 5.运行config.sh的时候,log如下: BEGIN/tmp/ffconf.ipMEIwvE.c 1 #include<x264.h> 2 intx;END/tmp/ffconf.ipMEIwvE.c/home/sfj/ndk6/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600-I/home/sfj/ffmpeg-x264/ffmpeg-0.8.1/jni/include -fPIC -DANDROID -std=c99-fomit-frame-pointer -marm -E -o /tmp/ffconf.fvEcZ5qx.o /tmp/ffconf.ipMEIwvE.cIn file includedfrom /tmp/ffconf.ipMEIwvE.c:1:/home/sfj/ffmpeg-x264/ffmpeg-0.8.1/jni/include/x264.h:36:4:warning: #warning You must include stdint.h or inttypes.h before x264.hcheck_funcx264_encoder_encode_open -lx264check_ld -lx264check_ccBEGIN/tmp/ffconf.ipMEIwvE.c 1 externint x264_encoder_encode_open(); 2 intmain(void){ x264_encoder_encode_open(); }END/tmp/ffconf.ipMEIwvE.c/home/sfj/ndk6/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I/home/sfj/ffmpeg-x264/ffmpeg-0.8.1/jni/include-fPIC -DANDROID -std=c99 -fomit-frame-pointer -marm -c -o/tmp/ffconf.fvEcZ5qx.o /tmp/ffconf.ipMEIwvE.c/home/sfj/ndk6/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc-L/home/sfj/ffmpeg-x264/ffmpeg-0.8.1/jni/lib-Wl,-T,/home/sfj/ndk6/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x-Wl,-rpath-link=/home/sfj/ndk6/android-ndk-r6/platforms/android-9/arch-arm/usr/lib-L/home/sfj/ndk6/android-ndk-r6/platforms/android-9/arch-arm/usr/lib -nostdlib/home/sfj/ndk6/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o/home/sfj/ndk6/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o-lc -lm -ldl -Wl,--as-needed -o /tmp/ffconf.OaCCfh2T /tmp/ffconf.fvEcZ5qx.o-lx264 -ldl/home/sfj/ndk6/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld:warning: cannot find entry symbol _start; defaulting to 00008384/tmp/ffconf.fvEcZ5qx.o:In function `main':ffconf.ipMEIwvE.c .text+0x4):undefined reference to `x264_encoder_encode_open'collect2: ldreturned 1 exit statusERROR: libx264not found
希望大牛给指点一下
|