Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configuration for libav #69

Closed
meweez opened this issue Jun 15, 2020 · 6 comments
Closed

configuration for libav #69

meweez opened this issue Jun 15, 2020 · 6 comments

Comments

@meweez
Copy link

meweez commented Jun 15, 2020

Hello

I need to compile libav library with AFLGO. I have used these commands:

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

it returns:

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.

I have checked config.log but it doesn't seem useful, these are the last lines:

....
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.

why does this try compile it with gcc again? I want to instrument it with AFLGo fuzzer.

Regards

@strongcourage
Copy link
Collaborator

First, make sure that you can compile libav with gcc.

mkdir obj; cd obj
../configure --disable-shared --prefix=`pwd`
make

Then, try to manually set variables CC, CXX ...

CC=$AFLGO/afl-clang-fast CXX= CFLAGS= ../configure --disable-shared --prefix=`pwd`

Best.

@meweez
Copy link
Author

meweez commented Jun 15, 2020

I'm sure that I can compile libav with gcc but again previous error for these commands:

pushd ~
export AFLGO=$PWD/aflgo
popd
export SUBJECT=$PWD; export TMP_DIR=$PWD/obj-aflgo/temp
export ADDITIONAL="-targets=$TMP_DIR/BBtargets.txt -outdir=$TMP_DIR -flto -fuse-ld=gold -Wl,-plugin-opt=save-temps"

CC=$AFLGO/afl-clang-fast CXX=$AFLGO/afl-clang-fast++ COPY_CFLAGS=$CFLAGS COPY_CXXFLAGS=$CXXFLAGS CFLAGS="$ADDITIONAL" CXXFLAGS="$ADDITIONAL" ./configure --disable-shared --prefix=`pwd`
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.

@strongcourage
Copy link
Collaborator

Please give me some more info like version (commit) and your BBtargets so that I can try on my computer. Thanks.

@meweez
Copy link
Author

meweez commented Jun 16, 2020

this is my BBtargets.txt:

libavformat/dv.c:133
libavformat/dv.c:134
libavformat/dv.c:135
libavformat/dv.c:136
libavformat/dv.c:137

and I'm in head commit:
commit hash = c4642788e83b0858bca449f9b6e71ddb015dfa5d

@strongcourage
Copy link
Collaborator

I can compile libav. Please use the following commands:

mkdir obj-aflgo; cd obj-aflgo
export ADDITIONAL="-targets=$TMP_DIR/BBtargets.txt -outdir=$TMP_DIR -flto -fuse-ld=gold -Wl,-plugin-opt=save-temps"
../configure --disable-shared --prefix=`pwd` --cc=$AFLGO/afl-clang-fast --host-cflags="$ADDITIONAL" --disable-doc

For more information: configure --help. Best.

@strongcourage
Copy link
Collaborator

Feel free to open the issue if you have any further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants