OpenPrinting / pappl-retrofit

PPD/Classic CUPS driver retro-fit Printer Application Library
Apache License 2.0
7 stars 10 forks source link

pappl-retrofit build fails with cups3 #24

Closed pgnd closed 3 months ago

pgnd commented 3 months ago

on the way to building snap-less cups3 hplip-printer-app on linux, i've built & installed

libcups
libcupsfilters
libppd
pappl

installed tree,

tree $_W.out/{lib64,include}
    /builddir/build/BUILD/work.out/lib64
    ├── libcups3.a
    ├── libcups3.so -> libcups3.so.3
    ├── libcups3.so.3
    ├── libcupsfilters.a
    ├── libcupsfilters.la
    ├── libcupsfilters.so -> libcupsfilters.so.2.0.0
    ├── libcupsfilters.so.2 -> libcupsfilters.so.2.0.0
    ├── libcupsfilters.so.2.0.0
    ├── libpappl2.a
    ├── libpappl2.so -> libpappl2.so.2
    ├── libpappl2.so.2
    ├── libppd.a
    ├── libppd.la
    ├── libppd.so -> libppd.so.2.0.0
    ├── libppd.so.2 -> libppd.so.2.0.0
    ├── libppd.so.2.0.0
    └── pkgconfig
        ├── cups3.pc
        ├── libcupsfilters.pc
        ├── libppd.pc
        └── pappl2.pc
    /builddir/build/BUILD/work.out/include
    ├── cupsfilters
    │   ├── bitmap.h
    │   ├── catalog.h
    │   ├── colord.h
    │   ├── colormanager.h
    │   ├── driver.h
    │   ├── filter.h
    │   ├── ieee1284.h
    │   ├── image.h
    │   ├── ipp.h
    │   ├── log.h
    │   ├── pdf.h
    │   └── raster.h
    ├── libcups3
    │   └── cups
    │       ├── array.h
    │       ├── base.h
    │       ├── cups.h
    │       ├── dir.h
    │       ├── dnssd.h
    │       ├── file.h
    │       ├── form.h
    │       ├── http.h
    │       ├── ipp.h
    │       ├── json.h
    │       ├── jwt.h
    │       ├── language.h
    │       ├── ppd.h
    │       ├── pwg.h
    │       ├── raster.h
    │       ├── thread.h
    │       └── transcode.h
    ├── pappl2
    │   └── pappl
    │       ├── base.h
    │       ├── client.h
    │       ├── device.h
    │       ├── job.h
    │       ├── loc.h
    │       ├── log.h
    │       ├── mainloop.h
    │       ├── pappl.h
    │       ├── printer.h
    │       ├── subscription.h
    │       └── system.h
    └── ppd
        ├── ppd-filter.h
        ├── ppd.h
        └── ppdc.h

next, attempting build of

pappl-retrofit

build fails at

./autogen.sh
./configure \
--prefix=${_W}.out \
--libdir=${_W}.out/lib64 \
--with-cups-config=${_W}/cups/cups-config
 make

with

  CC       legacy/printer_app-legacy-printer-app.o
  CC       pappl-retrofit/libpappl_retrofit_la-print-job.lo
  CC       pappl-retrofit/libpappl_retrofit_la-pappl-retrofit.lo
  CC       pappl-retrofit/libpappl_retrofit_la-cups-backends.lo
  CC       pappl-retrofit/libpappl_retrofit_la-cups-side-back-channel.lo
  CC       pappl-retrofit/libpappl_retrofit_la-web-interface.lo
pappl-retrofit/pappl-retrofit.c: In function 'prRetroFitPrinterApp':
pappl-retrofit/pappl-retrofit.c:67:23: warning: passing argument 11 of 'papplMainloop' from incompatible pointer type [-Wincompatible-pointer-types]
   67 |                       _prSystemCB,     // System creation callback
      |                       ^~~~~~~~~~~
      |                       |
      |                       pappl_system_t * (*)(int,  cups_option_t *, void *) {aka struct _pappl_system_s * (*)(int,  struct cups_option_s *, void *)}
In file included from /builddir/build/BUILD/work.out/include/pappl2/pappl/pappl.h:19,
                 from ./pappl-retrofit/pappl-retrofit.h:21,
                 from ./pappl-retrofit/pappl-retrofit-private.h:25,
                 from pappl-retrofit/pappl-retrofit.c:22:
