Static linking library asan with gcc 4.8

4.1k views Asked by At

I'm compiling my test executable in this way using gcc 4.8.3:

gcc -o test -g -L/lib64 -fsanitize=address -static-libasan

Result:

/usr/bin/ld: cannot find -lasan
collect2: error: ld returned 1 exit status

Libasan is installed and if I compile without the static option it works. How can I compile the library statically?

1

There are 1 answers

0
yugr On BEST ANSWER

You need to install special package to get static GCC libraries. On Ubuntu you should do

$ sudo apt-get install libgcc-4.8-dev