Fix Docker: embed rpath and copy libcups.so.2 into runtime stage (issue #1275)#1582
Conversation
PR OpenPrinting#1153 introduced a multi-stage Dockerfile but left two bugs: 1. libcups.so.2 was not copied into the runtime stage, causing: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory 2. Runtime apt dependencies (openssl, libavahi-client3, etc.) were missing from the runtime stage. Fix: - Pass LDFLAGS='-Wl,-rpath,/usr/lib64' at configure time - Explicitly COPY libcups.so.2 into runtime stage - Install correct runtime packages in runtime stage - Add Browsing No to prevent avahi crash in container - Run ldconfig in runtime stage Fixes OpenPrinting#1275
|
Hi @michaelrsweet Sir, I've been investigating issue #1275 where docker compose up fails After deep analysis I found two root causes from PR #1153:
I tested this fix on Debian Linux:
Also fixed avahi assertion crash (browser.c:245) by adding Would appreciate your review. Thanks! |
- Remove LDFLAGS rpath (not needed, not portable across architectures) - Use make install DESTDIR=/buildroot instead of copying individual files - Add lib64->lib symlink and run ldconfig for library discovery Tested: container stays Up, curl returns HTTP 200
|
Sir @michaelrsweet, Updated the fix based on your review feedback:
Tested on Debian Linux:
Thanks for the review! |
Previous approach used /usr/lib64 which is x86_64 specific and not present in Ubuntu's ldconfig search path. Using --libdir=/usr/lib at configure time ensures libcups.so.2 installs to the standard location that ldconfig finds on all architectures. Also using make install DESTDIR=/buildroot as suggested by @michaelrsweet to copy the entire build root instead of individual files. Tested: container stays Up, curl returns HTTP 200
Problem
Closes #1275
docker compose upstarts but container exits immediately with:/usr/sbin/cupsd: error while loading shared libraries: libcups.so.2:
cannot open shared object file: No such file or directory
Root Causes
were not copied from builder into runtime stage
Fix
Tested