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?
You need to install special package to get static GCC libraries. On Ubuntu you should do
$ sudo apt-get install libgcc-4.8-dev