Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitizer compilation test fails with Xcode generator. #49

Open
jdumas opened this issue Apr 15, 2024 · 0 comments
Open

Sanitizer compilation test fails with Xcode generator. #49

jdumas opened this issue Apr 15, 2024 · 0 comments

Comments

@jdumas
Copy link

jdumas commented Apr 15, 2024

Hi. Running CMake with the Xcode generator seems to fails the compilation for Address sanitizer on macOS:

❯ cmake .. -G "Xcode" -DUSE_SANITIZER=Address
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode13.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode13.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Testing with Address sanitizer
CMake Error at /Users/jedumas/external/git/cmake-scripts/sanitizers.cmake:77 (message):
  Address sanitizer not available for
  /Applications/Xcode13.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
Call Stack (most recent call first):
  CMakeLists.txt:10 (include)


-- Configuring incomplete, errors occurred!

Furthermore it looks like the -fsanitize=address flag should also be passed to linker options. I would generally recommend setting global options via add_compile_options() and add_link_options() rather than mucking around with CMAKE_CXX_FLAGS or CMAKE_EXE_LINKER_FLAGS directly though, but that's probably a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant