On 10 Jan 2025, at 12:20, Peter Blok <pb...@bsd4all.org> wrote:
> 
> Test works ok when using clang18 from ports
> 
>> On 10 Jan 2025, at 11:19, Dimitry Andric <d...@freebsd.org> wrote:
>> 
>> On 10 Jan 2025, at 10:22, Peter Blok <pb...@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.

-Dimitry


Reply via email to