我有一个测试脚本,可以通过各种配置进行打磨。该脚本测试Undefined Behavior sanitizer (UBsan)的可用性,然后在可用时执行构建。这是测试:
$CXX -x c++ -dM -E -fsanitize=undefined -std=c++11 - < /dev/null > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
HAVE_UBSAN=1
else
HAVE_UBSAN=0
fi
上面的测试设置HAVE_UBSAN=1
在 Cygwin 上,这意味着 GCC 的 Cygwin 声称支持 UBsan(否则会产生错误)。但是,我在 Cygwin i686 和 x86_64 下都发现了一个链接错误:
...
g++ -DDEBUG -g2 -O2 -Wall -std=c++03 -fsanitize=undefined -march=native -pipe -c fipsalgt.cpp
g++ -DDEBUG -g2 -O2 -Wall -std=c++03 -fsanitize=undefined -march=native -pipe -c dlltest.cpp
g++ -o cryptest.exe -DDEBUG -g2 -O2 -Wall -std=c++03 -fsanitize=undefined -march=native test.o validat1.o validat2.o validat3.o ... ./libcryptopp.a
/usr/lib/gcc/i686-pc-cygwin/4.9.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lubsan
collect2: error: ld returned 1 exit status
GNUmakefile:333: recipe for target 'cryptest.exe' failed
make: *** [cryptest.exe] Error 1
显然,没有安装任何需要的东西gcc-core
or gcc-g++
。我再次运行安装程序并搜索,ubsan
但我得到了 0 次点击。
Cygwin 的 UBsan 需要哪些软件包?
当我这样做的时候,我不妨问问我希望经历的下一次失败。Cygwin 的 Asan 需要什么包?
提前致谢。