Bug 238128

Summary: devel/meson: don't strip rpath
Product: Ports & Packages Reporter: Piotr Kubaj <pkubaj>
Component: Individual Port(s)Assignee: freebsd-desktop (Team) <desktop>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: canardo909, dank, diizzy, gnome, lantw44, lwhsu
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch pkubaj: maintainer-approval? (gnome)

Description Piotr Kubaj freebsd_committer freebsd_triage 2019-05-26 01:13:51 UTC
Created attachment 204611 [details]
patch

Meson currently strips rpath, which breaks building with GCC from ports on GCC architectures:
https://github.com/mesonbuild/meson/issues/2567

Use attached patch to disable it and thus fix issue with linking to bad libstdc++.
Comment 1 Piotr Kubaj freebsd_committer freebsd_triage 2019-05-26 01:15:53 UTC
(In reply to Piotr Kubaj from comment #0)
"Meson currently strips rpath, which breaks building with GCC from ports on GCC architectures:"

I meant breaks, as in cripples. The resulting binaries are linked to libstdc++, so they won't run.
Comment 2 Ting-Wei Lan 2019-05-28 16:02:17 UTC
(In reply to Piotr Kubaj from comment #0)
I added a comment to the linked issue to notify upstream about the use case.
Comment 3 Piotr Kubaj freebsd_committer freebsd_triage 2019-05-28 16:32:28 UTC
(In reply to Ting-Wei Lan from comment #2)
So is this patch acceptable?
Comment 4 Ting-Wei Lan 2019-05-28 17:20:33 UTC
(In reply to Piotr Kubaj from comment #3)
I just tested the patch by building pango, and I found it causes the installed executable to have useless RPATHs. For example, the executable 'pango-view' has RPATH '$ORIGIN/../pango', which is useless outside the build directory.
Comment 5 Piotr Kubaj freebsd_committer freebsd_triage 2019-05-28 20:10:18 UTC
(In reply to Ting-Wei Lan from comment #4)
Still, this currently seems the only way to link usable binaries when there's a GCC 4.2 installed.

Could then this patch be only used when CHOSEN_COMPILER_TYPE == gcc?

With this patch, I linked properly libgexiv, which allowed me to run shotwell, so it definitely is useful.
Comment 6 Ting-Wei Lan 2019-05-29 06:02:44 UTC
(In reply to Piotr Kubaj from comment #5)
It still doesn't change the fact that useless RPATHs will be left on installed files, which can potentially cause unexpected issues.

If you just want to have a temporary patch which won't be submitted to upstream, I think the easiest fix here is to put the desired value of RPATH from ports to a new environment variable, possibly called FREEBSD_PORTS_RPATH, and use it to construct the final RPATH in meson instead of skipping RPATH changes entirely.
Comment 7 Dan Kegel 2020-05-13 01:48:54 UTC
https://github.com/mesonbuild/meson/pull/7103 may be a better draft fix.

I tested it on FreeBSD and it seems to pass my little test case.
Comment 8 Daniel Engberg freebsd_committer freebsd_triage 2022-03-26 16:28:30 UTC
Still relevant?
Comment 9 Piotr Kubaj freebsd_committer freebsd_triage 2022-03-26 16:37:09 UTC
Nah, I don't think anyone uses 12 on powerpc* anymore.