Skip to content

-sanitize:address gives Undefined symbol error #4630

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

Closed
clankill3r opened this issue Dec 26, 2024 · 4 comments
Closed

-sanitize:address gives Undefined symbol error #4630

clankill3r opened this issue Dec 26, 2024 · 4 comments

Comments

@clankill3r
Copy link
Contributor

Context

The -sanitize:address option gives:

Undefined symbols for architecture arm64:
"___asan_version_mismatch_check_v8", referenced from:
_asan.module_ctor in main.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

  • Operating System & Odin Version:

Odin: dev-2024-12:597fba7c3
OS: macOS Sequoia 15.1.1 (build 24B91, kernel 24.1.0)
CPU: Apple M3
RAM: 24576 MiB

Expected Behavior

Either that it works, or a message that it is not supported on the specific platform

Current Behavior

See error above

Steps to Reproduce

Use -sanitize:address on OSX with apple silicon.

@spahnke
Copy link
Contributor

spahnke commented Dec 26, 2024

Edited because the versions don't appear to matter. I made the wrong conclusion, sorry about that!

I get the same error when the compiler uses the LLVM build shipped with Odin on Apple Silicon (M4). If you have LLVM installed via Homebrew though you can do e.g.

export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
odin build . -sanitize:address

in your build script and it works (I'm using LLVM 19). I don't know exactly where the difference is.

@laytan
Copy link
Collaborator

laytan commented Dec 26, 2024

Almost, right solution but wrong cause.

It does not work with clang that comes with macOS by default, so you have to make brew's llvm be used by Odin, that can either be done with the ODIN_CLANG_PATH environment variable or by adding the brew directory to your path. Brew maintainers do advise against adding that to your path because it can interfere with other things, I have never personally had those issues though.

@spahnke
Copy link
Contributor

spahnke commented Dec 26, 2024

Oh, I guess that is what confused me, thank you 🙇‍♂️ The ASAN is enabled through the linker call which is a system call anyway and has nothing to do with the shipped LLVM lib for code generation.

@clankill3r
Copy link
Contributor Author

I'm confused, but anyway, this works so maybe there is no reason to be confused:

I added:
export ODIN_CLANG_PATH="/opt/homebrew/opt/llvm/bin/clang-19"
to my ~/.zprofile file.

@laytan laytan closed this as completed Dec 30, 2024
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

3 participants