Skip to content

Commit 3851dd5

Browse files
committed
fix(eui-neo): explicit -L for the staged glib + pcre2 version coherence
CI (pinned mcpp 2026.8.10.3, GNU ld) failed every eui-neo member with 'unable to find library -lglib-2.0' — on artifacts as unrelated as bin/libXdmcp.so, because package ldflags are unioned into every link. Root cause: with only runtime.library_dirs, the staged dir reaches link lines as -Wl,-rpath; ld.lld (mcpp 2026.8.21.3) happens to search rpath for -l, so local runs passed, but GNU ld does not — its SEARCH_DIRs are absolute host paths, so -lglib fell through to /lib64 (missing on a clean runner, or worse: the host's glib where it exists). Two fixes, both verified against the CI-pinned mcpp downloaded locally: * ldflags gains '-Lmcpp_generated/glib/lib' — payload-relative, resolved by mcpp against the install dir, the same convention compat.openblas and compat.mysql-connector-cpp use ('-Llib'). Now -lglib resolves to the staged copies on both linkers. * When libselinux is host-staged, libpcre2-8.so.0 is overwritten with the host's copy too: the host libselinux references pcre2 symbols WITH version tags (PCRE2_10.xx), which cannot bind to the xim pcre2's unversioned definitions — GNU ld hard-errors, lld only warns at runtime. The host pcre2 carries both versioned and unversioned defs, satisfying host libselinux and xim glib alike. Verified: mcpp 2026.8.10.3 (CI pin) — eui-neo and eui-neo-window pass cold; mcpp 2026.8.21.3 (latest) — eui-neo still passes.
1 parent 598562b commit 3851dd5

1 file changed

Lines changed: 43 additions & 1 deletion

File tree

‎pkgs/e/compat.eui-neo.lua‎

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,16 @@ package = {
475475
-- closure both resolve inside the hermetic boundary (the same
476476
-- mcpp#352 problem as GL on the host, the same staging shape as
477477
-- compat.glx-runtime).
478+
-- The -L is RELATIVE to the payload: mcpp resolves it against
479+
-- the install dir (same convention as compat.openblas's
480+
-- "-Llib"). It is load-bearing, not decorative: with only
481+
-- runtime.library_dirs the staged dir reaches links as
482+
-- -Wl,-rpath, which lld happens to search for -l but GNU ld
483+
-- does not — on the GNU-ld toolchain -lglib then falls through
484+
-- to the host's /lib64 (wrong glib, or none at all).
478485
cflags = { "-DEUI_TRAY_SNI=1", "-pthread" },
479-
ldflags = { "-lpthread", "-ldl",
486+
ldflags = { "-Lmcpp_generated/glib/lib",
487+
"-lpthread", "-ldl",
480488
"-lglib-2.0", "-lgio-2.0", "-lgobject-2.0" },
481489
runtime = {
482490
library_dirs = { "mcpp_generated/glib/lib" },
@@ -724,6 +732,40 @@ function install()
724732
.. "glibc, they are the mcpp#352 configuration the day that "
725733
.. "glibc overtakes the payload's", table.concat(from_host, ", "))
726734
end
735+
736+
-- Versioned-symbol coherence: a HOST libselinux references pcre2
737+
-- symbols WITH version tags (PCRE2_10.xx), and a versioned reference
738+
-- cannot bind to the xim pcre2's unversioned definitions — GNU ld
739+
-- hard-errors at link time, lld lets it through to a runtime warning.
740+
-- The reverse direction is fine (unversioned refs bind to versioned
741+
-- defs), so when libselinux came from the host, pcre2 must too:
742+
-- overwrite the xim-staged copy with the host's, which satisfies
743+
-- both sides. Ubuntu and Fedora both ship libpcre2-8-0 by default.
744+
local selinux_from_host = false
745+
for _, soname in ipairs(from_host) do
746+
if soname == "libselinux.so.1" then
747+
selinux_from_host = true
748+
break
749+
end
750+
end
751+
if selinux_from_host then
752+
local host_pcre = nil
753+
for _, dir in ipairs(host_lib_dirs) do
754+
local cand = path.join(dir, "libpcre2-8.so.0")
755+
if os.isfile(cand) then
756+
host_pcre = cand
757+
break
758+
end
759+
end
760+
if host_pcre then
761+
stage("libpcre2-8.so.0", host_pcre)
762+
else
763+
log.warn("libselinux came from the host but libpcre2-8.so.0 did "
764+
.. "not: the xim pcre2's unversioned symbols cannot "
765+
.. "satisfy the host libselinux, and GNU ld will fail "
766+
.. "the final link")
767+
end
768+
end
727769
if #missing > 0 then
728770
log.error("%s found neither in this subos, the xim store, nor on "
729771
.. "the host", table.concat(missing, ", "))

0 commit comments

Comments
 (0)