OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
1.01k stars 181 forks source link

Cannot build and run local Debian-based or Docker #1021

Open cosad3s opened 1 month ago

cosad3s commented 1 month ago

Describe the bug

Cannot correctly run or build systemv binaries from both local Debian-based system or Docker container.

Got errors :

To Reproduce

Local build:

No error from:

❯ git clone https://github.com/OpenPrinting/cups
❯ cd cups
❯ sudo apt-get install autoconf build-essential libavahi-client-dev      libgnutls28-dev libkrb5-dev libnss-mdns libpam-dev     
 libsystemd-dev libusb-1.0-0-dev zlib1g-dev
❯ ./configure
❯ make

Output of configure/make:

❯ ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for codesign... no
checking for true... /usr/bin/true
checking for gawk... gawk
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking how to run the C preprocessor... gcc -E
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking for ranlib... ranlib
checking for ar... /usr/bin/ar
checking for chmod... /usr/bin/chmod
checking for gzip... /usr/bin/gzip
checking for install-sh script... using /home/seb/Documents/research/cups2/cups/install-sh
checking for ld... /usr/bin/ld
checking for ln... /usr/bin/ln
checking for mkdir... /usr/bin/mkdir
checking for mv... /usr/bin/mv
checking for rm... /usr/bin/rm
checking for rmdir... /usr/bin/rmdir
checking for sed... /usr/bin/sed
checking for xdg-open... /usr/bin/xdg-open
checking for pkg-config... /usr/bin/pkg-config
checking for library containing abs... none required
checking for library containing crypt... -lcrypt
checking for library containing fmod... -lm
checking for library containing getspent... none required
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for langinfo.h... yes
checking for malloc.h... yes
checking for stdint.h... (cached) yes
checking for sys/ioctl.h... yes
checking for sys/param.h... yes
checking for sys/ucred.h... no
checking for iconv.h... yes
checking for library containing iconv_open... none required
checking for library containing libiconv_open... no
checking for sys/mount.h... yes
checking for sys/statfs.h... yes
checking for sys/statvfs.h... yes
checking for sys/vfs.h... yes
checking for statfs... yes
checking for statvfs... yes
checking for random... yes
checking for lrand48... yes
checking for arc4random... yes
checking for geteuid... yes
checking for setpgid... yes
checking for vsyslog... yes
checking for waitpid... yes
checking for wait3... yes
checking for posix_spawn... yes
checking for getgrouplist... yes
checking for tm_gmtoff member in tm structure... yes
checking for st_gen member in stat structure... no
checking for removefile... no
checking for libusb-1.0... yes
checking for zlib.h... yes
checking for inflateCopy in -lz... yes
checking for library containing acl_init... -lacl
checking for DBUS... yes
checking for dbus_message_iter_init_append... yes
checking for dbus_threads_init_default... yes
checking whether compiler supports -fstack-protector-strong... yes
checking whether compiler supports -fPIE... yes
checking whether compiler supports -Wno-char-subscripts... yes
checking whether compiler supports -Wno-deprecated-declarations... yes
checking whether compiler supports -Wno-format-truncation... yes
checking whether compiler supports -Wno-format-y2k... yes
checking whether compiler supports -Wno-switch... yes
checking whether compiler supports -Wno-unused-result... yes
checking for resolv.h... yes
checking for library containing socket... none required
checking for library containing gethostbyaddr... none required
checking for library containing getifaddrs... none required
checking for library containing hstrerror... none required
checking for library containing __res_init... none required
checking for struct sockaddr.sa_len... no
checking for sys/sockio.h... no
checking for pthread.h... yes
checking for pthread_create using -lpthreads... no
checking for pthread_create using -lpthread... yes
checking for openssl package... yes
configure:     Using TLSLIBS="-lssl -lcrypto "
configure:     Using TLSFLAGS=""
checking for dlopen in -ldl... yes
checking for pam_start in -lpam... yes
checking for pam_set_item in -lpam... yes
checking for pam_setcred in -lpam... yes
checking for security/pam_appl.h... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for long long int... yes
checking for strtoll... yes
checking for dns_sd.h... no
checking for Avahi client... yes
checking for libapparmor... checking for libsystemd... yes
checking for systemd/sd-journal.h... yes
checking for default print user... lp
checking for default print group... lp
checking for default system groups... "lpadmin sys root"
configure: creating ./config.status
config.status: creating Makedefs
config.status: creating conf/cups-files.conf
config.status: creating conf/cupsd.conf
config.status: creating conf/mime.convs
config.status: creating conf/pam.std
config.status: creating conf/snmp.conf
config.status: creating cups.pc
config.status: creating cups-config
config.status: creating desktop/cups.desktop
config.status: creating doc/index.html
config.status: creating scheduler/cups-lpd.xinetd
config.status: creating scheduler/cups.sh
config.status: creating scheduler/cups.xml
config.status: creating scheduler/org.cups.cups-lpd.plist
config.status: creating scheduler/cups-lpdAT.service
config.status: creating scheduler/cups.path
config.status: creating scheduler/cups.service
config.status: creating scheduler/cups.socket
config.status: creating templates/header.tmpl
config.status: creating packaging/cups.list
config.status: creating doc/da/index.html
config.status: creating templates/da/header.tmpl
config.status: creating doc/de/index.html
config.status: creating templates/de/header.tmpl
config.status: creating doc/es/index.html
config.status: creating templates/es/header.tmpl
config.status: creating doc/fr/index.html
config.status: creating templates/fr/header.tmpl
config.status: creating doc/ja/index.html
config.status: creating templates/ja/header.tmpl
config.status: creating doc/pl/index.html
config.status: creating templates/pl/header.tmpl
config.status: creating doc/pt_BR/index.html
config.status: creating templates/pt_BR/header.tmpl
config.status: creating doc/ru/index.html
config.status: creating templates/ru/header.tmpl
config.status: creating config.h

