]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Fix building with asserts enabled in FreeBSD
authorGleb Popov <6yearold@gmail.com>
Mon, 19 May 2025 07:15:20 +0000 (10:15 +0300)
committerGleb Popov <6yearold@gmail.com>
Mon, 19 May 2025 07:32:55 +0000 (10:32 +0300)
The backtrace() function on FreeBSD resides in the libexecinfo library, so
we need to link to it.

CMakeLists.txt
dbus/meson.build

index acda97525c01b3af7b6d05e2482c5b21a9ed25d6..c6aa0a087befabcf65fee76d807341deaf59ade2 100644 (file)
@@ -372,6 +372,10 @@ if(UNIX AND NOT DBUS_DISABLE_ASSERT)
         string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--export-dynamic")
         string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--export-dynamic")
     endif()
+    if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+        string(APPEND CMAKE_SHARED_LINKER_FLAGS " -lexecinfo")
+        string(APPEND CMAKE_EXE_LINKER_FLAGS " -lexecinfo")
+    endif()
     set(DBUS_BUILT_R_DYNAMIC 1)
 endif()
 
index d2acd059441fded14106a292255d2ab91d8a8a5f..4c9f7be170c6db0d9de0db9af2b8c2d06a21aa93 100644 (file)
@@ -27,6 +27,11 @@ dbus_dependencies = [
     valgrind.partial_dependency(compile_args: true),
 ]
 
+if asserts and host_machine.system() == 'freebsd'
+    execinfo_dep = declare_dependency(link_args: '-lexecinfo')
+    dbus_dependencies += execinfo_dep
+endif
+
 # source code that goes in the installed client library
 # and is specific to library functionality
 dbus_lib_sources = [