Skip to content

Instantly share code, notes, and snippets.

@rewitt1
Created August 22, 2018 17:51
Show Gist options
  • Save rewitt1/20a76f01ca3a4c465628240408173b5c to your computer and use it in GitHub Desktop.
Save rewitt1/20a76f01ca3a4c465628240408173b5c to your computer and use it in GitHub Desktop.
Example of why getting strings from find_library() objects would be useful
***********************************************
Example of the error asan gives when you run an app linked against it and use LD_PRELOAD
***********************************************
LD_PRELOAD=./test/libmock_syscalls.so ./src/myapp
==34946==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.
***********************************************
Example of how you can make asan happy
***********************************************
LD_PRELOAD=libasan.so.5:./test/libmock_syscalls.so ./src/myapp
***********************************************
meson.build snippet example of what I would like to do so that I don't have to hardcode libasan.so.5
***********************************************
mock_lib = shared_library('mock_syscalls',
'mock_syscalls.c')
if asan_enabled
asan_lib = cc.find_library('asan')
test_args += [ '--preload_libs', asan_lib]
endif
test_args += [ '--preload_libs', mocklib]
test('test_myapp', test_myapp,
args : [ test_args ])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment