To add a bit more color, the same problem happens with ports clang from
llvm package:
% pkg_info -I llvm
llvm-13.0.0 modular, fast C/C++/ObjC compiler, static analyzer and tools
% cat a.cc; /usr/local/bin/clang++ -fsanitize=undefined a.cc; ./a.out
int main(int argc, char **argv) {
int k = 0x7fffffff;
k += argc;
return 0;
}
ld: error: cannot open
/usr/local/lib/clang/13.0.0/lib/openbsd/libclang_rt.ubsan_standalone-x86_64.a:
No such file or directory
ld: error: cannot open
/usr/local/lib/clang/13.0.0/lib/openbsd/libclang_rt.ubsan_standalone_cxx-x86_64.a:
No such file or directory
clang-13: error: linker command failed with exit code 1 (use -v to see
invocation)
Greg Steuck <[email protected]> writes:
> I notice people keep sending fixes to problems reported by UBSan. I
> wanted to join the club, but the trivial thing listed at
> https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html doesn't
> work:
>
> $ cat a.cc; clang++ -fsanitize=undefined a.cc; ./a.out
> int main(int argc, char **argv) {
> int k = 0x7fffffff;
> k += argc;
> return 0;
> }
> ld: error: cannot open
> /usr/lib/clang/13.0.0/lib/openbsd/libclang_rt.ubsan_standalone-x86_64.a: No
> such file or directory
> ld: error: cannot open
> /usr/lib/clang/13.0.0/lib/openbsd/libclang_rt.ubsan_standalone_cxx-x86_64.a:
> No such file or directory
> clang++: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> Did we forget to ship the ubsan libs? The only related files in sets:
>
> ./usr/lib/clang/13.0.0/lib
> ./usr/lib/clang/13.0.0/lib/libclang_rt.profile.a
>
> Thanks
> Greg