Configure CUPS but ghostscript installation ghostscript-agpl-9.50-base broken and conflicting with ghostscript9-base

Hi folks, I've a strange problem with ghostscript, which I need to install a cups printer under FreeBSD 12.1.

Code:
uname -a
FreeBSD damara.bigopensky.de 12.1-RELEASE FreeBSD 12.1-RELEASE r354233 GENERIC  amd64

To get a valid configuration and tools for the cups-printer-render-pipline, I need ghostscript. The newest version in the ports is ghostscript9-apgl-base and a lot of programs like cups, hplip which I need have dependencies.

In my setup I use the cupsd to print files to my HP-CM-6030-MFP device with the PPD: hp-color_laserjet_cm6030_mfp-pcl3.ppd . Under Linux (Debian 8,9) it works with great success and out of the box. But under FreeBSD I get (some more) gray hairs. At least nothing will go though the cups pipeline under FreeBSD and /var/log/cup/error_log shows me an ERROR marked with the statement "Filter failed" (..see at the end of the post) . The reason is, that ghostscript won't work correct at the pdf2ps stage, which is part of the (/usr/local/libexec/cups/filter/gstoraster) filter to create PCL code. I've broken down the problem in some steps and I see that configuration of gs is the trouble maker.

If I use the ghostscript9-agpl-base-9.50 setup out of the box (pkg install) or (/usr/ports/printghostscript9-agpl-base make install clean) , gs is delivered to the system in an unconfigured way:

A test away from the CUPS:

pdf2ps -f 1 -l 1 input.pdf output.ps

gives me the same initialization error:

Code:
While reading gs_ll3.ps:
Error: /undefinedresource in findresource
Operand stack:
   (gs_icc.ps\000gs_mex_e.ps\000gs_mro_e.ps\000gs_pdf_e.ps\000gs_wan_e.ps\000pdf_ops.ps\000pdf_rbld.ps\000pdf_base.ps\000pdf_draw.ps\000gs_cff.ps\000gs_mgl_e.ps\000gs_ttf.ps\000pdf_font.ps\000pdf_main.ps\000pdf_sec.ps\000gs_epsf.ps\000gs_pdfwr.ps)   (gs_ll3.ps)   1   Pscript5Idiom.pkgsave   IdiomSet   6   Pscript5Idiom.pkgsave
Execution stack:

what means NO initialization setup and variables GS_LIB_DEFAULT, GS_LIB, GS_FONTS... are present. The same tool is called before the "prnt/hpcups/HPCupsFilter.cpp" can read the PCL5 raster. Even the classical tiger-runtime-test won't work out of the box.

gs /usr/local/share/ghostscript/9.50/examples/tiger.eps

..same statement :
While reading gs_ll3.ps:
Error: /undefinedresource in findresource
..
[/CMD]

If I use ghostscript9-base (ports) aka ghostscript9-base-9.06_14 (pkg), it works out of the box and the test shows me correctly the big Asian cat or a properly from PDF converted PS. But unfortunately nobody want to play with this ghostscript9-base-buddy, because the hplip dependencies are pointing to the newer and shiny ghoststript9-agpl-base-9.50 package.

So what have I exactly to do, to get the tools of the ghostscript9-apgl-base package running or are there some configuration steps to correct the behavior of ghoststript9-agpl-base-9.50 installation.

Thank you in advance and best regards huckfinn


ERROR_LOG FACHSIMILE

Code:
D [16/Mar/2020:15:57:37 +0100] [Job 19] envp[2]="CUPS_DOCROOT=/usr/local/share/doc/cups"
:
D [16/Mar/2020:15:52:49 +0100] [Job 18] true   (gs_icc.ps\\000gs_mex_e.ps\\000gs_mro_e.ps\\000gs_pdf_e.ps\\000gs_wan_e.ps\\000pdf_ops.ps\\000pdf_rbld.ps\\000pdf_base.ps\\000pdf_draw.ps\\000gs_cff.ps\\000gs_mgl_e.ps\\000gs_ttf.ps\\000pdf_font.ps\\000pdf_main.ps\\000pdf_sec.ps\\000gs_epsf.ps\\000gs_pdfwr.ps)   (gs_ll3.ps)   1   Pscript5Idiom.pkgsave   IdiomSet   7   Pscript5Idiom.pkgsave
D [16/Mar/2020:15:52:49 +0100] [Job 18] Execution stack:
D [16/Mar/2020:15:52:49 +0100] [Job 18] %interp_exit   --nostringval--   findresource   %loop_continue   findresource   findresource   findresource   false   1   %stopped_push   --nostringval--   1902   8   5   %oparray_pop   findresource   findresource   --dict:16/18(ro)(G)--   --dict:2/2(G)--   findresource   1   %dict_continue   findresource   findresource   1900   6   5   %oparray_pop   findresource   %errorexec_pop   findresource   findresource   findresource   findresource
D [16/Mar/2020:15:52:49 +0100] [Job 18] Dictionary stack:
D [16/Mar/2020:15:52:49 +0100] [Job 18] --dict:959/1123(G)--   --dict:0/20(G)--   --dict:71/200(L)--   --dict:959/1123(G)--   --dict:38/43(G)--   --dict:16/18(ro)(G)--
D [16/Mar/2020:15:52:49 +0100] [Job 18] Current allocation mode is global
D [16/Mar/2020:15:52:49 +0100] [Job 18] Current file position is 18941
D [16/Mar/2020:15:52:49 +0100] [Job 18] prnt/hpcups/HPCupsFilter.cpp 568: cupsRasterOpen failed, fd = 0
D [16/Mar/2020:15:52:49 +0100] [Job 18] PID 14565 (/usr/local/libexec/cups/filter/gstoraster) stopped with status 1.
D [16/Mar/2020:15:52:49 +0100] [Job 18] Hint: Try setting the LogLevel to "debug" to find out more.
D [16/Mar/2020:15:52:49 +0100] [Job 18] PID 14814 (/usr/local/libexec/cups/filter/hpcups) stopped with status 1.
D [16/Mar/2020:15:52:49 +0100] [Job 18] Hint: Try setting the LogLevel to "debug" to find out more.
D [16/Mar/2020:15:52:49 +0100] [Job 18] PID 15088 (/usr/local/libexec/cups/backend/socket) exited with no errors.
D [16/Mar/2020:15:52:49 +0100] [Job 18] End of messages
D [16/Mar/2020:15:52:49 +0100] [Job 18] printer-state=3(idle)
D [16/Mar/2020:15:52:49 +0100] [Job 18] printer-state-message="Filter failed"
D [16/Mar/2020:15:52:49 +0100] [Job 18] printer-state-reasons=none
 
If I use the ghostscript9-agpl-base-9.50 setup out of the box (pkg install) or (/usr/ports/printghostscript9-agpl-base make install clean)
Please upgrade pkg and/or ports ghostscript9-agpl-base first.
Quarterly branch is at version 9.52_1 ( port, package ),
head ports is at version 9.52_5,
latest package is at version 9.52_4.

Executing on 12.1-RELEASE-p5
pdf2ps -f 1 -l 1 input.pdf output.ps

returns:
Usage: pdf2ps [-dASCII85EncodePages=false] [-dLanguageLevel=1|2|3] input.pdf [output.ps]

I'm tracking latest package repository:

pkg info -E cups cups-filters ghostscript9-agpl-base
Code:
cups-2.2.13
cups-filters-1.27.4_1
ghostscript9-agpl-base-9.52_4

No complains from ghostscript9-agpl-base here.
 
Code:
pkg info -D cups cups-filters ghostscript9-agpl-base
cups-2.2.13:
cups-filters-1.27.4_1:
ghostscript9-agpl-base-9.52_4:

And I get the same error:

Code:
gs /usr/local/share/ghostscript/9.50/examples/tiger.eps
GPL Ghostscript 9.52 (2020-03-19)
Copyright (C) 2020 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
While reading gs_ll3.ps:
Error: /undefinedresource in findresource
Operand stack:
   (gs_icc.ps\000gs_mex_e.ps\000gs_mro_e.ps\000gs_pdf_e.ps\000gs_wan_e.ps\000pdf_ops.ps\000pdf_rbld.ps\000pdf_base.ps\000pdf_draw.ps\000gs_cff.ps\000gs_mgl_e.ps\000gs_ttf.ps\000pdf_font.ps\000pdf_main.ps\000pdf_sec.ps\000gs_epsf.ps\000gs_pdfwr.ps)   (gs_ll3.ps)   1   Pscript5Idiom.pkgsave   IdiomSet   6   Pscript5Idiom.pkgsave
Execution stack:
   %interp_exit   --nostringval--   findresource   %loop_continue   findresource   findresource   findresource   false   1   %stopped_push   --nostringval--   1902   7   5   %oparray_pop   findresource   findresource   --dict:16/18(ro)(G)--   --dict:2/2(G)--   findresource   1   %dict_continue   findresource   findresource   1900   5   5   %oparray_pop   findresource   %errorexec_pop   findresource   findresource   findresource   findresource
Dictionary stack:
   --dict:943/1123(G)--   --dict:0/20(G)--   --dict:77/200(L)--   --dict:943/1123(G)--   --dict:38/43(G)--   --dict:16/18(ro)(G)--
Current allocation mode is global
Current file position is 18941

There has to be an undeclared dependency somewhere.
 
gs /usr/local/share/ghostscript/9.50/examples/tiger.eps
GPL Ghostscript 9.52 (2020-03-19)
That looks like leftovers from a previous ghostscript9 installation. I suspect there are conflicting files with your current ghostscript9-agpl-base ( 9.52_4). That ghostscript directory should look like this:

Code:
ls /usr/local/share/ghostscript/
9.52

ls /usr/local/share/ghostscript/9.52
doc         iccprofiles lib         Resource

Check with pkg which /usr/local/share/ghostscript/9.50/examples/tiger.eps if that package to whom it belongs exists. If there is a package delete it, if not delete under /usr/local/share/ghostscript all but 9.52/
 
That was a cut and paste error. I discovered that there is no /usr/local/share/ghostscript/9.52/examples/ directory.
Code:
ll /usr/local/share/ghostscript/
total 17
drwxr-xr-x  4 root  wheel    8 Jun  4 12:55 9.52
drwxr-xr-x  2 root  wheel  162 Jun  2 12:57 fonts

Code:
ll /usr/local/share/ghostscript/9.52/
total 19
drwxr-xr-x  11 root  wheel   13 Jun  4 12:55 Resource
lrwxr-xr-x   1 root  wheel   26 Jun  1 21:22 doc -> ../../doc/ghostscript/9.52
lrwxr-xr-x   1 root  wheel   26 May 11 21:23 doc.pkgsave -> ../../doc/ghostscript/9.52
lrwxr-xr-x   1 root  wheel   27 Jun  1 21:22 iccprofiles -> ../../color/icc/ghostscript
lrwxr-xr-x   1 root  wheel   27 May 11 21:23 iccprofiles.pkgsave -> ../../color/icc/ghostscript
drwxr-xr-x   2 root  wheel  318 Jun  4 12:55 lib

I reran the test using a known eps file from elsewhere and got much the same error:

Code:
gs /usr/tmp/Downloads/BLK.EPS             
GPL Ghostscript 9.52 (2020-03-19)
Copyright (C) 2020 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
While reading gs_ll3.ps:
Error: /undefinedresource in findresource
Operand stack:
   (gs_icc.ps\000gs_mex_e.ps\000gs_mro_e.ps\000gs_pdf_e.ps\000gs_wan_e.ps\000pdf_ops.ps\000pdf_rbld.ps\000pdf_base.ps\000pdf_draw.ps\000gs_cff.ps\000gs_mgl_e.ps\000gs_ttf.ps\000pdf_font.ps\000pdf_main.ps\000pdf_sec.ps\000gs_epsf.ps\000gs_pdfwr.ps)   (gs_ll3.ps)   1   Pscript5Idiom.pkgsave   IdiomSet   6   Pscript5Idiom.pkgsave
Execution stack:
   %interp_exit   --nostringval--   findresource   %loop_continue   findresource   findresource   findresource   false   1   %stopped_push   --nostringval--   1902   7   5   %oparray_pop   findresource   findresource   --dict:16/18(ro)(G)--   --dict:2/2(G)--   findresource   1   %dict_continue   findresource   findresource   1900   5   5   %oparray_pop   findresource   %errorexec_pop   findresource   findresource   findresource   findresource
Dictionary stack:
   --dict:943/1123(G)--   --dict:0/20(G)--   --dict:77/200(L)--   --dict:943/1123(G)--   --dict:38/43(G)--   --dict:16/18(ro)(G)--
Current allocation mode is global
Current file position is 18941

It would have been helpful had the software reported what resource it is looking for.
 
For testing purposes I've deleted ghostscript9-agpl-base-9.52_4, pkg add 9.50, then deleted, reinstalled 9.52_4, resulting in a non-fuctional cups-pdf-2.6.1_4 ( Backend failed ). Also my USB printer stoped working.

Reinstalled (pkg add) 9.50, deleted in cups Printers cups-pdf, recreated with /usr/local/share/cups/model/CUPS-PDF.ppd. cups-pdf and the USB printer works again.

I couldn't figure out why the previous combination 9.52_4 + cups-pdf-2.6.1_4 was working, but after installing 9.50 ( and deleting ) was not.
 
