I’m working on a
native configuration of Luos and I would like to perform some sanity check.
To do so I want to use the
-fsanitize=thread flag to check on data race.
On my platformio.ini I added some flag like this :
build_flags = ... -fsanitize=thread -Wl,-fsanitize=thread
I’m on mac M1 and
gcc --version give me :
Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin21.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
When I compile using this flag I get the error :
ld: unknown option: -fsanitize=thread
So I tried to verbose build to check the link command and the line sounds good :
gcc -o .pio/build/native/program -Wl,-fsanitize=thread -Og -g2 -ggdb2 .pio/build/native/src/main.o -L.pio/build/native .pio/build/native/libdf9/libluos_engine.a .pio/build/native/libb5c/libpipe.a .pio/build/native/lib440/libgate.a .pio/build/native/lib16b/libButton.a
I’m not sure that the
-Wl, should be on my command…
I tried to run the command on my terminal without the
-Wl, and I got some strange incompatibility errors such as :
ld: warning: ignoring file .pio/build/native/lib16b/libButton.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 ld: warning: ignoring file .pio/build/native/src/main.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64 ...
Did anyone have any thoughts about it?