/builddir/build/BUILD/work.out/include/pappl2/pappl/mainloop.h:35:293: note: expected 'pappl_ml_system_cb_t' {aka 'struct _pappl_system_s * (*)(long unsigned int,  struct cups_option_s *, void *)'} but argument is of type 'pappl_system_t * (*)(int,  cups_option_t *, void *)' {aka 'struct _pappl_system_s * (*)(int,  struct cups_option_s *, void *)'}
   35 | extern int      papplMainloop(int argc, char *argv[], const char *version, const char *footer_html, size_t num_drivers, pappl_pr_driver_t *drivers, pappl_pr_autoadd_cb_t autoadd_cb, pappl_pr_driver_cb_t driver_cb, const char *subcmd_name, pappl_ml_subcmd_cb_t subcmd_cb, pappl_ml_system_cb_t system_cb, pappl_ml_usage_cb_t usage_cb, void *data) _PAPPL_PUBLIC;
      |                                                                                                                                                                                                                                                                                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
pappl-retrofit/print-job.c: In function '_prGetFileContentType':
pappl-retrofit/print-job.c:273:14: warning: implicit declaration of function 'papplJobGetFormat'; did you mean 'papplJobGetState'? [-Wimplicit-function-declaration]
  273 |   informat = papplJobGetFormat(job);
      |              ^~~~~~~~~~~~~~~~~
      |              papplJobGetState
pappl-retrofit/print-job.c:273:12: warning: assignment to 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  273 |   informat = papplJobGetFormat(job);
      |            ^
pappl-retrofit/cups-backends.c: In function '_prCUPSDevList':
pappl-retrofit/cups-backends.c:586:32: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 1019 [-Wformat-truncation=]
  586 |                          "cups:%s", uri);
      |                                ^~
pappl-retrofit/cups-backends.c:585:17: note: 'snprintf' output between 6 and 4101 bytes into a destination of size 1024
  585 |                 snprintf(device->device_uri, sizeof(device->device_uri),
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  586 |                          "cups:%s", uri);
      |                          ~~~~~~~~~~~~~~~
pappl-retrofit/print-job.c:281:16: warning: implicit declaration of function 'papplJobGetFilename'; did you mean 'papplJobGetUsername'? [-Wimplicit-function-declaration]
  281 |     filename = papplJobGetFilename(job);
      |                ^~~~~~~~~~~~~~~~~~~
      |                papplJobGetUsername
pappl-retrofit/print-job.c:281:14: warning: assignment to 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  281 |     filename = papplJobGetFilename(job);
      |              ^
pappl-retrofit/print-job.c: In function '_prFilter':
pappl-retrofit/print-job.c:975:17: error: too few arguments to function 'papplJobCreatePrintOptions'
  975 |   job_options = papplJobCreatePrintOptions(job, INT_MAX, 1);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /builddir/build/BUILD/work.out/include/pappl2/pappl/pappl.h:16,
                 from ./pappl-retrofit/pappl-retrofit.h:21,
                 from ./pappl-retrofit/print-job-private.h:21,
                 from pappl-retrofit/print-job.c:22:
/builddir/build/BUILD/work.out/include/pappl2/pappl/job.h:61:28: note: declared here
   61 | extern pappl_pr_options_t *papplJobCreatePrintOptions(pappl_job_t *job, int doc_number, unsigned num_pages, bool color) _PAPPL_PUBLIC;
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
pappl-retrofit/print-job.c:990:12: warning: assignment to 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  990 |   filename = papplJobGetFilename(job);
      |            ^
pappl-retrofit/print-job.c:1002:12: warning: assignment to 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
 1002 |   informat = papplJobGetFormat(job);
      |            ^
