首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何为AFLGo编译libav

如何为AFLGo编译libav
EN

Stack Overflow用户
提问于 2020-06-13 17:42:27
回答 1查看 237关注 0票数 1

我需要用AFLGO编译libav库。

代码语言:javascript
复制
cd ~
export AFLGO=$PWD/aflgo
cd path/to/libav/folder
export SUBJECT=$PWD; export TMP_DIR=$PWD/obj-aflgo/temp
export CC=$AFLGO/afl-clang-fast
export CXX=$AFLGO/afl-clang-fast++
export COPY_CFLAGS=$CFLAGS
export COPY_CXXFLAGS=$CXXFLAGS
export ADDITIONAL="-targets=$TMP_DIR/BBtargets.txt -outdir=$TMP_DIR -flto -fuse-ld=gold -Wl,-plugin-opt=save-temps"
export CFLAGS="$CFLAGS $ADDITIONAL"
export CXXFLAGS="$CXXFLAGS $ADDITIONAL"
export LDFLAGS=-lpthread

./configure

它返回:

代码语言:javascript
复制
gcc is unable to create an executable file.
If gcc is a cross-compiler, use the --enable-cross-compile option.
Only do this if you know what cross compiling means.
C compiler test failed.

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
libav-tools@libav.org mailing list or IRC #libav on irc.freenode.net.
Include the log file "avbuild/config.log" produced by configure as this will help
solving the problem.

我已经检查了config.log,但这似乎没有什么用处,这是最后一行:

代码语言:javascript
复制
....
gcc -targets=/home/ubuntu16/Documents/github-repos/libav/obj-aflgo/temp/BBtargets.txt -outdir=/home/ubuntu16/Documents/$
gcc: error: unrecognized command line option '-targets=/home/ubuntu16/Documents/github-repos/libav/obj-aflgo/temp/BBtar$
C compiler test failed.

为什么这又要和gcc一起编译呢?我想用AFLGo fuzzer来测试它。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-06-18 06:39:08

首先,您应该显式地指定编译器和标志如下:

代码语言:javascript
复制
./configure --cc=$CC --enable-lto --extra-ldflags="-flto -fuse-ld=gold -Wl,-plugin-opt=save-temps"

否则,您无法使用AFLGo编译libav。

如果您想知道其他配置标志,请尝试./confiure --help

但是,在我尝试之后,libav无法用LTO (即-flto)编译,因为libav包含一些asm指令,而LLVM (clang)不能将其转换为IR,这会在链接时导致undefined reference等错误。

