Date: Fri, 10 Jan 2025 13:42:07 +0100 From: Peter Blok <pblok@bsd4all.org> To: Dimitry Andric <dim@FreeBSD.org> Cc: FreeBSD CURRENT <freebsd-current@freebsd.org> Subject: Re: libxkbcommon version-script detection Message-ID: <B5682416-F1D4-43D3-AEA7-40F6BAB42CD7@bsd4all.org> In-Reply-To: <C63834FC-6722-4A19-ABBE-3C5F195572F2@FreeBSD.org> References: <518E81E7-F1F0-422C-88A0-718088E4FDB6@bsd4all.org> <1DCB46A8-04C7-4F1A-ADEE-A5402E4B5617@FreeBSD.org> <2EFAFFD8-E1E1-42D0-B41D-217E97C27F2E@bsd4all.org> <F5EBD424-FAFC-40D6-BBE8-01BEFD99A310@FreeBSD.org> <C63834FC-6722-4A19-ABBE-3C5F195572F2@FreeBSD.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] 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 <mailto: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 > > <x11__libxkbcommon-fix-version-script-check-1.diff> [-- Attachment #2 --] <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Patch works fine! Thanks.<div class=""><br class=""></div><div class="">Do I need to open up a bug to get this pushed upstream?</div><div class=""><br class=""></div><div class="">Peter</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 10 Jan 2025, at 13:28, Dimitry Andric <<a href="mailto:dim@FreeBSD.org" class="">dim@FreeBSD.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">On 10 Jan 2025, at 12:56, Dimitry Andric <</span><a href="mailto:dim@FreeBSD.org" style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">dim@FreeBSD.org</a><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">> wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class="">On 10 Jan 2025, at 12:20, Peter Blok <<a href="mailto:pblok@bsd4all.org" class="">pblok@bsd4all.org</a>> wrote:<br class=""><blockquote type="cite" class=""><br class="">Test works ok when using clang18 from ports<br class=""><br class=""><blockquote type="cite" class="">On 10 Jan 2025, at 11:19, Dimitry Andric <<a href="mailto:dim@FreeBSD.org" class="">dim@FreeBSD.org</a>> wrote:<br class=""><br class="">On 10 Jan 2025, at 10:22, Peter Blok <<a href="mailto:pblok@bsd4all.org" class="">pblok@bsd4all.org</a>> wrote:<br class=""><blockquote type="cite" class=""><br class="">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.<br class=""><br class="">C compiler for the host machine: cc (clang 19.1.5 "FreeBSD clang version 19.1.5 (<a href="https://github.com/llvm/llvm-project.git" class="">https://github.com/llvm/llvm-project.git</a> llvmorg-19.1.5-0-gab4b5a2db582)")<br class="">C linker for the host machine: cc ld.lld 19.1.5<br class=""><br class="">Below the meson.build check. If I force have_version_script to true, the versioned symbols are created and other code links fine.<br class=""><br class=""># Supports -Wl,--version-script?<br class="">have_version_script = cc.links(<br class="">'int main(){}',<br class="">args: '-Wl,--undefined-version,--version-script=' + meson.current_source_dir()/'xkbcommon.map',<br class="">name: '-Wl,--version-script',<br class="">)<br class=""><br class="">Below the output for the test.<br class=""><br class="">Checking if "-Wl,--version-script" : links: NO<br class=""><br class="">If I create test.c with content "int main(){}” and compile it manually with the same flags AFAIK, it compiles ok. No errors.<br class=""><br class="">However when I capture "make configure" with ktrace, it fails with the error below.<br class=""><br class="">ld: error: non-exported symbol 'environ' in '/usr/lib/crt1.o' is referenced by DSO '/lib/libc.so.7'<br class=""> ld: error: non-exported symbol '__progname' in '/usr/lib/crt1.o' is referenced by DSO '/lib/libc.so.7'<br class=""> cc: error: linker command failed with exit code 1 (use -v to see invocation)<br class=""><br class="">What flags need to be added in meson.build to allow it to work?<br class=""><br class="">BTW This is on recent stable, but I suspect it fails the same way on current which I do not run at the moment.<br class=""></blockquote><br class="">It works just fine on -CURRENT:<br class=""><br class="">...<br class="">Checking if "-Wl,--version-script" : links: YES<br class=""><br class="">Not sure what is going wrong in your environment. Is this stable/14?<br class=""></blockquote></blockquote><br class="">It appears to help when the lines:<br class=""><br class="">local:<br class=""> *;<br class=""><br class="">are removed from /wrkdirs/usr/ports/x11/libxkbcommon/work/libxkbcommon-1.7.0/xkbcommon.map. Apparently on main, environ and __progname are slightly different.<br class=""><br class="">In any case, the "local: *;" thing has caused problems before, so maybe it's better to get rid of it.<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">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.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">-Dimitry</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span id="cid:CFDF602C-6010-4848-AF6E-FDB37A2ED7D3"><x11__libxkbcommon-fix-version-script-check-1.diff></span></div></blockquote></div><br class=""></div></body></html>help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B5682416-F1D4-43D3-AEA7-40F6BAB42CD7>
