静态链接库asan与gcc 4.8

静态链接库asan与gcc 4.8,gcc,linker,linker-errors,gcc4.8,address-sanitizer,Gcc,Linker,Linker Errors,Gcc4.8,Address Sanitizer,我使用gcc 4.8.3以这种方式编译测试可执行文件: gcc -o test -g -L/lib64 -fsanitize=address -static-libasan 结果: /usr/bin/ld: cannot find -lasan collect2: error: ld returned 1 exit status Libasan已经安装,如果我在编译时没有使用static选项,它就会工作。如何静态编译库?您需要安装特殊的包才能获得静态GCC库。在Ubuntu上,你应该这样做

我使用gcc 4.8.3以这种方式编译测试可执行文件:

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

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

Libasan已经安装,如果我在编译时没有使用static选项,它就会工作。如何静态编译库?

您需要安装特殊的包才能获得静态GCC库。在Ubuntu上,你应该这样做

$ sudo apt-get install libgcc-4.8-dev

您需要安装特殊的包来获取静态GCC库。在Ubuntu上,你应该这样做

$ sudo apt-get install libgcc-4.8-dev