Bug 277905 - net/jose: fix build with lld 18
Summary: net/jose: fix build with lld 18
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 276104
  Show dependency treegraph
 
Reported: 2024-03-23 10:07 UTC by Dimitry Andric
Modified: 2024-03-27 18:47 UTC (History)
2 users (show)

See Also:
hdholm: maintainer-feedback+


Attachments
net/jose: fix build with lld 18 (1.05 KB, patch)
2024-03-23 10:08 UTC, Dimitry Andric
no flags Details | Diff
Alternative patch (685 bytes, patch)
2024-03-23 20:33 UTC, Howard Holm
hdholm: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2024-03-23 10:07:23 UTC
With recent lld, the --version-script check in net/jose's meson.build
fails, causing it to erroneously use a -export-symbols-regex flag:

  cc: error: unknown argument: '-export-symbols-regex=^jose_.*'

Fix this by removing the faulty check from meson.build.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-03-23 10:08:09 UTC
Created attachment 249426 [details]
net/jose: fix build with lld 18
Comment 2 Howard Holm 2024-03-23 15:35:44 UTC
The patch seems to work adequately for me, but it feels like there should be a better way to deal with the linker flag issue in meson.  I've opened https://github.com/latchset/jose/issues/152 upstream, but in the meantime, I don't have any objection to the proposed patch.
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2024-03-23 16:28:22 UTC
(In reply to Howard Holm from comment #2)
Yeah, the correct way to check for --version-script support in a linker would be to have a small test with one correct .c file and one correct .map file, the latter with only valid symbols from from the .c file.

As it is, the meson test failed because it tries "-Wl,--version-script=...", which works neither on lld nor on BFD ld:

$ cc version-test.c -o foo -Wl,--version-script=... -fuse-ld=lld
ld.lld: error: cannot find version script ...
cc: error: linker command failed with exit code 1 (use -v to see invocation)

$ cc version-test.c -o foo -Wl,--version-script=... -fuse-ld=bfd
/usr/local/bin/ld.bfd: cannot open linker script file ...: No such file or directory
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 4 Howard Holm 2024-03-23 20:33:22 UTC
Created attachment 249437 [details]
Alternative patch

I don't have a build setup that uses lld 18.  So it's hard for me to test alternative fixes. I'm wondering if something like the fix here https://github.com/xkbcommon/libxkbcommon/commit/ebe4157d77cbf88eb3b35d9155d56468e4709ba2 which is adding --undefined-version, solves the problem or is it a different issue than the undefined symbol problem causing the linker to fail on that test. So does this patch fix the issue?
Comment 5 Fernando Apesteguía freebsd_committer freebsd_triage 2024-03-26 19:12:31 UTC
^Triage: reporter is committer, assign accordingly.
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-03-27 18:45:06 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=142d074b14d2f69452f2468d801d9f5e0d2669ef

commit 142d074b14d2f69452f2468d801d9f5e0d2669ef
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-03-21 13:31:57 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-03-27 18:42:53 +0000

    net/jose: fix build with lld 18

    With recent lld, the --version-script check in net/jose's meson.build
    fails, causing it to erroneously use a -export-symbols-regex flag:

      cc: error: unknown argument: '-export-symbols-regex=^jose_.*'

    Fix this by adding --undefined-version to the meson check, so it
    succeeds.

    PR:             277905
    Approved by:    hdholm@alumni.iastate.edu (maintainer)
    MFH:            2024Q1

 net/jose/files/patch-lib_meson.build (new) | 10 ++++++++++
 1 file changed, 10 insertions(+)
Comment 7 commit-hook freebsd_committer freebsd_triage 2024-03-27 18:46:08 UTC
A commit in branch 2024Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0f0ed642ede141994fc8b610ea6ee141ccc7c16a

commit 0f0ed642ede141994fc8b610ea6ee141ccc7c16a
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-03-21 13:31:57 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-03-27 18:45:35 +0000

    net/jose: fix build with lld 18

    With recent lld, the --version-script check in net/jose's meson.build
    fails, causing it to erroneously use a -export-symbols-regex flag:

      cc: error: unknown argument: '-export-symbols-regex=^jose_.*'

    Fix this by adding --undefined-version to the meson check, so it
    succeeds.

    PR:             277905
    Approved by:    hdholm@alumni.iastate.edu (maintainer)
    MFH:            2024Q1

    (cherry picked from commit 142d074b14d2f69452f2468d801d9f5e0d2669ef)

 net/jose/files/patch-lib_meson.build (new) | 10 ++++++++++
 1 file changed, 10 insertions(+)