OpenPrinting / cups

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

libcups2 of CUPS 2.5.x has incompatible API changes #802

Closed tillkamppeter closed 4 months ago

tillkamppeter commented 10 months ago

Describe the bug In the libcups2 of CUPS 2.5.x API elements have en removed which existed in libcups2 of CUPS 2.4.x and earlier. The removed elements probably got deprecated and replacement for them added earlier, but they should stay in until the next soname bump (which is already near, libcups3 is already under development).

For example cupsArrayNew(NULL, NULL) does not work any more and needs to get replaced by cupsArrayNew3(NULL, NULL, 0, 0, 0, 0).

To Reproduce Build libcupsfilters 2.0.0 with CUPS 2.4.7 installed and with 2.5b1 (GIT master) installed. In the latter case the build fails.

Expected behavior What was building with libcups2 of CUPS 2.4.x builds also with libcups2 of CUPS 2.5.x.

System Information:

michaelrsweet commented 10 months ago

Code compiled against libcups2 will continue to run, it is just the deprecation that may be interfering with your compile.

What compiler and options are you using?

tillkamppeter commented 10 months ago

The error happens when snapping ps-printer-app, the snapcraft.yaml takes the GIT master of CUPS and therefore uses libcups2 of CUPS 2.5.x.

ps-printer-app-snapcraft-20231018-1.log.txt

The error is near the end of he log file when building the libcupsfilters part:

error: ‘HTTP_URI_OK’ undeclared (first use in this function); did you mean ‘HTTP_TRUST_OK’?

All the rest seem to be warnings, not errors, so it seems that this PR is also weeding out the warnings and not just fixing the error:

https://github.com/OpenPrinting/libcupsfilters/pull/36

By the way, the compiler is gcc, whatever version came with Ubuntu 22.04 LTS (version on which the Snap build is based) ...

michaelrsweet commented 10 months ago

OK, so it looks like this code is using pre-2.0 enum constants - HTTP_URI_OK should be HTTP_URI_STATUS_OK. The old names have been deprecated since CUPS 2.0 and I removed them for 2.5 since they don't affect binary compatibility...

tillkamppeter commented 10 months ago

OK, replacing all occurrences of HTTP_URI_OK by HTTP_URI_STATUS_OK makes libcupsfilters in the Snap build, there are many deprecation warnings but it builds. Thank you very much.