I have a test script that grinds through various configurations. The script tests for the availability of Undefined Behavior sanitizer (UBsan), and then performs the build if available. Here's the test:
$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
The test above sets HAVE_UBSAN=1
on Cygwin, which means GCC's Cygwin claims to support UBsan (otherwise, it would have produced an error). However, I'm catching a link error under both Cygwin i686 and 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
Obviously, whatever is needed was not installed with gcc-core
or gcc-g++
. I ran the setup program again and searched for ubsan
but I got 0 hits.
What package(s) do I need for Cygwin's UBsan?
While I'm at it, I might as well ask about the next failure I expect to experience. What package do I need for Cygwin's Asan?
Thanks in advance.