Skip to content

Commit ded25f9

Browse files
committed
build: check backtrace in libc before searching for execinfo
Use cc.has_function('backtrace', prefix: '#include <execinfo.h>') to check if backtrace is already available in the default system libraries (such as glibc on Linux or natively on macOS). If it is available, use a dummy dependency. Otherwise, fall back to cc.find_library('execinfo', required: false). This prevents spurious compile or linker failures for unnecessary '-lexecinfo' links on macOS and other platforms.
1 parent 4edc45b commit ded25f9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

meson.build

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ fuse_dep = dependency('fuse3')
4242
uuid_dep = dependency('uuid')
4343
expat_dep = dependency('expat')
4444
openssl_dep = dependency('openssl')
45-
execinfo_dep = cc.find_library('execinfo', required: false)
45+
if cc.has_function('backtrace', prefix: '#include <execinfo.h>')
46+
execinfo_dep = dependency('', required: false)
47+
else
48+
execinfo_dep = cc.find_library('execinfo', required: false)
49+
endif
4650

4751
httpdirfs_deps = [
4852
gumbo_dep,

0 commit comments

Comments
 (0)