olex2: bundle readline 8.2 in the sysroot; loader check reports instead of dying

olex2c needs libreadline.so.8 (RHEL8 has .so.7, vendor lib/ only .so.6),
so the Ra build node could not complete the post-install ld.so --list and
the guard aborted. Add Fedora 40 readline-8.2 to the sysroot rpms (needs
only the host libtinfo.so.6) and make step 7 print the listing, warn on
host libs missing on the build node, and die only on a genuine
patchelf/sysroot failure.
This commit is contained in:
duan_j committed 2026-10-16 18:05:23 +02:00
1 parent fffd36970c
commit 59b10215b3
3 files changed
+53 -21

No files matched your search

+19 -10
View File
@@ -77,11 +77,14 @@ A newer glibc can **not** be dropped in via `LD_LIBRARY_PATH`: the dynamic
loader path (`/lib64/ld-linux-x86-64.so.2`) is hard-wired into each
executable and must match its libc. So the recipe:
- ships glibc 2.39 + GCC 14 `libstdc++`/`libgcc_s` under `$PREFIX/sysroot`
(frozen Fedora 40 rpms from kojipkgs, Fedora's permanent build archive;
same glibc generation as the upstream build host). glibc and libstdc++
unpack to `usr/lib64`, libgcc to `/lib64` (Fedora relies on the
filesystem package's `lib64 -> usr/lib64` symlink, which we do not
- ships glibc 2.39 + GCC 14 `libstdc++`/`libgcc_s` + readline 8.2 under
`$PREFIX/sysroot` (frozen Fedora 40 rpms from kojipkgs, Fedora's
permanent build archive; same glibc generation as the upstream build
host). readline because the binaries need `libreadline.so.8`: RHEL8 has
`.so.7`, RHEL9 `.so.8`, the vendor `lib/` only `.so.6` — bundled, olex2c
needs just `libtinfo.so.6` (ncurses-libs) from the host. glibc, libstdc++
and readline unpack to `usr/lib64`, libgcc to `/lib64` (Fedora relies on
the filesystem package's `lib64 -> usr/lib64` symlink, which we do not
extract), so `configure` merges `lib64` into `usr/lib64` and recreates
the symlink — one lib dir for the RPATH;
- runs `patchelf --set-interpreter <sysroot ld.so> --force-rpath --set-rpath
@@ -148,9 +151,12 @@ exact names from `files/config.yaml` in `<distdir>`; prep then skips the
download but still checks the sha256.
**RHEL9 host libraries.** The binaries bring their own glibc, libstdc++,
python, ssl, png, jpeg, tiff, openblas, gfortran, but link system
GTK2/X11/OpenGL — also `olex2c` (wx is linked in statically). Check once
per host type:
readline, python, ssl, png, jpeg, tiff, openblas, gfortran, but link
system GTK2/X11/OpenGL and `libtinfo.so.6` (ncurses-libs) — also `olex2c`
(wx is linked in statically). The install step prints the loader listing
for olex2c; a host lib missing on the *build* node is a WARNING there, not
an error, because build and execution hosts differ. Check once per host
type:
```sh
module load olex2/1.5-7665 # exports OLEX2_ROOT=/opt/psi/MX/olex2/1.5-7665
@@ -209,8 +215,11 @@ not to edit the hash:
2. check the new binaries' glibc need still fits the bundled 2.39:
`unzip -p olex2-linux64.zip olex2/olex2c | strings | grep -o 'GLIBC_2\.[0-9]*' | sort -uV | tail -1`
(and `GLIBCXX_3\.4\.[0-9]*` ≤ 3.4.33). If upstream moved past that, bump
the three rpms in `urls:`/`shasums:` to a newer frozen Fedora release
(kojipkgs `packages/glibc/<ver>/<rel>/x86_64/`, `packages/gcc/...`);
the four rpms (glibc, libstdc++, libgcc, readline) in `urls:`/`shasums:`
to a newer frozen Fedora release (kojipkgs
`packages/glibc/<ver>/<rel>/x86_64/`, `packages/gcc/...`,
`packages/readline/...`) — they must come from the same release so
readline's glibc requirement is met;
3. add `1.5-7800` under `versions:` (`relstage: unstable`) and
`olex2-1.5-7800-linux64.zip: <sha256>` under `shasums:` — the `urls:`
entry needs no change (`${V_PKG}` = series dir, `${V}` = cache name);
+27 -11
View File
@@ -32,6 +32,7 @@ OLEX2_SYSROOT_RPMS=(
glibc-2.39-37.fc40.x86_64.rpm
libstdc++-14.2.1-3.fc40.x86_64.rpm
libgcc-14.2.1-3.fc40.x86_64.rpm
readline-8.2-8.fc40.x86_64.rpm # libreadline.so.8: RHEL8 has .so.7, vendor lib/ .so.6
)
OLEX2_PATCHELF_TGZ="patchelf-0.18.0-x86_64.tar.gz"
# ELF executables in the vendor tree that get the bundled loader (static ones,
@@ -162,21 +163,36 @@ pbuild::install() {
install -m 755 "${BUILDBLOCK_DIR}/files/olex2-launcher" "${PREFIX}/bin/olex2c" || \
std::die 42 "olex2: installing bin/olex2c launcher failed"
# 7. prove the patched olex2c resolves through the bundled glibc. Missing
# HOST libs (gtk2, GL ...) are only a warning here: they must be
# installed on the execution hosts, the build host may differ.
"${ld}" --list "${PREFIX}/olex2c" > "${SRC_DIR}/olex2c.ldd" 2>&1 || \
std::die 42 "olex2: bundled loader cannot resolve olex2c - see ${SRC_DIR}/olex2c.ldd"
grep -q "${libdir}/libc.so.6" "${SRC_DIR}/olex2c.ldd" || \
std::die 42 "olex2: olex2c does not pick up the bundled glibc (see ${SRC_DIR}/olex2c.ldd) - patchelf step broken"
if grep -q 'not found' "${SRC_DIR}/olex2c.ldd"; then
echo "olex2: WARNING - host libraries missing on THIS host; dnf install them on the execution hosts:"
grep 'not found' "${SRC_DIR}/olex2c.ldd"
# 7. prove the patched olex2c resolves through the bundled glibc. The
# build host (Ra, RHEL8) is not the execution host (RHEL9): a HOST lib
# missing here ("=> not found", or a hard "cannot open shared object
# file" that aborts the listing) is reported, not fatal. Anything else
# (segfault, page alignment, GLIBC_PRIVATE ...) means patchelf/sysroot
# is broken and the build must stop.
local -r ldd="${SRC_DIR}/olex2c.ldd"
local rc=0
"${ld}" --list "${PREFIX}/olex2c" > "${ldd}" 2>&1 || rc=$?
echo "olex2: --- ${ld} --list olex2c (rc=${rc}) ---"
cat "${ldd}"
echo "olex2: --- end of listing ---"
if grep -q "${libdir}/libc.so.6" "${ldd}"; then
if grep -q 'not found' "${ldd}"; then
echo "olex2: WARNING - host libraries missing on THIS host; dnf install them on the execution hosts:"
grep 'not found' "${ldd}"
fi
elif grep -q 'cannot open shared object file' "${ldd}"; then
echo "olex2: WARNING - cannot verify the loader on THIS host, a host library is missing here:"
grep 'cannot open shared object file' "${ldd}"
echo "olex2: install it on the execution hosts (or bundle it in the sysroot) and re-check with"
echo "olex2: ${ld} --list ${PREFIX}/olex2c"
else
std::die 42 "olex2: olex2c does not resolve through the bundled glibc (rc=${rc}, listing above) - patchelf/sysroot step broken"
fi
# 8. what the modulefile / launchers rely on
local f
for f in olex2 olex2c cctbx/cctbx_build/lib lib/libpython3.8.so.1.0 lib/python3.8 util/pyUtil/initpy.py bin/olex2c sysroot; do
for f in olex2 olex2c cctbx/cctbx_build/lib lib/libpython3.8.so.1.0 lib/python3.8 util/pyUtil/initpy.py bin/olex2c \
sysroot/usr/lib64/libc.so.6 sysroot/usr/lib64/libstdc++.so.6 sysroot/usr/lib64/libgcc_s.so.1 sysroot/usr/lib64/libreadline.so.8; do
[[ -e "${PREFIX}/${f}" ]] || std::die 42 "olex2: ${PREFIX}/${f} missing after install - module would be broken"
done
echo "olex2: installed upstream build '$(cat "${PREFIX}/version.txt" 2>/dev/null)' (tag $(cat "${PREFIX}/olex2.tag" 2>/dev/null))"
+7
View File
@@ -28,6 +28,12 @@ olex2:
- url: https://kojipkgs.fedoraproject.org/packages/gcc/14.2.1/3.fc40/x86_64/libgcc-14.2.1-3.fc40.x86_64.rpm
name: libgcc-14.2.1-3.fc40.x86_64.rpm
unpacker: none
# readline 8: the binaries need libreadline.so.8 - RHEL8 has .so.7, RHEL9
# .so.8, the vendor lib/ only .so.6. Bundling it makes olex2c independent
# of the host readline (only libtinfo.so.6 from ncurses-libs is needed).
- url: https://kojipkgs.fedoraproject.org/packages/readline/8.2/8.fc40/x86_64/readline-8.2-8.fc40.x86_64.rpm
name: readline-8.2-8.fc40.x86_64.rpm
unpacker: none
# static patchelf: re-points the ELF executables at the bundled loader
- url: https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0-x86_64.tar.gz
name: patchelf-0.18.0-x86_64.tar.gz
@@ -41,6 +47,7 @@ olex2:
glibc-2.39-37.fc40.x86_64.rpm: 3976fe456c25eb15a8eea4fd57140a2d9b0084ef721960b510e02872c4fe5cc9
libstdc++-14.2.1-3.fc40.x86_64.rpm: 6b6c07bef7ecf7af4a4042bc53eca6c188e07567b3ae710568495a5ca89ccede
libgcc-14.2.1-3.fc40.x86_64.rpm: 6d84546060cf58bd1ea2456a0ac52659bf9670782258b664dfc0aa046ff3a50d
readline-8.2-8.fc40.x86_64.rpm: 4e84cb13e24caa3f2b445cef19bf8756d97f17bc64a0958144abc3df284bf038
patchelf-0.18.0-x86_64.tar.gz: ce84f2447fb7a8679e58bc54a20dc2b01b37b5802e12c57eece772a6f14bf3f0
versions:
# 1.5: legacy Ra/RHEL8 module built by the previous recipe from a