Bug 274088 - multimedia/libva: fix build with lld 17
Summary: multimedia/libva: fix build with lld 17
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: Jan Beich
URL:
Keywords:
Depends on:
Blocks: 273753
  Show dependency treegraph
 
Reported: 2023-09-25 19:04 UTC by Dimitry Andric
Modified: 2023-09-25 21:27 UTC (History)
0 users

See Also:
jbeich: maintainer-feedback+


Attachments
multimedia/libva: fix build with lld 17 (873 bytes, patch)
2023-09-25 19:04 UTC, Dimitry Andric
no flags 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 2023-09-25 19:04:05 UTC
When building libva with lld >= 17, an error similar to the following is emitted when linking libva.so:

  ld: error: va/libva.so.2.2000.0.p/va_compat.c.o: symbol
  vaCreateSurfaces@VA_API_0.32.0 has undefined version VA_API_0.32.0

The root cause is that lld 17 checks linker version scripts more strictly by default, and emits an error when undefined symbols or undefined versions are referenced.

Earlier in the build, it turns out that due to these lld errors, va's meson.build fails to detect --version-script support:

  Checking if "-Wl,--version-script" : links: NO

This is because the small test program used by meson to check whether a shared library can be linked with the libva.syms version script is completely empty, and therefore the two symbols in the version script, vaCreateSurfaces_0_32_0 and vaCreateSurfaces, are undefined.

Fix the problem by providing placeholder definitions for these symbols in the code argument to meson's cc.links() function. This ensures that meson correctly detects --version-script support with lld version 17 or later, and makes it possible to link the libva shared library.

NOTE: also submitted upstream as https://github.com/intel/libva/pull/758
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-09-25 19:04:27 UTC
Created attachment 245225 [details]
multimedia/libva: fix build with lld 17
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-09-25 21:26:03 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6837bc7384597090eb5902ab9166c3b6138d463c

commit 6837bc7384597090eb5902ab9166c3b6138d463c
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-09-25 18:59:15 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-09-25 21:24:04 +0000

    multimedia/libva: unbreak build with LLD 17

    Checking if "-Wl,--version-script" : links: NO
    [...]
    ld: error: va/libva.so.2.2000.0.p/va_compat.c.o: symbol vaCreateSurfaces@VA_API_0.32.0 has undefined version VA_API_0.32.0

    PR:             274088
    Reported by:    antoine (via bug 273753 exp-run)

 multimedia/libva/Makefile | 3 +++
 multimedia/libva/distinfo | 2 ++
 2 files changed, 5 insertions(+)
Comment 3 Jan Beich freebsd_committer freebsd_triage 2023-09-25 21:27:58 UTC
Thanks. Landed.