Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jan 2025 11:19:45 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Peter Blok <pblok@bsd4all.org>
Cc:        FreeBSD CURRENT <freebsd-current@freebsd.org>
Subject:   Re: libxkbcommon version-script detection
Message-ID:  <1DCB46A8-04C7-4F1A-ADEE-A5402E4B5617@FreeBSD.org>
In-Reply-To: <518E81E7-F1F0-422C-88A0-718088E4FDB6@bsd4all.org>

index | next in thread | previous in thread | raw e-mail

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 = cc.links(
>    'int main(){}',
>    args: '-Wl,--undefined-version,--version-script=' + 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(){}” 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?

-Dimitry



help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1DCB46A8-04C7-4F1A-ADEE-A5402E4B5617>