Skip to content

Commit cdb2e11

Browse files
matteiusclaude
andcommitted
Fix deb package missing bundled libraries (fixes #362)
The docker export tar extraction failed silently on Debian trixie/sid because: (1) libsod was extracted from 'lib/libsod.so*' but usrmerge maps /lib → /usr/lib, so the tar stores files under usr/lib/; (2) docker export may prefix paths with './' which the old wildcards didn't match. This left /usr/lib/lightnvr empty in the .deb package. - Add both 'usr/lib/…' and './usr/lib/…' wildcard variants for all four bundled libraries (libuv, llhttp, sqlite3, libsod) - Add post-extraction verification that fails the build if any expected library is missing - Update Dockerfile to COPY libsod from /usr/lib/ consistently with the other libraries - Clean up redundant symlink creation loop Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2086967 commit cdb2e11

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

.github/workflows/debian-package.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,27 +106,36 @@ jobs:
106106
docker cp "${CID}:/bin/go2rtc" "${PKG_DIR}/usr/bin/go2rtc"
107107
108108
# Custom-built libraries (bundle to guarantee ABI compatibility)
109+
# Include both 'usr/lib/…' and './usr/lib/…' variants because
110+
# docker export may prefix paths with './' depending on version.
111+
# All custom libs live under /usr/lib/ in the image (on usrmerge
112+
# systems /lib is a symlink to /usr/lib, so libsod also lands there).
109113
mkdir -p /tmp/lightnvr_libs
110114
docker export "${CID}" | tar xf - --wildcards \
111-
'usr/lib/libuv.so*' \
112-
'usr/lib/libllhttp.so*' \
113-
'usr/lib/libsqlite3.so*' \
114-
'lib/libsod.so*' \
115+
'usr/lib/libuv.so*' './usr/lib/libuv.so*' \
116+
'usr/lib/libllhttp.so*' './usr/lib/libllhttp.so*' \
117+
'usr/lib/libsqlite3.so*' './usr/lib/libsqlite3.so*' \
118+
'usr/lib/libsod.so*' './usr/lib/libsod.so*' \
115119
-C /tmp/lightnvr_libs/ 2>/dev/null || true
116120
117121
find /tmp/lightnvr_libs -type f -name '*.so*' ! -type l \
118122
-exec install -m 644 {} "${PKG_DIR}/usr/lib/lightnvr/" \;
119123
120-
# Recreate symlinks inside the package directory
124+
# Verify that all expected libraries were extracted
125+
for expected_lib in libuv libllhttp libsqlite3 libsod; do
126+
if ! ls "${PKG_DIR}/usr/lib/lightnvr/${expected_lib}.so"* >/dev/null 2>&1; then
127+
echo "ERROR: ${expected_lib} not found in extracted libraries!"
128+
echo "Contents of /tmp/lightnvr_libs:"
129+
find /tmp/lightnvr_libs -type f -name '*.so*' 2>/dev/null
130+
exit 1
131+
fi
132+
done
133+
134+
# Recreate soname symlink chains inside the package directory
135+
# (Docker COPY dereferences symlinks, so we must recreate them)
121136
(cd "${PKG_DIR}/usr/lib/lightnvr" && \
122-
for f in libuv.so.1.0.0 libllhttp.so.9.3.1 libsod.so.1.1.9; do \
123-
[ -f "$f" ] || continue; \
124-
BASE="${f%%.*}"; \
125-
SONAME=$(readlink -f /tmp/lightnvr_libs/usr/lib/${f} 2>/dev/null | xargs -I{} basename {} 2>/dev/null || echo ""); \
126-
ln -sf "$f" "${BASE}.so" 2>/dev/null || true; \
127-
done; \
128-
[ -f libsod.so.1.1.9 ] && ln -sf libsod.so.1.1.9 libsod.so.1 && ln -sf libsod.so.1 libsod.so || true; \
129-
[ -f libuv.so.1.0.0 ] && ln -sf libuv.so.1.0.0 libuv.so.1 && ln -sf libuv.so.1 libuv.so || true; \
137+
[ -f libsod.so.1.1.9 ] && ln -sf libsod.so.1.1.9 libsod.so.1 && ln -sf libsod.so.1 libsod.so || true; \
138+
[ -f libuv.so.1.0.0 ] && ln -sf libuv.so.1.0.0 libuv.so.1 && ln -sf libuv.so.1 libuv.so || true; \
130139
[ -f libllhttp.so.9.3.1 ] && ln -sf libllhttp.so.9.3.1 libllhttp.so.9 && ln -sf libllhttp.so.9 libllhttp.so || true)
131140
132141
# Find and symlink sqlite3 if extracted

Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,8 @@ COPY --from=builder /usr/lib/libllhttp.so* /usr/lib/
208208
# Copy latest upstream SQLite shared library built in the builder stage
209209
COPY --from=builder /usr/lib/libsqlite3.so* /usr/lib/
210210

211-
# Copy SOD libraries
212-
COPY --from=builder /lib/libsod.so.1.1.9 /lib/libsod.so.1.1.9
213-
COPY --from=builder /lib/libsod.so.1 /lib/libsod.so.1
214-
COPY --from=builder /lib/libsod.so /lib/libsod.so
211+
# Copy SOD libraries (use /usr/lib/ consistently; on usrmerge systems /lib → /usr/lib)
212+
COPY --from=builder /usr/lib/libsod.so* /usr/lib/
215213

216214
# Copy web assets (copy CONTENTS of dist into /var/lib/lightnvr/www)
217215
COPY --from=builder /opt/web/dist/ /var/lib/lightnvr/www/

0 commit comments

Comments
 (0)