Skip to content

Commit 27e1ec9

Browse files
committed
M9.R.38.3: skip nix-store Qt6 dirs in launcher Qt plugin/QML walk
ROOT CAUSE (G2 install ``munmap_chunk(): invalid pointer`` SIGABRT before Phase 1): The reproos-installer-launcher.sh walks ``/nix/store/*/lib`` and adds every dir containing ``qt-6/plugins`` to QT_PLUGIN_PATH + QT_QPA_PLATFORM_PLUGIN_PATH, every dir containing ``qt-6/qml`` to QML2_IMPORT_PATH. The de-rootfs nix-store mirror ships: /nix/store/zp6r9bxds...-qtbase-6.10.1/lib/qt-6/plugins/ pulled in as a transitive of layer-shell-qt-6.5.3 (in the DE closure). But the installer is COMPILED + RPATH'd against: /opt/repro/.../qt6-base/.repro/output/install/usr/lib/ (Qt 6.8.1) When Qt 6.8.1 binary loads a Qt 6.10.1 ``libqoffscreen.so`` plugin under QT_QPA_PLATFORM=offscreen, the C++ ABI mismatch corrupts the heap during plugin init and glibc's ``munmap_chunk()`` detects the bad pointer + raises SIGABRT. WHY M9.R.37 DIDN'T HIT THIS: The M9.R.37 18:47 install used the installer binary built at 21:28 (this was before MY 00:11 rebuild that this commit unblocks). At the M9.R.37 build time the de-rootfs nix-store mirror layout may have been different -- the Qt 6.10.1 path wasn't yet pulled in as a layer-shell-qt transitive, OR a subsequent rebuild promoted the 6.10.1 path into the closure. Either way, NOW it's in the mirror and the launcher's wholesale ``qt-6/plugins`` discovery picks it up. FIX: 1. Skip ANY ``/nix/store/*-qt*-*/lib`` dir in the LD_LIBRARY_PATH / QT_PLUGIN_PATH walk (qtbase, qtdeclarative, qt5compat, layer- shell-qt, kquickcharts, qtquickcontrols*, qttools, qtwayland -- the full Plasma 6 transitive Qt6 closure). None of those versions are guaranteed ABI-compatible with the installer's build-time Qt 6.8.1. 2. AFTER the nix-store walk completes, explicitly add the reprobuild-side qt6-base + qt6-declarative + qt6-quickcontrols2 + qt6-tools plugin/qml dirs. These are the EXACT 6.8.1 install trees the installer's RPATH points at, so the plugin ABI matches the linked Qt6Core/Gui/Qml ABI. EVIDENCE: G2 install attempt #1 (clean, 00:27) -> INSTALLER_RC=134, munmap G2 install attempt #2 (diag, 00:35) -> same crash, strace tail shows munmap_chunk right after locale C->C.UTF-8 message G2 install attempt #3 (37.7-only, 01:09) -> same crash, confirming the regression isn't in M9.R.37.8's cpp delta Host run of the same binary outside QEMU -- no crash, Phase 1 reaches the ``repro hardware probe`` spawn. This rules out the binary itself + isolates the regression to the live-ISO-mounted nix-store mirror's Qt 6.10.1 path being picked up by the launcher's qt-6/plugins discovery. The fix preserves M9.R.37.5's surgical-LD_LIBRARY_PATH approach + extends the same surgical principle to QT_PLUGIN_PATH + QML2_IMPORT_PATH: only Qt6 prefixes that match the installer's build-time Qt version are wired in.
1 parent 291c83d commit 27e1ec9

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

recipes/reproos-iso/scripts/stage-de-rootfs.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,29 @@ for d in /nix/store/*/lib; do
644644
case "$d" in
645645
/nix/store/*-glibc-*/lib) continue ;;
646646
esac
647+
# M9.R.38.3 — skip ANY nix-store Qt6 prefix. The installer is
648+
# compiled + RPATH'd against ``/opt/repro/.../qt6-base/.repro/
649+
# output/install/usr/lib/libQt6Core.so.6.8.1``, but the de-rootfs
650+
# mirror also ships an UNRELATED ``zp6r9bxds...-qtbase-6.10.1/lib/``
651+
# tree pulled in as a transitive of layer-shell-qt-6.5.3 (which is
652+
# in the DE closure). Without this skip the launcher's qt-6/plugins
653+
# / qt-6/qml walk below picks up the 6.10.1 plugin tree as well, and
654+
# the Qt 6.8.1 binary loading a 6.10.1 ``libqoffscreen.so`` /
655+
# ``QtQuick.Controls`` plugin trips C++ ABI mismatch -> heap
656+
# corruption -> ``munmap_chunk(): invalid pointer`` on init, SIGABRT
657+
# before Phase 1. The qt6-base + qt6-declarative + qt6-quickcontrols2
658+
# the installer needs live at /opt/repro/... paths the RPATH already
659+
# covers; no nix-store Qt6 mirror is required.
660+
case "$d" in
661+
/nix/store/*-qtbase-*/lib | \
662+
/nix/store/*-qtdeclarative-*/lib | \
663+
/nix/store/*-qt5compat-*/lib | \
664+
/nix/store/*-layer-shell-qt-*/lib | \
665+
/nix/store/*-kquickcharts-*/lib | \
666+
/nix/store/*-qtquickcontrols*/lib | \
667+
/nix/store/*-qttools-*/lib | \
668+
/nix/store/*-qtwayland-*/lib) continue ;;
669+
esac
647670
# M9.R.37.5: include ONLY dirs that ship a library the ``repro``
648671
# binary's Nim {.dynlib: "..."} pragma resolves by bare leaf name:
649672
# * libclingo.so (libs/repro_solver/.../clingo_bindings.nim)
@@ -682,6 +705,24 @@ for d in /nix/store/*/lib; do
682705
fi
683706
fi
684707
done
708+
# M9.R.38.3 — the installer's RPATH points to /opt/repro/.../qt6-base
709+
# /.repro/output/install/usr/lib/qt-6/plugins/ + qt6-declarative's
710+
# qt-6/qml/. Wire those EXPLICITLY since the loop above only walks
711+
# /nix/store; without this Qt finds no plugins + falls back to system
712+
# Debian Qt6 (which doesn't exist in the live DE rootfs) + crashes on
713+
# QtQuick init.
714+
for repro_qt_pkg in qt6-base qt6-declarative qt6-quickcontrols2 qt6-tools; do
715+
qtpkg_dir="/opt/repro/reprobuild/recipes/packages/source/${repro_qt_pkg}/.repro/output/install/usr/lib"
716+
if [ -d "${qtpkg_dir}/qt-6/plugins" ]; then
717+
_repro_qt_plugins="${qtpkg_dir}/qt-6/plugins${_repro_qt_plugins:+:$_repro_qt_plugins}"
718+
if [ -d "${qtpkg_dir}/qt-6/plugins/platforms" ]; then
719+
_repro_qpa_plugins="${qtpkg_dir}/qt-6/plugins/platforms${_repro_qpa_plugins:+:$_repro_qpa_plugins}"
720+
fi
721+
fi
722+
if [ -d "${qtpkg_dir}/qt-6/qml" ]; then
723+
_repro_qml_imports="${qtpkg_dir}/qt-6/qml${_repro_qml_imports:+:$_repro_qml_imports}"
724+
fi
725+
done
685726
# Append caller-supplied paths last so any operator override wins.
686727
if [ -n "${LD_LIBRARY_PATH:-}" ]; then
687728
_repro_ldpath="$_repro_nix_libs:$LD_LIBRARY_PATH"

0 commit comments

Comments
 (0)