[英]FFMpeg compilation error “Undefined symbols for architecture x86_64”
[英]FFmpeg cross compile for Android fails with on C compiler test for x86_64
我正在嘗試與NDK r16b交叉編譯Android版FFmpeg,我已經設法在x86_64以外的所有平台上進行編譯。
這是我的編譯腳本
#!/bin/bash
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--enable-pic \
--enable-small \
--disable-programs \
--disable-symver \
--target-os=android \
--enable-cross-compile \
--cross-prefix=$CROSS_PREFIX \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
--sysroot=$TOOLCHAIN/sysroot $ADDITIONAL_CONFIG_FLAG \
--disable-all --disable-autodetect --disable-network --enable-pthreads \
--enable-protocol=file --enable-protocol=pipe --enable-protocol=concat \
--disable-all --disable-autodetect --disable-network --enable-pthreads \
--enable-avcodec --enable-avformat --enable-swresample --enable-avfilter --enable-filter=aresample \
--enable-parser=aac --enable-parser=aac_latm --enable-parser=flac --enable-parser=mpegaudio --enable-parser=vorbis \
--enable-muxer=mp3,wav --enable-encoder=pcm*,libmp3lame --enable-nonfree --enable-gpl \
--enable-jni --enable-mediacodec --enable-libmp3lame
make -j4
make install
make distclean
}
HOME_PATH=/home/nll/Desktop
CPU=x86_64
TOOLCHAIN=$HOME_PATH/my_toolchains/x86_64
CROSS_PREFIX=$TOOLCHAIN/bin/x86_64-linux-android-
mkdir -p $(pwd)/android/$CPU
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-march=x86-64 -I$INCLUDE_PATH"
ADDI_LDFLAGS="-shared -L$LIBS_PATH"
ADDITIONAL_CONFIG_FLAG="--arch=x86_64 --enable-x86asm"
build_one
上面的腳本失敗了
WARNING: /home/nll/Desktop/my_toolchains/x86_64/bin/x86_64-linux-android-pkg-config not found, library detection may fail.
mktemp -u XXXXXX
5ZpQya
test_ld cc
test_cc
BEGIN /tmp/ffconf.KWqViHoN/test.c
1 int main(void){ return 0; }
END /tmp/ffconf.KWqViHoN/test.c
/home/nll/Desktop/my_toolchains/x86_64/bin/x86_64-linux-android-gcc --sysroot=/home/nll/Desktop/my_toolchains/x86_64/sysroot -Os -fpic -march=x86-64 -I -c -o /tmp/ffconf.KWqViHoN/test.o /tmp/ffconf.KWqViHoN/test.c
/home/nll/Desktop/my_toolchains/x86_64/bin/x86_64-linux-android-gcc -shared -L --sysroot=/home/nll/Desktop/my_toolchains/x86_64/sysroot -o /tmp/ffconf.KWqViHoN/test /tmp/ffconf.KWqViHoN/test.o
/home/nll/Desktop/my_toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: error: /tmp/ffconf.KWqViHoN/test.o: unsupported ELF file type 2
collect2: error: ld returned 1 exit status
C compiler test failed.
因此,錯誤是“不支持的ELF文件類型2”,這意味着64位。 但是,無論如何,我正在嘗試構建64位庫。
我不明白這里的問題是什么。 誰能給我一些指導?
第一個命令行包含-I -c
。 這意味着將目錄-c
添加到包含路徑,並且該命令執行完整的鏈接,而不僅僅是編譯和匯編。 結果是一個可執行文件,它是ET_EXEC
對象(類型2),因此是最終錯誤消息。 (這與64位二進制文件無關。)
設置包含路徑時出錯。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.