❯ make
Using ARCHFLAGS=
Using ALL_CFLAGS=-I.. -D_CUPS_SOURCE -I/usr/include/libusb-1.0  -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include  -DDBUS_API_SUBJECT_TO_CHANGE -D_FORTIFY_SOURCE=3 -D_REENTRANT   -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT  -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result
Using ALL_CXXFLAGS=-I.. -D_CUPS_SOURCE -D_FORTIFY_SOURCE=3  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT  -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result
Using CC=gcc
Using CXX=gcc
Using DSOFLAGS=-Wl,-soname,all -shared
Using LDFLAGS=
Using LIBS= -lavahi-common -lavahi-client  -lssl -lcrypto  -lz -lpthread -lm -lcrypt   -lz
Making all in cups...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/cups »
Compiling raster-interstub.c...
Compiling raster-stubs.c...
Compiling array.c...
Compiling auth.c...
Compiling debug.c...
Compiling dest.c...
Compiling dest-job.c...
Compiling dest-localization.c...
Compiling dest-options.c...
Compiling dir.c...
Compiling dnssd.c...
Compiling encode.c...
Compiling file.c...
Compiling form.c...
Compiling getputfile.c...
Compiling globals.c...
Compiling hash.c...
Compiling http.c...
Compiling http-addr.c...
Compiling http-addrlist.c...
Compiling http-support.c...
Compiling ipp.c...
Compiling ipp-file.c...
Compiling ipp-support.c...
Compiling json.c...
Compiling jwt.c...
Compiling langprintf.c...
Compiling language.c...
Compiling md5.c...
Compiling md5passwd.c...
Compiling notify.c...
Compiling options.c...
Compiling pwg-media.c...
Compiling rand.c...
Compiling raster-error.c...
Compiling raster-stream.c...
Compiling request.c...
Compiling string.c...
Compiling tempfile.c...
Compiling thread.c...
Compiling tls.c...
Compiling transcode.c...
Compiling usersys.c...
Compiling util.c...
Compiling adminutil.c...
Compiling backchannel.c...
Compiling backend.c...
Compiling getdevices.c...
Compiling getifaddrs.c...
Compiling ppd.c...
Compiling ppd-attr.c...
Compiling ppd-cache.c...
In file included from /usr/include/stdio.h:964,
                 from string-private.h:15,
                 from cups-private.h:14,
                 from ppd-cache.c:11:
In function ‘snprintf’,
    inlined from ‘_ppdCacheCreateWithPPD’ at ppd-cache.c:1502:7:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:54:10: warning: ‘pwg_name’ may be used uninitialized [-Wmaybe-uninitialized]
   54 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
ppd-cache.c: In function ‘_ppdCacheCreateWithPPD’:
ppd-cache.c:1045:26: note: ‘pwg_name’ was declared here
 1045 |   const char            *pwg_name;      /* Standard PWG media name */
      |                          ^~~~~~~~
