Merge changes I81e76796,Iba319126 into main

* changes:
  libutil: Set boost defines for FreeBSD
  meson.build: Allow undefined symbols on FreeBSD
This commit is contained in:
Artemis Tosini 2024-06-16 14:42:54 +00:00 committed by Gerrit Code Review
commit ce2070139c
2 changed files with 9 additions and 2 deletions

View file

@ -167,6 +167,7 @@ message('canonical Nix system name:', host_system)
is_linux = host_machine.system() == 'linux' is_linux = host_machine.system() == 'linux'
is_darwin = host_machine.system() == 'darwin' is_darwin = host_machine.system() == 'darwin'
is_freebsd = host_machine.system() == 'freebsd'
is_x64 = host_machine.cpu_family() == 'x86_64' is_x64 = host_machine.cpu_family() == 'x86_64'
# Per-platform arguments that you should probably pass to shared_module() invocations. # 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') add_project_link_arguments('-Wl,--no-copy-dt-needed-entries', language : 'cpp')
endif 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 # Generate Chromium tracing files for each compiled file, which enables
# maintainers/buildtime_report.sh BUILD-DIR to simply work in clang builds. # maintainers/buildtime_report.sh BUILD-DIR to simply work in clang builds.
# #

View file

@ -5,8 +5,8 @@
#include <string> #include <string>
#include <optional> #include <optional>
#include <boost/format.hpp> #include <boost/format.hpp>
// Darwin stdenv does not define _GNU_SOURCE but does have _Unwind_Backtrace. // Darwin and FreeBSD stdenv do not define _GNU_SOURCE but do have _Unwind_Backtrace.
#ifdef __APPLE__ #if __APPLE__ || __FreeBSD__
#define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED #define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
#endif #endif
#include <boost/stacktrace.hpp> #include <boost/stacktrace.hpp>