2

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.

jww
  • 97,681
  • 90
  • 411
  • 885
  • 1
    I posted to the mailing list http://cygwin.com/ml/cygwin/2015-10/msg00493.html – Zombo Oct 28 '15 at 02:00
  • Thanks Steven. I'm pretty sure this is a Cygwin issue. I'm closing our bug report ([Cryptest.exe fails to build under Cygwin-i686 with sanitizer flags](https://github.com/weidai11/cryptopp/issues/49)). – jww Oct 31 '15 at 09:41
  • Does this mean that cygwin doesn't support ubsan? – Thick_propheT Apr 12 '21 at 06:48

0 Answers0