Bug 249974

Summary: security/seahorse: link failure on 11.x (old ld(1))
Product: Ports & Packages Reporter: John Hein <jcfyecrayz>
Component: Individual Port(s)Assignee: Mateusz Piotrowski <0mp>
Status: Closed FIXED    
Severity: Affects Some People CC: 0mp, ddrinnon
Priority: --- Keywords: patch-ready, regression
Version: LatestFlags: bugzilla: maintainer-feedback? (gnome)
Hardware: Any   
OS: Any   
URL: http://beefy9.nyi.freebsd.org/data/114amd64-default/553941/logs/seahorse-3.36.2_1.log
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249418
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249990
Bug Depends on:    
Bug Blocks: 251004    
Attachments:
Description Flags
[patch] avoid old ld(1) due to link problems after switch to meson
none
[patch] avoid old ld(1) due to link problems after switch to meson (v2) jcfyecrayz: maintainer-approval? (bapt)

Description John Hein 2020-09-29 01:31:08 UTC
seahorse fails to link on 11.x with the old default ld(1).


[151/151] cc  -o src/seahorse src/seahorse.p/meson-generated_.._.._data_seahorse-resources.c.o src/seahorse.p/meson-generated_.._seahorse-shell-search-provider-generated.c.o src/seahorse.p/meson-generated_application.c.o src/seahorse.p/meson-generated_import-dialog.c.o src/seahorse.p/meson-generated_key-manager.c.o src/seahorse.p/meson-generated_key-manager-item-row.c.o src/seahorse.p/meson-generated_main.c.o src/seahorse.p/meson-generated_search-provider.c.o src/seahorse.p/meson-generated_sidebar.c.o -L/usr/local/lib -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -O2 -pipe -fstack-protector-strong -DLDAP_DEPRECATED -isystem /usr/local/include -fno-strict-aliasing -fstack-protector-strong -Wl,--start-group libegg/liblibeggdatetime.a libegg/liblibtreemultidnd.a common/libcommon.a libseahorse/liblibseahorse.a gkr/libseahorse-gkr.a ssh/libseahorse-ssh.a pgp/libseahorse-pgp.a pkcs11/libseahorse-pkcs11.a /usr/local/lib/libglib-2.0.so /usr/local/lib/libintl.so /usr/local/lib/libgobject-2.0.so /usr/local/lib/libgio-2.0.so -Wl,--export-dynamic /usr/local/lib/libgmodule-2.0.so -pthread /usr/local/lib/libgtk-3.so /usr/local/lib/libgdk-3.so /usr/local/lib/libpangocairo-1.0.so /usr/local/lib/libpango-1.0.so /usr/local/lib/libatk-1.0.so /usr/local/lib/libcairo-gobject.so /usr/local/lib/libcairo.so -lpthread /usr/local/lib/libgdk_pixbuf-2.0.so /usr/local/lib/libhandy-0.0.so /usr/local/lib/libsecret-1.so /usr/local/lib/libgcr-ui-3.so /usr/local/lib/libgcr-base-3.so /usr/local/lib/libgck-1.so /usr/local/lib/libp11-kit.so /usr/local/lib/libpwquality.so /usr/local/lib/libgpgme.so /usr/local/lib/libassuan.so /usr/local/lib/libgpg-error.so -lldap -llber /usr/local/lib/libsoup-2.4.so /usr/local/lib/libavahi-common.so /usr/local/lib/libavahi-client.so /usr/local/lib/libavahi-glib.so -Wl,--end-group
FAILED: src/seahorse 
cc  -o src/seahorse src/seahorse.p/meson-generated_.._.._data_seahorse-resources.c.o src/seahorse.p/meson-generated_.._seahorse-shell-search-provider-generated.c.o src/seahorse.p/meson-generated_application.c.o src/seahorse.p/meson-generated_import-dialog.c.o src/seahorse.p/meson-generated_key-manager.c.o src/seahorse.p/meson-generated_key-manager-item-row.c.o src/seahorse.p/meson-generated_main.c.o src/seahorse.p/meson-generated_search-provider.c.o src/seahorse.p/meson-generated_sidebar.c.o -L/usr/local/lib -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -O2 -pipe -fstack-protector-strong -DLDAP_DEPRECATED -isystem /usr/local/include -fno-strict-aliasing -fstack-protector-strong -Wl,--start-group libegg/liblibeggdatetime.a libegg/liblibtreemultidnd.a common/libcommon.a libseahorse/liblibseahorse.a gkr/libseahorse-gkr.a ssh/libseahorse-ssh.a pgp/libseahorse-pgp.a pkcs11/libseahorse-pkcs11.a /usr/local/lib/libglib-2.0.so /usr/local/lib/libintl.so /usr/local/lib/libgobject-2.0.so /usr/local/lib/libgio-2.0.so -Wl,--export-dynamic /usr/local/lib/libgmodule-2.0.so -pthread /usr/local/lib/libgtk-3.so /usr/local/lib/libgdk-3.so /usr/local/lib/libpangocairo-1.0.so /usr/local/lib/libpango-1.0.so /usr/local/lib/libatk-1.0.so /usr/local/lib/libcairo-gobject.so /usr/local/lib/libcairo.so -lpthread /usr/local/lib/libgdk_pixbuf-2.0.so /usr/local/lib/libhandy-0.0.so /usr/local/lib/libsecret-1.so /usr/local/lib/libgcr-ui-3.so /usr/local/lib/libgcr-base-3.so /usr/local/lib/libgck-1.so /usr/local/lib/libp11-kit.so /usr/local/lib/libpwquality.so /usr/local/lib/libgpgme.so /usr/local/lib/libassuan.so /usr/local/lib/libgpg-error.so -lldap -llber /usr/local/lib/libsoup-2.4.so /usr/local/lib/libavahi-common.so /usr/local/lib/libavahi-client.so /usr/local/lib/libavahi-glib.so -Wl,--end-group
/usr/bin/ld: undefined reference to symbol `atk_relation_new' (try adding -latk-1.0)
/usr/local/lib/libatk-1.0.so: could not read symbols: Bad value
cc: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
+ [ -n 'Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer.' ]
+ echo '===> Compilation failed unexpectedly.'
===> Compilation failed unexpectedly.


The problem has to do with the old ld(1) implementation of --start-group and --end-group.  If you put just the .a libs between --start-group and --end-group, it works with the old ld(1).  If you include .so's (which doesn't make much sense really for what --start-group and --end-group are there for), then the old ld(1) gets confused somehow and can't find symbols sometimes.  This could be considered a meson bug since it brackets too much between --start-group and --end-group.  I'm seeing this on other ports, too (e.g., bug 249418).
Comment 1 John Hein 2020-09-29 01:38:15 UTC
Created attachment 218395 [details]
[patch] avoid old ld(1) due to link problems after switch to meson

Use -fuse-lld=lld to avoid link errors using old ld(1) on 11.x

While here, pet portlint issues (placement of USES) & do sorting.  No need to bump PORTREVISION.

Request maintainer-approval from recent committer (since gnome@ is not responsive of late).
Comment 2 John Hein 2020-10-07 18:49:40 UTC
Created attachment 218598 [details]
[patch] avoid old ld(1) due to link problems after switch to meson (v2)

Refresh patch after r551608.

Effectively no change.  Still:

 - fix link failure on 11.x
 - address portlint warning (USES ordering)
 - request maintainer-approval from recent committer that broke it

QA:
 - poudriere testport on 11/amd64 and 11/i386 - ok
Comment 3 ddrinnon 2020-10-10 00:08:57 UTC
*** Bug 250196 has been marked as a duplicate of this bug. ***
Comment 4 John Hein 2020-10-16 15:52:52 UTC
Timeout?

FYI, log of build failure from FreeBSD package builder...

http://beefy3.nyi.freebsd.org/data/114amd64-quarterly/551243/logs/seahorse-3.36.2.log
Comment 5 Mateusz Piotrowski freebsd_committer 2020-11-05 14:21:22 UTC
I'll take a look.
Comment 6 commit-hook freebsd_committer 2020-11-06 09:20:19 UTC
A commit references this bug:

Author: 0mp
Date: Fri Nov  6 09:19:33 UTC 2020
New revision: 554175
URL: https://svnweb.freebsd.org/changeset/ports/554175

Log:
  Use -fuse-lld=lld to avoid link errors using old ld(1) on 11.x

  PR:		249974
  Submitted by:	John Hein <jcfyecrayz__liamekaens_com>
  Approved by:	portmgr blanket
  MFH:		2020Q4

Changes:
  head/security/seahorse/Makefile
Comment 7 Mateusz Piotrowski freebsd_committer 2020-11-06 09:21:00 UTC
Committed, thanks!
Comment 8 commit-hook freebsd_committer 2020-11-06 11:09:39 UTC
A commit references this bug:

Author: 0mp
Date: Fri Nov  6 11:09:06 UTC 2020
New revision: 554179
URL: https://svnweb.freebsd.org/changeset/ports/554179

Log:
  Fix the conditional added in r554175

  This should have been caught by my poudriere testruns. Sorry for the
  breakage.

  PR:		249974
  Approved by:	portmgr blanket
  MFH:		2020Q4

Changes:
  head/security/seahorse/Makefile
Comment 9 commit-hook freebsd_committer 2020-11-08 21:28:46 UTC
A commit references this bug:

Author: 0mp
Date: Sun Nov  8 21:28:09 UTC 2020
New revision: 554652
URL: https://svnweb.freebsd.org/changeset/ports/554652

Log:
  MFH: r554179

  Fix the conditional added in r554175

  This should have been caught by my poudriere testruns. Sorry for the
  breakage.

  PR:		249974
  Approved by:	portmgr (build fix)

Changes:
_U  branches/2020Q4/
  branches/2020Q4/security/seahorse/Makefile
Comment 10 John Hein 2020-11-09 18:12:13 UTC
(In reply to Mateusz Piotrowski from comment #7)

Thanks, Mateusz.

I have come to understand that powerpc64/12.x does not have lld, so it may be appropriate to change the -fuse-ld=lld conditional logic based on OSVERSION that was added:

.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1200000
LDFLAGS+=      -fuse-ld=lld
.endif

(see also discussion at bug 249990 comment 5)

I don't have a powerpc build environment to test with yet, but if it turns out that powerpc64/11.x (for example) fails to build, the following may be necessary.  This is a bit harder to find when it comes time to remove support for 11.x, but I don't know of a way that is better at this time.  It does seem like meson abuses some things and triggers the link problems seen in this port and some others - most (all?) of the situations where this linking problem is showing up are meson-based.  So probably the best universal fix is to fix meson (e.g., don't put anything but lib specifications between --start-group and --end-group) but I do not have a meson patch right now.

# This can be removed after OSVERSION < 1200000 is no longer supported
.if exists(/usr/bin/ld.lld) && ${/usr/bin/ld:L:tA} != /usr/bin/ld.lld
LDFLAGS+=      -fuse-ld=lld
.endif

I know this is closed, but I am adding this comment in case powerpc builds fail.