aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorArtemis Tosini <me@artem.ist>2024-06-07 03:50:31 +0000
committerArtemis Tosini <me@artem.ist>2024-06-16 03:41:15 +0000
commite680b0913aa39519b8b5200b8dd459b0315e0f2b (patch)
tree69820eead289532dfe8e43d11d15b34b8fc98d66 /meson.build
parent4734ce7831daf6e7e976029017b1cc2e7e615f30 (diff)
meson.build: Allow undefined symbols on FreeBSD
The linker cannot find environ while linking libutil. Fix build by allowing undefined symbols Change-Id: Iba319126284d48454b50db40d3aadf37e0339668
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build7
1 files changed, 7 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 7a6283ca2..5a772888d 100644
--- a/meson.build
+++ b/meson.build
@@ -167,6 +167,7 @@ message('canonical Nix system name:', host_system)
is_linux = host_machine.system() == 'linux'
is_darwin = host_machine.system() == 'darwin'
+is_freebsd = host_machine.system() == 'freebsd'
is_x64 = host_machine.cpu_family() == 'x86_64'
# Per-platform arguments that you should probably pass to shared_module() invocations.
@@ -462,6 +463,12 @@ if cxx.get_linker_id() in ['ld.bfd', 'ld.gold']
add_project_link_arguments('-Wl,--no-copy-dt-needed-entries', language : 'cpp')
endif
+if is_freebsd
+ # FreeBSD's `environ` is defined in `crt1.o`, not `libc.so`,
+ # so the linker thinks it's undefined
+ add_project_link_arguments('-Wl,-z,undefs', language: 'cpp')
+endif
+
# Generate Chromium tracing files for each compiled file, which enables
# maintainers/buildtime_report.sh BUILD-DIR to simply work in clang builds.
#