You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ 75%] Linking CXX static library libfoo.a
[ 75%] Built target foo
[ 87%] Linking CXX executable main
libfoo.a(foo.cpp.o): In function `foo()':
sanitizers-cmake/tests/foo.cpp:2: undefined reference to `__asan_option_detect_stack_use_after_return'
The link succeed using SHARED library type, but fails at runtime. The asan wrapper script is mandatory in that situation.
./tests/main
==72769==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
../cmake/asan-wrapper ./tests/main
==72780==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffef9eff968 at pc 0x7fdd7696791c bp 0x7ffef9eff910 sp 0x7ffef9eff900
However, when the final executable is itself sanitizer-enabled, then this situation does not occur and everything works just fine, both with static and shared library.
Maybe one solution would be to import asan library and add it to the INTERFACE_LINK_LIBRARIES of targets using a sanitizer.
The text was updated successfully, but these errors were encountered:
Build fails at link time if a static library is compiled with address sanitizer, but the executable using the library is not. Example:
Link-time error:
The link succeed using SHARED library type, but fails at runtime. The asan wrapper script is mandatory in that situation.
However, when the final executable is itself sanitizer-enabled, then this situation does not occur and everything works just fine, both with static and shared library.
Maybe one solution would be to import asan library and add it to the INTERFACE_LINK_LIBRARIES of targets using a sanitizer.
The text was updated successfully, but these errors were encountered: