libcups2 of CUPS 2.5.x has incompatible API changes
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:
- Ubuntu 23.10 Mantic, Snap building of ps-printer-app and others.
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?
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) ...
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...
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.