我試圖爲所有體系結構(包括64位)編譯lib。 我創建的腳本適用於armeabi,armeabi-v7a,arm64-v8a和x86。 它失敗了mips,並可能會失敗的mips64以及,但我不關心他們;它是次要的,我有主要問題:我關心x86_64,這個不會編譯。爲Android x86_64編譯libav
編輯:x86也失敗了。在帖子結尾編譯錯誤日誌。
下面是該腳本:
- 創建一個獨立的工具鏈:就像一個魅力
- 使用該工具鏈配置的lib:
./configure --arch=x86_64 --cpu=x86_64 --cross-prefix=/some/path/usingLibAV/toolchains/x86_64/bin/x86_64-linux-android- --target-os=android --sysroot="/some/path/Library/Android/ndk/platforms/android-21/arch-x86_64/" --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 -march=atom -ffast-math -msse3 -mfpmath=sse " --extra-ldflags="-Wl,-rpath-link=/some/path/Library/Android/ndk/platforms/android-21/arch-x86_64//usr/lib -L/some/path/Library/Android/ndk/platforms/android-21/arch-x86_64//usr/lib -nostdlib -lc -lm" --enable-shared --disable-symver
這似乎配置好,config.log不會引發任何錯誤,除了下面的警告(無論如何我都會得到這個警告):
WARNING: /some/path/Documents/usingLibAV/toolchains/x86_64/bin/x86_64-linux-android-pkg-config not found, library detection may fail.
- compile:make -j 8.我得到.so文件正確生成,但如果我仔細看看日誌,我會在最後得到錯誤(對不起,噸粘貼整個日誌,它是長):
CC libswscale/yuv2rgb.o AR libavformat/libavformat.a YASM libswscale/x86/scale.o AR libavcodec/libavcodec.a AR libavresample/libavresample.a AR libavutil/libavutil.a CC avconv.o CC cmdutils.o CC avconv_opt.o CC avconv_filter.o CC avprobe.o HOSTCC doc/print_options.o AR libavdevice/libavdevice.a LD libavutil/libavutil.so.54 AR libavfilter/libavfilter.a /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libc.so while searching for c /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libz.so while searching for z LD libavresample/libavresample.so.2 /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libc.so while searching for c /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libz.so while searching for z LD libavcodec/libavcodec.so.56 HOSTLD doc/print_options GENTEXI doc/avoptions_format.texi GENTEXI doc/avoptions_codec.texi POD doc/avprobe.pod POD doc/avconv.pod MAN doc/avprobe.1 MAN doc/avconv.1 /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libc.so while searching for c /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libz.so while searching for z LD libavformat/libavformat.so.56 /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libc.so while searching for c /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libz.so while searching for z LD libavdevice/libavdevice.so.55 /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libc.so while searching for c /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libz.so while searching for z LD libswscale/libswscale.so.3 AR libswscale/libswscale.a /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libc.so while searching for c /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libz.so while searching for z LD libavfilter/libavfilter.so.5 /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libc.so while searching for c /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libz.so while searching for z LD avconv LD avprobe /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libc.so while searching for c /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libz.so while searching for z libavcodec/libavcodec.so: error: undefined reference to '__powidf2' collect2: error: ld returned 1 exit status make: * [avprobe] Error 1 make: * Waiting for unfinished jobs.... /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libc.so while searching for c /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libm.so while searching for m /Volumes/diskE/some/path/usingLibAV/toolchains/x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld: warning: skipping incompatible /some/pathLibrary/Android/ndk/platforms/android-21/arch-x86_64//usr/lib/libz.so while searching for z libavcodec/libavcodec.so: error: undefined reference to '__powidf2' collect2: error: ld returned 1 exit status make: *** [avconv] Error 1
錯誤編譯86,與配置後:的./configure --arch = 86 --cpu = 86 --cross前綴= /一些/ path/Documents/usingLibAV/toolchains/x86/bin/i686-linux-android- --target-os = android --sysroot =「/ some/path/Library/Android/ndk/platforms/android-9/arch- x86 /「--extra-cflags =」-O3 -fpic -DANDROID -DHAVE_SYS_UIO_H = 1 -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing - finline-limit = 300 -march = atom -fast-math -msse3 -mfpmath = sse「--extra-ldflags =」 - Wl,-rpath-link =/some/path/Library/Android/ndk/platforms/android- 9/arch-x86 // usr/lib -L / some/path/Library/Android/ndk/platforms/android-9/arch-x86 // usr/lib -nostdlib -lc -lm「--enable-shared
^
CC libswscale/x86/yuv2rgb.o
CC libswscale/yuv2rgb.o
AR libavformat/libavformat.a
YASM libswscale/x86/scale.o
AR libavcodec/libavcodec.a
AR libavresample/libavresample.a
AR libavutil/libavutil.a
CC avconv.o
CC cmdutils.o
CC avconv_opt.o
CC avconv_filter.o
CC avprobe.o
HOSTCC doc/print_options.o
AR libavdevice/libavdevice.a
LD libavutil/libavutil.so.54
AR libavfilter/libavfilter.a
HOSTLD doc/print_options
LD libavresample/libavresample.so.2
GENTEXI doc/avoptions_format.texi
GENTEXI doc/avoptions_codec.texi
POD doc/avprobe.pod
POD doc/avconv.pod
LD libavcodec/libavcodec.so.56
MAN doc/avprobe.1
MAN doc/avconv.1
LD libavformat/libavformat.so.56
LD libavdevice/libavdevice.so.55
LD libswscale/libswscale.so.3
AR libswscale/libswscale.a
LD libavfilter/libavfilter.so.5
LD avconv
LD avprobe
libavdevice/libavdevice.so: error: undefined reference to '__divdi3'
libavdevice/libavdevice.so:libavdevice/libavdevice.so: errorerror: undefined reference to ': __moddi3'
libavformatundefined reference to '__moddi3'
libavformat/libavformat.so/libavformat.so: error: undefined reference: error to : undefined'__udivdi3' reference to '__udivdi3'
libavformat/
libavformat/libavformat.so: errorlibavformat.so: error: : undefined reference undefined referenceto ' to '__umoddi3'
libavcodec/__umoddi3'
libavcodec.so: errorlibavcodec/: libavcodec.so: error: undefined reference to '__powidf2'
avconv.c:1434: error: undefined referenceundefined reference to '__powidf2 to '
'__divdi3'
avconv.c:1441: error: undefined reference to '__divdi3'
avconv.c:1434: error: undefined reference to '__divdi3'
avconv.c:1441: error: undefined reference to '__divdi3'
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make: *** [avprobe] Error 1
make: *** Waiting for unfinished jobs....
make: *** [avconv] Error 1
感謝您的快速回復。你是對的,我用--cross-prefix作爲其他曲拱。但在我看來,我也是爲x86_64做的:--cross-prefix =/some/path/usingLibAV/toolchains/x86_64/bin/x86_64-linux-android-或者我想念你的觀點? – user2346922
噢,對不起,我不知何故錯過了你的使用(特別是當這篇文章的原始版本討論了你的主機系統編譯器的版本時)。我試過你的命令行,然後用一個實際可行的解決方案編輯答案。 – mstorsjo
它適用於x86,x86_64甚至mips!謝謝 !然而,編譯時我仍然得到mips64的錯誤: /var/folders/pk/x0zcs6n571372r3x0yq38pfc0005y7/T//ccel6m70.s:彙編信息: /var/folders/pk/x0zcs6n571372r3x0yq38pfc0005y7/T//ccel6m70.s:96:錯誤:此處理器不支持opcode:mips64r6(mips64r6)'lwl $ 4,3($ 2)'有什麼想法? – user2346922