GNOME Bugzilla – Bug 774424
meson: Fails to build on FreeBSD because -lexecinfo is not used
Last modified: 2016-11-25 19:33:34 UTC
FreeBSD has execinfo.h and backtrace-related functions available in its default installation, but using it requires linking with -lexecinfo. Building gstreamer with meson 0.35.1 on FreeBSD fails with linking error: gst/gstreamer-1.0@sha/gstinfo.c.o: In function `generate_backtrace_trace': /home/lantw44/gnome/build/gstreamer/../../source/gstreamer/gst/gstinfo.c:2567: undefined reference to `backtrace_symbols' clang++: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. I will attach a patch to fix the problem, but it requires meson >= 0.36.0 to work properly because has_function check in older versions use the wrong way to write the test program, which causes the statement used to reference the function to be deleted by clang in generated code.
Created attachment 339827 [details] [review] meson: Support execinfo.h on FreeBSD by using -lexecinfo FreeBSD supports execinfo.h and backtrace* functions, but using it requires linking with -lexecinfo.
It seems that meson 0.36.0 has been released and we can depend on it now, but it can only build without optimization flags set in CFLAGS. I filed a meson bug report for it: https://github.com/mesonbuild/meson/issues/1053.
The fix for meson has been committed and it will be available in meson 0.37. Can my patch get reviewed now?
Looks fine, thanks: commit ec2e213c50533c85759eca72a7dc1be22697da7e Author: Ting-Wei Lan <lantw@src.gnome.org> Date: Tue Nov 15 03:03:22 2016 +0800 meson: Support execinfo.h on FreeBSD by using -lexecinfo FreeBSD supports execinfo.h and backtrace* functions, but using them requires linking with -lexecinfo. Requires sufficiently-new meson with #1053 fixed (post-0.36). https://bugzilla.gnome.org/show_bug.cgi?id=774424 We could probably write it a bit tighter by always checking for libexec unconditionally and just using it in the check (it should be a no-op if it's not found), but it spams the output, so undecided if that's really better :)