代码语言:javascript
复制
CC      libavutil/xtea.o
AR      libavfilter/libavfilter.a
AR      libavcodec/libavcodec.a
AR      libavresample/libavresample.a
AR      libswscale/libswscale.a
AR      libavutil/libavutil.a
LD      avconv
avconv.o:ld-temp.o:function decode_nal_unit: error: undefined reference to 'ff_h264_cabac_tables'
avconv.o:ld-temp.o:function decode_nal_unit: error: undefined reference to 'ff_h264_cabac_tables'
avconv.o:ld-temp.o:function decode_nal_unit: error: undefined reference to 'ff_h264_cabac_tables'
avconv.o:ld-temp.o:function decode_nal_unit: error: undefined reference to 'ff_h264_cabac_tables'
avconv.o:ld-temp.o:function put_vc1_mspel_mc01_mmx: error: undefined reference to 'ff_pw_53'
avconv.o:ld-temp.o:function put_vc1_mspel_mc03_mmx: error: undefined reference to 'ff_pw_53'
avconv.o:ld-temp.o:function put_vc1_mspel_mc10_mmx: error: undefined reference to 'ff_pw_53'
avconv.o:ld-temp.o:function put_vc1_mspel_mc11_mmx: error: undefined reference to 'ff_pw_53'
avconv.o:ld-temp.o:function put_vc1_mspel_mc11_mmx: error: undefined reference to 'ff_pw_128'
avconv.o:ld-temp.o:function put_vc1_mspel_mc11_mmx: error: undefined reference to 'ff_pw_128'
avconv.o:ld-temp.o:function put_vc1_mspel_mc12_mmx: error: undefined reference to 'ff_pw_128'
avconv.o:ld-temp.o:function put_vc1_mspel_mc12_mmx: error: undefined reference to 'ff_pw_128'
avconv.o:ld-temp.o:function put_cavs_qpel16_mc01_3dnow: error: undefined reference to 'ff_pw_42'
avconv.o:ld-temp.o:function put_cavs_qpel16_mc01_3dnow: error: undefined reference to 'ff_pw_42'
avconv.o:ld-temp.o:function put_cavs_qpel16_mc01_3dnow: error: undefined reference to 'ff_pw_42'
avconv.o:ld-temp.o:function put_cavs_qpel16_mc01_3dnow: error: undefined reference to 'ff_pw_42'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_bgr2YCoeff'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_w1111'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_bgr2YOffset'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_bgr2YCoeff'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_w1111'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_bgr2YOffset'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_w1111'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_bgr2UCoeff'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_bgr2VCoeff'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_bgr2VCoeff'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_w1111'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_bgr2VCoeff'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_bgr2VCoeff'
avconv.o:ld-temp.o:function rgb24toyv12_mmx: error: undefined reference to 'ff_bgr2UVOffset'
avconv.o:ld-temp.o:function rgb24toyv12_3dnow: error: undefined reference to 'ff_bgr2YCoeff'
avconv.o:ld-temp.o:function rgb24toyv12_3dnow: error: undefined reference to 'ff_bgr2YOffset'
avconv.o:ld-temp.o:function rgb24toyv12_3dnow: error: undefined reference to 'ff_bgr2YCoeff'
avconv.o:ld-temp.o:function rgb24toyv12_3dnow: error: undefined reference to 'ff_bgr2YOffset'
avconv.o:ld-temp.o:function rgb24toyv12_3dnow: error: undefined reference to 'ff_bgr2UCoeff'
avconv.o:ld-temp.o:function rgb24toyv12_3dnow: error: undefined reference to 'ff_bgr2UVOffset'
avconv.o:ld-temp.o:function rgb24toyv12_mmxext: error: undefined reference to 'ff_bgr2UCoeff'
avconv.o:ld-temp.o:function rgb24toyv12_mmxext: error: undefined reference to 'ff_bgr2UVOffset'
avconv.o:ld-temp.o:function yuv2bgr24_X_ar_mmxext: error: undefined reference to 'ff_M24A'
avconv.o:ld-temp.o:function yuv2bgr24_X_ar_mmxext: error: undefined reference to 'ff_M24C'
avconv.o:ld-temp.o:function yuv2bgr24_X_ar_mmxext: error: undefined reference to 'ff_M24B'
avconv.o:ld-temp.o:function yuv2bgr24_X_ar_mmxext: error: undefined reference to 'ff_M24B'
avconv.o:ld-temp.o:function yuv2bgr24_X_mmxext: error: undefined reference to 'ff_M24A'
avconv.o:ld-temp.o:function yuv2bgr24_X_mmxext: error: undefined reference to 'ff_M24C'
avconv.o:ld-temp.o:function yuv2bgr24_X_mmxext: error: undefined reference to 'ff_M24B'
avconv.o:ld-temp.o:function yuv2bgr24_X_mmxext: error: undefined reference to 'ff_M24B'
avconv.o:ld-temp.o:function yuv2bgr24_1_mmxext: error: undefined reference to 'ff_M24A'
avconv.o:ld-temp.o:function yuv2bgr24_1_mmxext: error: undefined reference to 'ff_M24C'
avconv.o:ld-temp.o:function yuv2bgr24_1_mmxext: error: undefined reference to 'ff_M24A'
avconv.o:ld-temp.o:function yuv2bgr24_1_mmxext: error: undefined reference to 'ff_M24C'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

,因此您不能使用AFLGo构建libav,因为LLVM (clang)存在缺陷。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62363543

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档