为 Android x86_64 编译 libav
Compile libav for Android x86_64
我正在尝试为所有体系结构编译库,包括 64 位。
我创建的脚本适用于 armeabi、armeabi-v7a、arm64-v8a 和 x86。
它对 mips 失败,并且可能对 mips64 也会失败,但我不太关心它们;它是我遇到的主要问题的次要问题:我关心 x86_64,而这个不会编译。
EDIT :x86 也失败了。 post.
末尾的编译错误日志
这是脚本的作用:
- 创建一个独立的工具链:很有魅力
- 使用该工具链配置库:
./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 文件,但是如果我用 closer 查看日志,我在最后得到错误(抱歉我不能粘贴整个日志,它太长了):
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
x86 编译错误,配置后:./configure --arch=x86 --cpu=x86 --cross-prefix=/some/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 -ffast-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
或 --cc
,这意味着它将使用您的主机系统编译器 (OS X) 为 android 编译 -这实际上只有在它尝试 link 到 android 库时才会失败。
要真正使这项工作按预期进行,请将 --cross-prefix=x86_64-linux-android-
添加到您的配置行。 (我假设你做了一些这样的事情,让它也适用于其他架构。)
编辑:我看错了,你确实供应 --cross-prefix
就好了。
删除所有 --extra-cflags
和 --extra-ldflags
- 它们是多余且相互冲突的。如果您对它们中的任何一个有具体的需求或案例,那么您可以重新考虑添加一些单独的标志,但其中大部分都是多余的。在这种情况下,指向您的 sysroot 的 lib 目录的 -L
选项似乎导致了您的问题 - 通过 --sysroot
设置它已经足够了,-L
和 -Wl,-rpath-link
是只是多余的。
一般来说,不要盲目地添加大量选项 - 对于编译器选项而言,越多越好。仅添加您具体了解并知道您需要的那些。
如果您使用 --target-os=android
,则不需要 --disable-symver
- 该选项仅在 android 作为 --target-os
的单独值添加之前才需要。
我正在尝试为所有体系结构编译库,包括 64 位。 我创建的脚本适用于 armeabi、armeabi-v7a、arm64-v8a 和 x86。 它对 mips 失败,并且可能对 mips64 也会失败,但我不太关心它们;它是我遇到的主要问题的次要问题:我关心 x86_64,而这个不会编译。
EDIT :x86 也失败了。 post.
末尾的编译错误日志这是脚本的作用:
- 创建一个独立的工具链:很有魅力
- 使用该工具链配置库:
./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 文件,但是如果我用 closer 查看日志,我在最后得到错误(抱歉我不能粘贴整个日志,它太长了):
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
x86 编译错误,配置后:./configure --arch=x86 --cpu=x86 --cross-prefix=/some/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 -ffast-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
或 --cc
,这意味着它将使用您的主机系统编译器 (OS X) 为 android 编译 -这实际上只有在它尝试 link 到 android 库时才会失败。
要真正使这项工作按预期进行,请将 --cross-prefix=x86_64-linux-android-
添加到您的配置行。 (我假设你做了一些这样的事情,让它也适用于其他架构。)
编辑:我看错了,你确实供应 --cross-prefix
就好了。
删除所有 --extra-cflags
和 --extra-ldflags
- 它们是多余且相互冲突的。如果您对它们中的任何一个有具体的需求或案例,那么您可以重新考虑添加一些单独的标志,但其中大部分都是多余的。在这种情况下,指向您的 sysroot 的 lib 目录的 -L
选项似乎导致了您的问题 - 通过 --sysroot
设置它已经足够了,-L
和 -Wl,-rpath-link
是只是多余的。
一般来说,不要盲目地添加大量选项 - 对于编译器选项而言,越多越好。仅添加您具体了解并知道您需要的那些。
如果您使用 --target-os=android
,则不需要 --disable-symver
- 该选项仅在 android 作为 --target-os
的单独值添加之前才需要。