Compiling ppd-conflicts.c...
Compiling ppd-custom.c...
Compiling ppd-emit.c...
Compiling ppd-localize.c...
Compiling ppd-mark.c...
Compiling ppd-page.c...
Compiling ppd-util.c...
Compiling raster-interpret.c...
Compiling sidechannel.c...
Compiling snmp.c...
Linking libcups.so.2...
Linking libcupsimage.so.2...
Archiving libcups.a...
a - array.o
a - auth.o
a - debug.o
a - dest.o
a - dest-job.o
a - dest-localization.o
a - dest-options.o
a - dir.o
a - dnssd.o
a - encode.o
a - file.o
a - form.o
a - getputfile.o
a - globals.o
a - hash.o
a - http.o
a - http-addr.o
a - http-addrlist.o
a - http-support.o
a - ipp.o
a - ipp-file.o
a - ipp-support.o
a - json.o
a - jwt.o
a - langprintf.o
a - language.o
a - md5.o
a - md5passwd.o
a - notify.o
a - options.o
a - pwg-media.o
a - rand.o
a - raster-error.o
a - raster-stream.o
a - raster-stubs.o
a - request.o
a - string.o
a - tempfile.o
a - thread.o
a - tls.o
a - transcode.o
a - usersys.o
a - util.o
a - adminutil.o
a - backchannel.o
a - backend.o
a - getdevices.o
a - getifaddrs.o
a - ppd.o
a - ppd-attr.o
a - ppd-cache.o
a - ppd-conflicts.o
a - ppd-custom.o
a - ppd-emit.o
a - ppd-localize.o
a - ppd-mark.o
a - ppd-page.o
a - ppd-util.o
a - raster-interpret.o
a - raster-interstub.o
a - sidechannel.o
a - snmp.o
Archiving libcupsimage.a...
a - raster-interstub.o
a - raster-stubs.o
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/cups »
Making all in tools...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/tools »
Compiling ippevepcl.c...
Linking ippevepcl...
Compiling ippeveps.c...
Linking ippeveps...
Compiling ippeveprinter.c...
Linking ippeveprinter...
Compiling ippfind.c...
Linking ippfind...
Compiling ipptool.c...
Linking ipptool...
Linking ippeveprinter-static...
Linking ipptool-static...
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/tools »
Making all in filter...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/filter »
Compiling commandtops.c...
Linking commandtops...
Compiling gziptoany.c...
Linking gziptoany...
Compiling pstops.c...
Compiling common.c...
Linking pstops...
Compiling rastertoepson.c...
Linking rastertoepson...
Compiling rastertohp.c...
Linking rastertohp...
Compiling rastertolabel.c...
Linking rastertolabel...
Compiling rastertopwg.c...
Linking rastertopwg...
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/filter »
Making all in backend...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/backend »
Compiling ieee1284.c...
Compiling network.c...
Compiling runloop.c...
Compiling snmp-supplies.c...
Archiving libbackend.a...
a - ieee1284.o
a - network.o
a - runloop.o
a - snmp-supplies.o
Compiling ipp.c...
Linking ipp...
Compiling lpd.c...
Linking lpd...
Compiling usb.c...
Linking usb...
Compiling dnssd.c...
Linking dnssd...
Compiling snmp.c...
Linking snmp...
Compiling socket.c...
Linking socket...
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/backend »
Making all in berkeley...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/berkeley »
Compiling lpc.c...
Linking lpc...
Compiling lpq.c...
Linking lpq...
Compiling lpr.c...
Linking lpr...
Compiling lprm.c...
Linking lprm...
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/berkeley »
Making all in cgi-bin...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/cgi-bin »
Compiling help-index.c...
Compiling html.c...
Compiling ipp-var.c...
Compiling search.c...
search.c: In function ‘cgiCompileSearch’:
search.c:191:29: warning: pointer ‘s’ may be used after ‘realloc’ [-Wuse-after-free]
  191 |         sptr = temp + (sptr - s);
      |                       ~~~~~~^~~~
search.c:179:24: note: call to ‘realloc’ here
  179 |         temp = (char *)realloc(s, slen);
      |                        ^~~~~~~~~~~~~~~~