pappl-retrofit/print-job.c: In function '_prOneBitDitherOnDraft':
pappl-retrofit/pappl-retrofit.c: In function '_prDriverSetup':
pappl-retrofit/print-job.c:1310:15: warning: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
 1310 |   if (!strcmp(papplJobGetFormat(job), "image/urf") ||
      |               ^~~~~~~~~~~~~~~~~~~~~~
      |               |
      |               int
In file included from /builddir/build/BUILD/work/libcups/cups/http.h:15,
                 from /builddir/build/BUILD/work/libcups/cups/ipp.h:14,
                 from /builddir/build/BUILD/work/libcups/cups/cups.h:15,
                 from /builddir/build/BUILD/work.out/include/pappl2/pappl/base.h:12,
                 from /builddir/build/BUILD/work.out/include/pappl2/pappl/device.h:12,
                 from /builddir/build/BUILD/work.out/include/pappl2/pappl/pappl.h:12:
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
pappl-retrofit/pappl-retrofit.c:1835:7: error: 'PAPPL_PWG_RASTER_TYPE_BLACK_1' undeclared (first use in this function); did you mean 'PAPPL_RASTER_TYPE_BLACK_1'?
 1835 |       PAPPL_PWG_RASTER_TYPE_BLACK_1 | PAPPL_PWG_RASTER_TYPE_SGRAY_8 |
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |       PAPPL_RASTER_TYPE_BLACK_1
pappl-retrofit/pappl-retrofit.c:1835:7: note: each undeclared identifier is reported only once for each function it appears in
pappl-retrofit/print-job.c:1311:15: warning: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
 1311 |       !strcmp(papplJobGetFormat(job), "image/pwg-raster"))
      |               ^~~~~~~~~~~~~~~~~~~~~~
      |               |
      |               int
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
pappl-retrofit/print-job.c:1332:17: warning: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
 1332 |         !strcmp(papplJobGetFormat(job), "image/jpeg") ||
      |                 ^~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 int
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
pappl-retrofit/print-job.c:1333:17: warning: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
 1333 |         !strcmp(papplJobGetFormat(job), "image/png"))
      |                 ^~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 int
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
pappl-retrofit/pappl-retrofit.c:1835:39: error: 'PAPPL_PWG_RASTER_TYPE_SGRAY_8' undeclared (first use in this function); did you mean 'PAPPL_RASTER_TYPE_SGRAY_8'?
 1835 |       PAPPL_PWG_RASTER_TYPE_BLACK_1 | PAPPL_PWG_RASTER_TYPE_SGRAY_8 |
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                       PAPPL_RASTER_TYPE_SGRAY_8
pappl-retrofit/pappl-retrofit.c:1836:7: error: 'PAPPL_PWG_RASTER_TYPE_SRGB_8' undeclared (first use in this function); did you mean 'PAPPL_RASTER_TYPE_SRGB_8'?
 1836 |       PAPPL_PWG_RASTER_TYPE_SRGB_8;
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |       PAPPL_RASTER_TYPE_SRGB_8
pappl-retrofit/pappl-retrofit.c:1901:14: error: 'pappl_pr_driver_data_t' {aka 'struct pappl_pr_driver_data_s'} has no member named 'finishings'
 1901 |   driver_data->finishings = PAPPL_FINISHINGS_NONE;
      |              ^~
make[2]: *** [Makefile:874: pappl-retrofit/libpappl_retrofit_la-print-job.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
pappl-retrofit/pappl-retrofit.c:1919:18: error: 'pappl_pr_driver_data_t' {aka 'struct pappl_pr_driver_data_s'} has no member named 'finishings'
 1919 |       driver_data->finishings |= PAPPL_FINISHINGS_STAPLE;
      |                  ^~
pappl-retrofit/pappl-retrofit.c:1921:18: error: 'pappl_pr_driver_data_t' {aka 'struct pappl_pr_driver_data_s'} has no member named 'finishings'
 1921 |       driver_data->finishings |= PAPPL_FINISHINGS_PUNCH;
      |                  ^~
pappl-retrofit/pappl-retrofit.c:1923:18: error: 'pappl_pr_driver_data_t' {aka 'struct pappl_pr_driver_data_s'} has no member named 'finishings'
 1923 |       driver_data->finishings |= PAPPL_FINISHINGS_TRIM;
      |                  ^~
pappl-retrofit/pappl-retrofit.c: In function '_prSetup':
pappl-retrofit/pappl-retrofit.c:4345:30: warning: passing argument 4 of 'papplSystemAddMIMEFilter' from incompatible pointer type [-Wincompatible-pointer-types]
 4345 |                              _prFilter, global_data);
      |                              ^~~~~~~~~
      |                              |
      |                              _Bool (*)(pappl_job_t *, pappl_device_t *, void *) {aka _Bool (*)(struct _pappl_job_s *, struct _pappl_device_s *, void *)}
In file included from /builddir/build/BUILD/work.out/include/pappl2/pappl/pappl.h:13:
/builddir/build/BUILD/work.out/include/pappl2/pappl/system.h:150:139: note: expected 'pappl_mime_filter_cb_t' {aka '_Bool (*)(struct _pappl_job_s *, int,  struct pappl_pr_options_s *, struct _pappl_device_s *, void *)'} but argument is of type '_Bool (*)(pappl_job_t *, pappl_device_t *, void *)' {aka '_Bool (*)(struct _pappl_job_s *, struct _pappl_device_s *, void *)'}
  150 | extern void             papplSystemAddMIMEFilter(pappl_system_t *system, const char *srctype, const char *dsttype, pappl_mime_filter_cb_t filter_cb, void *data) _PAPPL_PUBLIC;
      |                                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
