2

当我使用-fsanitize=address将某个对象链接到二进制文件时,g++ 说标题中的两个库不存在。

我的 g++ 版本是:

    $ /opt/rh/devtoolset-2/root/usr/bin/g++ -v
    Using built-in specs.
    COLLECT_GCC=/opt/rh/devtoolset-2/root/usr/bin/g++
    COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
    Target: x86_64-redhat-linux
    Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
    Thread model: posix
    gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)

如果我使用 g++,是否需要手动编译 libasan?

4

1 回答 1

1

Sanitizer 运行时通常位于单独的包中。例如,在 Debian 上,您需要安装 libasanN(“N”取决于您的 GCC 版本)。

于 2016-10-24T08:57:43.460 回答