Compiling template.c...
Compiling var.c...
Archiving libcupscgi.a...
a - help-index.o
a - html.o
a - ipp-var.o
a - search.o
a - template.o
a - var.o
Compiling admin.c...
Linking admin.cgi...
Compiling classes.c...
Linking classes.cgi...
Compiling help.c...
Linking help.cgi...
Compiling jobs.c...
Linking jobs.cgi...
Compiling printers.c...
Linking printers.cgi...
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/cgi-bin »
Making all in monitor...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/monitor »
Compiling bcp.c...
Linking bcp...
Compiling tbcp.c...
Linking tbcp...
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/monitor »
Making all in notifier...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/notifier »
Compiling dbus.c...
Linking dbus...
Compiling mailto.c...
Linking mailto...
Compiling rss.c...
Linking rss...
Compiling testnotify.c...
Linking testnotify...
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/notifier »
Making all in ppdc...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/ppdc »
Compiling ppdc-array.cxx...
Compiling ppdc-attr.cxx...
Compiling ppdc-catalog.cxx...
Compiling ppdc-choice.cxx...
Compiling ppdc-constraint.cxx...
Compiling ppdc-driver.cxx...
Compiling ppdc-file.cxx...
Compiling ppdc-filter.cxx...
Compiling ppdc-font.cxx...
Compiling ppdc-group.cxx...
Compiling ppdc-import.cxx...
Compiling ppdc-mediasize.cxx...
Compiling ppdc-message.cxx...
Compiling ppdc-option.cxx...
Compiling ppdc-profile.cxx...
Compiling ppdc-shared.cxx...
Compiling ppdc-source.cxx...
Compiling ppdc-string.cxx...
Compiling ppdc-variable.cxx...
Archiving libcupsppdc.a...
a - ppdc-array.o
a - ppdc-attr.o
a - ppdc-catalog.o
a - ppdc-choice.o
a - ppdc-constraint.o
a - ppdc-driver.o
a - ppdc-file.o
a - ppdc-filter.o
a - ppdc-font.o
a - ppdc-group.o
a - ppdc-import.o
a - ppdc-mediasize.o
a - ppdc-message.o
a - ppdc-option.o
a - ppdc-profile.o
a - ppdc-shared.o
a - ppdc-source.o
a - ppdc-string.o
a - ppdc-variable.o
Compiling ppdc.cxx...
Linking ppdc...
Compiling ppdhtml.cxx...
Linking ppdhtml...
Compiling ppdi.cxx...
Linking ppdi...
Compiling ppdmerge.cxx...
Linking ppdmerge...
Compiling ppdpo.cxx...
Linking ppdpo...
Compiling genstrings.cxx...
Linking genstrings...
Generating localization strings...
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/ppdc »
Making all in scheduler...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/scheduler »
Compiling filter.c...
Compiling mime.c...
Compiling type.c...
Archiving libcupsmime.a...
a - filter.o
a - mime.o
a - type.o
Compiling auth.c...
Compiling banners.c...
Compiling cert.c...
Compiling classes.c...
Compiling client.c...
Compiling colorman.c...
Compiling conf.c...
Compiling dirsvc.c...
Compiling env.c...
Compiling file.c...
Compiling main.c...
Compiling ipp.c...
Compiling listen.c...
Compiling job.c...
Compiling log.c...
Compiling network.c...
Compiling policy.c...
Compiling printers.c...
Compiling process.c...
Compiling quotas.c...
Compiling select.c...
Compiling server.c...
Compiling statbuf.c...
Compiling subscriptions.c...
Compiling sysman.c...
Linking cupsd...
Compiling cupsfilter.c...
Linking cupsfilter...
Compiling cups-deviced.c...
Compiling util.c...
Linking cups-deviced...
Compiling cups-driverd.cxx...
Linking cups-driverd...
Compiling cups-exec.c...
Linking cups-exec...
Compiling cups-lpd.c...
Linking cups-lpd...
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/scheduler »
Making all in systemv...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/systemv »
Compiling cancel.c...
Linking cancel...
Compiling cupsaccept.c...
Linking cupsaccept...
Compiling cupsctl.c...
Linking cupsctl...
Compiling cupstestppd.c...
Linking cupstestppd...
Compiling lp.c...
Linking lp...
Compiling lpadmin.c...
Linking lpadmin...
Compiling lpinfo.c...
Linking lpinfo...
Compiling lpmove.c...
Linking lpmove...
Compiling lpoptions.c...
Linking lpoptions...
Compiling lpstat.c...
Linking lpstat...
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/systemv »
Making all in conf...
Making all in data...
Making all in desktop...
Making all in locale...
make[1] : on entre dans le répertoire « /home/seb/Documents/research/cups2/cups/locale »
Compiling checkpo.c...
Linking checkpo...
Compiling po2strings.c...
Linking po2strings...
make[1] : on quitte le répertoire « /home/seb/Documents/research/cups2/cups/locale »
Making all in man...
Making all in doc...
Making all in examples...
Making all in templates...

Then:

❯ ./systemv/lp
./systemv/lp: symbol lookup error: ./systemv/lp: undefined symbol: cupsGetErrorString

Docker:

Build:

❯ git clone https://github.com/OpenPrinting/cups
❯ cd cups
❯ docker-compose up -d
[+] Building 0.0s (0/0)                                                                                                                 docker:default
[+] Running 1/1
 ✔ Container cups  Started

Log check:

(...)
make[1]: Leaving directory '/workspaces/cups/systemv'
Installing programs in conf...
Installing programs in data...
Installing programs in desktop...
Installing programs in locale...
Installing programs in man...
Installing programs in doc...
Installing programs in examples...
Installing programs in templates...
/usr/sbin/cupsd: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory

Expected behavior

Should build and run for Docker and local Debian-based system.

System Information:

❯ uname -a
Linux kali 6.6.15-amd64 #1 SMP PREEMPT_DYNAMIC Kali 6.6.15-2kali1 (2024-05-17) x86_64 GNU/Linux
michaelrsweet commented 1 month ago

Unless you build with the "--disable-shared" option, you need to install the software and run "ldconfig".