After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 774424 - meson: Fails to build on FreeBSD because -lexecinfo is not used
meson: Fails to build on FreeBSD because -lexecinfo is not used
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other FreeBSD
: Normal normal
: 1.11.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-11-14 19:18 UTC by Ting-Wei Lan
Modified: 2016-11-25 19:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
meson: Support execinfo.h on FreeBSD by using -lexecinfo (2.00 KB, patch)
2016-11-14 19:19 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2016-11-14 19:18:18 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.
Comment 1 Ting-Wei Lan 2016-11-14 19:19:52 UTC
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.
Comment 2 Ting-Wei Lan 2016-11-15 06:19:10 UTC
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.
Comment 3 Ting-Wei Lan 2016-11-25 18:46:10 UTC
The fix for meson has been committed and it will be available in meson 0.37. Can my patch get reviewed now?
Comment 4 Tim-Philipp Müller 2016-11-25 19:29:48 UTC
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 :)