我一直在尝试使用 Clang 的地址代码清理器,但链接器没有它。链接器可能是“ld”,尽管我的 CMAKE 设置向我保证 clang 是链接器。
已添加 -fsanitize=address
编译器和链接器标志。
错误:
Undefined symbols for architecture x86_64: ___asan_after_dynamic_init ... ___asan_before_dynamic_init ... etc. ld: symbol(s) not found for architecture x86_64 <<<< **suspicious** clang: error: linker command failed with exit code 1 (use -v to see invocation)
最佳答案
来自 here 的解决方案
Pass the -fsanitize=address flag to the linker as well as the compiler.
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address"
关于MacOS - clang 地址清理程序无法链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46900598/