From nobody Fri Jan 10 12:42:07 2025 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YV1WQ4xKMz5kG3c for ; Fri, 10 Jan 2025 12:42:10 +0000 (UTC) (envelope-from pblok@bsd4all.org) Received: from mail.bsd4all.org (mail.bsd4all.org [88.99.169.216]) by mx1.freebsd.org (Postfix) with ESMTP id 4YV1WQ2tJxz4Zcl; Fri, 10 Jan 2025 12:42:10 +0000 (UTC) (envelope-from pblok@bsd4all.org) Authentication-Results: mx1.freebsd.org; none Received: from mail.bsd4all.org (localhost [127.0.0.1]) by mail.bsd4all.org (Postfix) with ESMTP id 9226CB8B7; Fri, 10 Jan 2025 13:42:10 +0100 (CET) X-Virus-Scanned: amavisd-new at bsd4all.org Received: from mail.bsd4all.org ([127.0.0.1]) by mail.bsd4all.org (mail.bsd4all.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ed_d42TdmY9u; Fri, 10 Jan 2025 13:42:09 +0100 (CET) Received: from smtpclient.apple (geer_ip [81.172.230.56]) by mail.bsd4all.org (Postfix) with ESMTPSA id 70644B87F; Fri, 10 Jan 2025 13:42:09 +0100 (CET) From: Peter Blok Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_E1A5FB37-CA04-4212-941E-2D961C2655CD" List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: Re: libxkbcommon version-script detection Date: Fri, 10 Jan 2025 13:42:07 +0100 In-Reply-To: Cc: FreeBSD CURRENT To: Dimitry Andric References: <518E81E7-F1F0-422C-88A0-718088E4FDB6@bsd4all.org> <1DCB46A8-04C7-4F1A-ADEE-A5402E4B5617@FreeBSD.org> <2EFAFFD8-E1E1-42D0-B41D-217E97C27F2E@bsd4all.org> X-Mailer: Apple Mail (2.3696.120.41.1.10) X-Rspamd-Queue-Id: 4YV1WQ2tJxz4Zcl X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE] --Apple-Mail=_E1A5FB37-CA04-4212-941E-2D961C2655CD Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Patch works fine! Thanks. Do I need to open up a bug to get this pushed upstream? Peter > On 10 Jan 2025, at 13:28, Dimitry Andric wrote: >=20 > On 10 Jan 2025, at 12:56, Dimitry Andric > wrote: >>=20 >> On 10 Jan 2025, at 12:20, Peter Blok wrote: >>>=20 >>> Test works ok when using clang18 from ports >>>=20 >>>> On 10 Jan 2025, at 11:19, Dimitry Andric wrote: >>>>=20 >>>> On 10 Jan 2025, at 10:22, Peter Blok wrote: >>>>>=20 >>>>> I have recompiled x11/libxkbcommon and it fails to detect if the = compiler/linker supports versioned symbols. As a result other code = expecting the versioned symbol to exist, fail to link. >>>>>=20 >>>>> C compiler for the host machine: cc (clang 19.1.5 "FreeBSD clang = version 19.1.5 (https://github.com/llvm/llvm-project.git = llvmorg-19.1.5-0-gab4b5a2db582)") >>>>> C linker for the host machine: cc ld.lld 19.1.5 >>>>>=20 >>>>> Below the meson.build check. If I force have_version_script to = true, the versioned symbols are created and other code links fine. >>>>>=20 >>>>> # Supports -Wl,--version-script? >>>>> have_version_script =3D cc.links( >>>>> 'int main(){}', >>>>> args: '-Wl,--undefined-version,--version-script=3D' + = meson.current_source_dir()/'xkbcommon.map', >>>>> name: '-Wl,--version-script', >>>>> ) >>>>>=20 >>>>> Below the output for the test. >>>>>=20 >>>>> Checking if "-Wl,--version-script" : links: NO >>>>>=20 >>>>> If I create test.c with content "int main(){}=E2=80=9D and compile = it manually with the same flags AFAIK, it compiles ok. No errors. >>>>>=20 >>>>> However when I capture "make configure" with ktrace, it fails with = the error below. >>>>>=20 >>>>> ld: error: non-exported symbol 'environ' in '/usr/lib/crt1.o' is = referenced by DSO '/lib/libc.so.7' >>>>> ld: error: non-exported symbol '__progname' in = '/usr/lib/crt1.o' is referenced by DSO '/lib/libc.so.7' >>>>> cc: error: linker command failed with exit code 1 (use -v to = see invocation) >>>>>=20 >>>>> What flags need to be added in meson.build to allow it to work? >>>>>=20 >>>>> BTW This is on recent stable, but I suspect it fails the same way = on current which I do not run at the moment. >>>>=20 >>>> It works just fine on -CURRENT: >>>>=20 >>>> ... >>>> Checking if "-Wl,--version-script" : links: YES >>>>=20 >>>> Not sure what is going wrong in your environment. Is this = stable/14? >>=20 >> It appears to help when the lines: >>=20 >> local: >> *; >>=20 >> are removed from = /wrkdirs/usr/ports/x11/libxkbcommon/work/libxkbcommon-1.7.0/xkbcommon.map.= Apparently on main, environ and __progname are slightly different. >>=20 >> In any case, the "local: *;" thing has caused problems before, so = maybe it's better to get rid of it. >=20 > Here's a better patch, that can also be upstreamed. It avoids the = whole problem of trying to use the "full" xkbcommon.map during meson = tests. >=20 > -Dimitry >=20 > --Apple-Mail=_E1A5FB37-CA04-4212-941E-2D961C2655CD Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Patch= works fine! Thanks.

Do I need to open up a bug to get this pushed = upstream?

Peter


On 10 = Jan 2025, at 13:28, Dimitry Andric <dim@FreeBSD.org> wrote:

On 10 Jan 2025, at 12:56, Dimitry Andric <dim@FreeBSD.org> wrote:

On 10 Jan 2025, at 12:20, Peter Blok <pblok@bsd4all.org> = wrote:

Test works ok when using clang18 from ports

On 10 Jan 2025, at = 11:19, Dimitry Andric <dim@FreeBSD.org> wrote:

On = 10 Jan 2025, at 10:22, Peter Blok <pblok@bsd4all.org> wrote:

I have recompiled = x11/libxkbcommon and it fails to detect if the compiler/linker supports = versioned symbols. As a result other code expecting the versioned symbol = to exist, fail to link.

C compiler for the = host machine: cc (clang 19.1.5 "FreeBSD clang version 19.1.5 (https://github.com/llvm/llvm-project.git = llvmorg-19.1.5-0-gab4b5a2db582)")
C linker for the host = machine: cc ld.lld 19.1.5

Below the = meson.build check. If I force have_version_script to true, the versioned = symbols are created and other code links fine.

# Supports -Wl,--version-script?
have_version_script =3D cc.links(
'int = main(){}',
args: = '-Wl,--undefined-version,--version-script=3D' + = meson.current_source_dir()/'xkbcommon.map',
name: = '-Wl,--version-script',
)

Below= the output for the test.

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

If I = create test.c with content "int main(){}=E2=80=9D and compile it = manually with the same flags AFAIK, it compiles ok. No errors.

However when I capture "make configure" with = ktrace, it fails with the error below.

ld: = error: non-exported symbol 'environ' in '/usr/lib/crt1.o' is referenced = by DSO '/lib/libc.so.7'
   ld: error: = non-exported symbol '__progname' in '/usr/lib/crt1.o' is referenced by = DSO '/lib/libc.so.7'
   cc: error: linker = command failed with exit code 1 (use -v to see invocation)

What flags need to be added in meson.build to = allow it to work?

BTW This is on recent = stable, but I suspect it fails the same way on current which I do not = run at the moment.

It works = just fine on -CURRENT:

...
Checking if "-Wl,--version-script" : links: YES

Not sure what is going wrong in your = environment. Is this stable/14?

It appears to help = when the lines:

local:
  *;

are removed from = /wrkdirs/usr/ports/x11/libxkbcommon/work/libxkbcommon-1.7.0/xkbcommon.map.= Apparently on main, environ and __progname are slightly different.

In any case, the "local: *;" thing has caused = problems before, so maybe it's better to get rid of it.

Here's a better patch, that can also be upstreamed. It avoids = the whole problem of trying to use the "full" xkbcommon.map during meson = tests.

-Dimitry

<x11__libxkbcommon-fix-= version-script-check-1.diff>

= --Apple-Mail=_E1A5FB37-CA04-4212-941E-2D961C2655CD--