I tried to solve this by bringing everything to the latest version using pkg upgrade -f.

And I then re-installed the older printing packages from last July:
Code:
pkg add -f /var/cache/pkg/ghostscript9-agpl-base-9.27_2.txz
pkg add -f /var/cache/pkg/cups-2.2.11.txz
pkg add -f /var/cache/pkg/cups-filters-1.25.0.txz
pkg add -f /var/cache/pkg/cups-pdf-2.6.1_4.txz

I then rebooted, just to make sure that no artifacts were left hanging around.

Now, I no longer get any errors.

Code:
localhost - - [09/Jun/2020:14:00:59 -0400] "POST /printers/np4172 HTTP/1.1" 200 128296 Print-Job successful-ok
localhost - - [09/Jun/2020:14:03:23 -0400] "POST /printers/cups-pdf HTTP/1.1" 200 128132 Print-Job successful-ok
localhost - - [09/Jun/2020:14:05:03 -0400] "POST /printers/cups-pdf HTTP/1.1" 200 128136 Print-Job successful-ok
localhost - - [09/Jun/2020:14:07:00 -0400] "POST /printers/np4172 HTTP/1.1" 200 20292 Print-Job successful-ok


However, I still do not get any output at the printer. Nothing is added to cups/error_log and nothing is produced.

Cups_pdf adds to the error log but produces no output:
Code:
D [09/Jun/2020:14:05:03 -0400] Print-Job ipp://localhost:631/printers/cups-pdf
D [09/Jun/2020:14:05:03 -0400] [Job ???] Auto-typing file...
I [09/Jun/2020:14:05:03 -0400] [Job ???] Request file type is application/pdf.
D [09/Jun/2020:14:05:03 -0400] cupsdMarkDirty(---J-)
D [09/Jun/2020:14:05:03 -0400] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Active clients"
D [09/Jun/2020:14:05:03 -0400] [Job 1733] Applying default options...
D [09/Jun/2020:14:05:03 -0400] add_job: requesting-user-name="byrnejb_hll"
I [09/Jun/2020:14:05:03 -0400] [Job 1733] Adding start banner page "none".
D [09/Jun/2020:14:05:03 -0400] Discarding unused job-created event...
D [09/Jun/2020:14:05:03 -0400] cupsdMarkDirty(---J-)
D [09/Jun/2020:14:05:03 -0400] cupsdSetBusyState: newbusy="Active clients and dirty files", busy="Active clients and dirty files"
I [09/Jun/2020:14:05:03 -0400] [Job 1733] Adding end banner page "none".
I [09/Jun/2020:14:05:03 -0400] [Job 1733] File of type application/pdf queued by "byrnejb_hll".
D [09/Jun/2020:14:05:03 -0400] [Job 1733] hold_until=0
I [09/Jun/2020:14:05:03 -0400] [Job 1733] Queued on "cups-pdf" by "byrnejb_hll".
D [09/Jun/2020:14:05:03 -0400] [Client 730] Returning IPP successful-ok for Print-Job (ipp://localhost:631/printers/cups-pdf) from localhost.
D [09/Jun/2020:14:05:03 -0400] [Client 730] Content-Length: 194
D [09/Jun/2020:14:05:03 -0400] [Client 730] cupsdSendHeader: code=200, type="application/ipp", auth_type=0
D [09/Jun/2020:14:05:03 -0400] [Client 730] con->http=0x8045f8800
D [09/Jun/2020:14:05:03 -0400] [Client 730] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_LENGTH, data_remaining=194, response=0x8046073d0(IPP_STATE_IDLE), pipe_pid=0, file=-1
D [09/Jun/2020:14:05:03 -0400] [Client 730] Writing IPP response, ipp_state=IPP_STATE_DATA, old wused=0, new wused=0
D [09/Jun/2020:14:05:03 -0400] [Client 730] bytes=0, http_state=0, data_remaining=194
D [09/Jun/2020:14:05:03 -0400] [Client 730] Flushing write buffer.

How is this solved?
 
Code:
pkg add -f /var/cache/pkg/ghostscript9-agpl-base-9.27_2.txz
pkg add -f /var/cache/pkg/cups-2.2.11.txz
pkg add -f /var/cache/pkg/cups-filters-1.25.0.txz
pkg add -f /var/cache/pkg/cups-pdf-2.6.1_4.txz

Needed one more package:
Code:
pkg add -f /var/cache/pkg/qpdf-8.4.2.txz

Now printing works again, including cups-pdf.
 
Back
Top