pappl-retrofit/pappl-retrofit.c:4377:53: warning: passing argument 3 of 'papplDeviceAddScheme' from incompatible pointer type [-Wincompatible-pointer-types]
 4377 |     papplDeviceAddScheme("cups", PAPPL_DEVTYPE_ALL, _prCUPSDevList,
      |                                                     ^~~~~~~~~~~~~~
      |                                                     |
      |                                                     _Bool (*)(_Bool (*)(const char *, const char *, const char *, void *), void *, void (*)(void *, const char *), void *)
In file included from /builddir/build/BUILD/work.out/include/pappl2/pappl/pappl.h:12:
/builddir/build/BUILD/work.out/include/pappl2/pappl/device.h:77:108: note: expected 'pappl_devlist_cb_t' {aka '_Bool (*)(unsigned int,  _Bool (*)(const char *, const char *, const char *, void *), void *, void (*)(void *, const char *), void *)'} but argument is of type '_Bool (*)(_Bool (*)(const char *, const char *, const char *, void *), void *, void (*)(void *, const char *), void *)'
   77 | extern void             papplDeviceAddScheme(const char *scheme, pappl_devtype_t dtype, pappl_devlist_cb_t list_cb, pappl_devopen_cb_t open_cb, pappl_devclose_cb_t close_cb, pappl_devread_cb_t read_cb, pappl_devwrite_cb_t write_cb, pappl_devstatus_cb_t status_cb, pappl_devid_cb_t id_cb) _PAPPL_PUBLIC;
      |                                                                                         ~~~~~~~~~~~~~~~~~~~^~~~~~~
pappl-retrofit/pappl-retrofit.c:4378:26: warning: passing argument 4 of 'papplDeviceAddScheme' from incompatible pointer type [-Wincompatible-pointer-types]
 4378 |                          _prCUPSDevOpen, _prCUPSDevClose, _prCUPSDevRead,
      |                          ^~~~~~~~~~~~~~
      |                          |
      |                          _Bool (*)(pappl_device_t *, const char *, const char *) {aka _Bool (*)(struct _pappl_device_s *, const char *, const char *)}
/builddir/build/BUILD/work.out/include/pappl2/pappl/device.h:77:136: note: expected 'pappl_devopen_cb_t' {aka '_Bool (*)(struct _pappl_device_s *, const char *, struct _pappl_job_s *)'} but argument is of type '_Bool (*)(pappl_device_t *, const char *, const char *)' {aka '_Bool (*)(struct _pappl_device_s *, const char *, const char *)'}
   77 | extern void             papplDeviceAddScheme(const char *scheme, pappl_devtype_t dtype, pappl_devlist_cb_t list_cb, pappl_devopen_cb_t open_cb, pappl_devclose_cb_t close_cb, pappl_devread_cb_t read_cb, pappl_devwrite_cb_t write_cb, pappl_devstatus_cb_t status_cb, pappl_devid_cb_t id_cb) _PAPPL_PUBLIC;
      |                                                                                                                     ~~~~~~~~~~~~~~~~~~~^~~~~~~
make[2]: *** [Makefile:867: pappl-retrofit/libpappl_retrofit_la-pappl-retrofit.lo] Error 1
make[1]: *** [Makefile:1102: all-recursive] Error 1
make: *** [Makefile:594: all] Error 2

where (automatically set),

grep PAPPL.*= Makefile
    PAPPL_CFLAGS = -I/builddir/build/BUILD/work.out/include/pappl2 -I/builddir/build/BUILD/work.out/include/libcups3 -I/usr/include/libpng16 -I/usr/include/libusb-1.0
    PAPPL_LIBS = -L/builddir/build/BUILD/work.out/lib64 -lpappl2 -lcups3

cc: @metabiswadeep

szlt5 commented 3 months ago

Maybe you should build and link against pappl-1.4.x.

tillkamppeter commented 3 months ago

Note that up to now pappl-retrofit got only tested against PAPPL 1.4.x. PAPPL 2.x as a new API generation has changes in the API and support this needs to get added to pappl-retrofit.

pgnd commented 3 months ago

@tillkamppeter

can you confirm which version of PAPPL the cups3 snaps are currently built with? sounds like !v2x, but v1x ...

tillkamppeter commented 3 months ago

Which "cups3 Snaps"?

tillkamppeter commented 3 months ago

Generally, to know hat a Snap is composed of, check the Snap's GIT repository and see the snapcraft.yaml.

pgnd commented 3 months ago

Which "cups3 Snaps"?

and there's the basis for my self-inflicted problems.

i misunderstood that the cups snaps WERE 'cups3', based on libcup3/pappl2 already. my bad; not the case, yet.

tillkamppeter commented 3 months ago

The current CUPS Snap (repository "cups-snap") is the current stable CUPS 2.x release, 2.4.7. The Snap gets automatically updated every time if one of its components has a new release, but generation changes (for example CUPS 2.x -> 3.x) are excluded from auto-updating.

pgnd commented 3 months ago

is the current stable CUPS 2.x release, 2.4.7

thx for the clarification.

i'd already tried a build against the 2x-family master branch(es)

i got through the prereqs ok, but @ pappl-retrofit, still

./configure ...
    ...
    ==============================================================================
    Environment settings:
            CFLAGS:             -I. -I/builddir/build/BUILD/work.out/include -I/usr/local/include -I/usr/include -Wall -std=gnu11 -D_GNU_SOURCE
            LDFLAGS:          -L/builddir/build/BUILD/work.out/lib64 -L/usr/local/lib64 -L/usr/lib64 -lcrypto -lssl
    Build configuration:
            libcups:         2.5b1
            cups-config:     system
            legacy-printer-app as daemon: yes
            legacy-printer-app w/ PAPPL backends: yes
            systemd unitdir: /usr/lib/systemd/system
            log file: -
            server options: multi-queue,web-interface
            auth service: none
            admin group: none
    ==============================================================================

 make
    ...
    config.status: creating config.h
    config.status: config.h is unchanged
      CC       pappl-retrofit/libpappl_retrofit_la-pappl-retrofit.lo
      CC       legacy/printer_app-legacy-printer-app.o
      CC       pappl-retrofit/libpappl_retrofit_la-print-job.lo
      CC       pappl-retrofit/libpappl_retrofit_la-cups-backends.lo
      CC       pappl-retrofit/libpappl_retrofit_la-web-interface.lo
    In file included from legacy/legacy-printer-app.c:19:
    ./pappl-retrofit/libcups2-private.h:62:6: error: redeclaration of ‘enum http_resolve_e’
       62 | enum http_resolve_e                     // @link httpResolveURI@ options bit values
          |      ^~~~~~~~~~~~~~
    In file included from /builddir/build/BUILD/work.out/include/cups/ipp.h:14,
                     from /builddir/build/BUILD/work.out/include/cups/cups.h:23,
                     from /builddir/build/BUILD/work.out/include/pappl/base.h:12,
                     from /builddir/build/BUILD/work.out/include/pappl/device.h:12,
                     from /builddir/build/BUILD/work.out/include/pappl/pappl.h:12,
                     from ./pappl-retrofit/pappl-retrofit.h:21,
                     from legacy/legacy-printer-app.c:18:
    /builddir/build/BUILD/work.out/include/cups/http.h:185:6: note: originally defined here
      185 | enum http_resolve_e                     // @link httpResolveURI@ options bit values
          |      ^~~~~~~~~~~~~~
    ./pappl-retrofit/libcups2-private.h:64:3: error: redeclaration of enumerator ‘HTTP_RESOLVE_DEFAULT’
       64 |   HTTP_RESOLVE_DEFAULT = 0,             // Resolve with default options
          |   ^~~~~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/work.out/include/cups/http.h:187:3: note: previous definition of ‘HTTP_RESOLVE_DEFAULT’ with type ‘enum http_resolve_e’
      187 |   HTTP_RESOLVE_DEFAULT = 0,             // Resolve with default options
          |   ^~~~~~~~~~~~~~~~~~~~
    ./pappl-retrofit/libcups2-private.h:65:3: error: redeclaration of enumerator ‘HTTP_RESOLVE_FQDN’
       65 |   HTTP_RESOLVE_FQDN = 1,                // Resolve to a FQDN
          |   ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/work.out/include/cups/http.h:188:3: note: previous definition of ‘HTTP_RESOLVE_FQDN’ with type ‘enum http_resolve_e’
    ...

i'll explore the snap build further, AND drop further back to the stable releases, and give that a try.

generation changes (for example CUPS 2.x -> 3.x) are excluded from auto-updating

noted.

closing this for now.