When I try to compile my eek.cpp
file with g++ eek.cpp -o eek -fsanitize=undefined
flag, it shows:
ld: library not found for -lubsan
collect2: error: ld returned 1 exit status
but g++ eek.cpp -o eek
is working fine.
My terminal screenshot here.
I'm using zsh and gcc 10.2.0 on macOS Big Sur. fsanitize=undefined
was still working yesterday before I updated my macOS from Catalina.
The ubsan.h
file does exist in /usr/local/Cellar/gcc/10.2.0_2/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0/plugin/include
, but it isn't working.
I've also read this post but it didn't solve my problem. How should I fix it?