Skip to content

Commit 2bc905e

Browse files
authored
build(arch): provide OSMesa via mesa-amber extraction (#624)
Closes #623 Arch's modern `mesa` no longer ships classic `libOSMesa`, which BambuStudio links against (`-lOSMesa`), so the Arch build failed at link time. - `linux.d/arch`: extract `libOSMesa.so.8` (+ its `libglapi.so.0` dependency) from the `mesa-amber` package during the dependency step, without installing it (mesa-amber conflicts with mesa). This lets the link succeed while keeping modern mesa. - `scripts/build_pkg_arch.sh`: bundle both libs into the package so it also runs on a stock Arch system whose mesa no longer provides them. Verified: Arch single-distro build #14 on `ci/develop/linux-x86_64` is green and produced `bambustudio-02.08.00.50-1-x86_64.pkg.tar.zst`.
1 parent 6533354 commit 2bc905e

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

linux.d/arch

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,26 @@ if [[ -n "$UPDATE_LIB" ]]
6565
then
6666
sudo pacman -Syu --noconfirm
6767
sudo pacman -S --noconfirm --needed ${REQUIRED_DEV_PACKAGES[@]}
68+
69+
# Arch's modern mesa no longer ships classic OSMesa, which BambuStudio links
70+
# against (-lOSMesa). mesa-amber still provides it but conflicts with mesa, so
71+
# pull libOSMesa (+ its libglapi dependency) out of the mesa-amber package
72+
# without installing it.
73+
if [ ! -e /usr/lib/libOSMesa.so ]; then
74+
sudo pacman -Sw --noconfirm mesa-amber
75+
AMBER=$(ls /var/cache/pacman/pkg/mesa-amber-*.pkg.tar.zst 2>/dev/null | head -1)
76+
if [ -n "$AMBER" ]; then
77+
TMP=$(mktemp -d)
78+
sudo bsdtar -xf "$AMBER" -C "$TMP" usr/lib/libOSMesa.so.8.0.0 usr/lib/libglapi.so.0.0.0
79+
sudo cp -a "$TMP"/usr/lib/libOSMesa.so.8.0.0 "$TMP"/usr/lib/libglapi.so.0.0.0 /usr/lib/
80+
sudo ln -sf libOSMesa.so.8.0.0 /usr/lib/libOSMesa.so.8
81+
sudo ln -sf libOSMesa.so.8 /usr/lib/libOSMesa.so
82+
sudo ln -sf libglapi.so.0.0.0 /usr/lib/libglapi.so.0
83+
sudo ln -sf libglapi.so.0 /usr/lib/libglapi.so
84+
rm -rf "$TMP"
85+
fi
86+
fi
87+
6888
echo -e "done\n"
6989
exit 0
7090
fi

scripts/build_pkg_arch.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ done
4949

5050
install -m 755 "$APPDIR/bin/bambu-studio" "$STAGING/usr/lib/${PKGNAME}/"
5151
find "$APPDIR/bin" -name "*.so*" -exec install -m 755 {} "$STAGING/usr/lib/${PKGNAME}/" \;
52+
53+
# Bundle libOSMesa (+ its libglapi dependency). Arch's modern mesa no longer
54+
# ships classic OSMesa, which BambuStudio links against (-lOSMesa); linux.d/arch
55+
# extracts them from mesa-amber into /usr/lib during the dependency step, so pull
56+
# them into the package as well (the launcher sets LD_LIBRARY_PATH to this dir).
57+
for L in libOSMesa.so.8.0.0 libglapi.so.0.0.0; do
58+
[ -e "/usr/lib/$L" ] && install -m 755 "/usr/lib/$L" "$STAGING/usr/lib/${PKGNAME}/"
59+
done
60+
(
61+
cd "$STAGING/usr/lib/${PKGNAME}"
62+
[ -e libOSMesa.so.8.0.0 ] && ln -sf libOSMesa.so.8.0.0 libOSMesa.so.8
63+
[ -e libglapi.so.0.0.0 ] && ln -sf libglapi.so.0.0.0 libglapi.so.0
64+
true
65+
)
5266
cp -r "$APPDIR/resources" "$STAGING/usr/lib/${PKGNAME}/"
5367

5468
cat > "$STAGING/usr/bin/${PKGNAME}" << 'WRAPPER'

0 commit comments

Comments
 (0)