Re: libxkbcommon version-script detection
- Reply: Peter Blok : "Re: libxkbcommon version-script detection"
- In reply to: Dimitry Andric : "Re: libxkbcommon version-script detection"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 10 Jan 2025 12:28:49 UTC
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 = 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? > > 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