vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
533 stars 89 forks source link

Postscript error creating svg with libgs.so.10.02 #434

Closed zarniwhoop73 closed 4 months ago

zarniwhoop73 commented 4 months ago

For a MWE take the sphere.asy example file and use it to create an svg file.

In my case I add a line at the start:

settings.outformat="svg";

This used to work, and stopped at some point in the last 6 months. I initially assumed I had been doing something unsupported which had happened to work, and I did not have time to investigate. But the change after 2.87 mentioned on tlbuild caused me to look again.

When it fails, the output, for example using the binary TL pretest, is

PostScript error: undefined in finddeviceOperand stack: 5 --nostringval-- --nostringval-- --nostringval-- imgdev jpeg shipout3(prefix,f,preview ? nativeformat() : format, ^ /home/ken/tlpre/texmf-dist/asymptote/three.asy: 2901.13: runtime: shipout failed

Working through asy-2.85, 2.86 and 2.87 with dvisvgm-3.2 they all work on an x86_64 linux system from last August or September, but not on more recent systems.

The difference seems to be that my recent systems are using libgs.so.10.02 and the working system used libgs.so.10.01.

The changes in ghostscript-10.02.1 include:

· The old, PostScript based PDF interpreter has been removed, it is no longer available.

· We've continued to improve the performance of the PDF interpreter written in C and improve it's behaviour in edge and out-of-specification cases.

I'm guessing that the first of those items is what has broken asy. The error occurs during the rendering, and leaves (filename).pdf e.g. sphere.pdf

johncbowman commented 4 months ago

This works fine for me:

gs
GPL Ghostscript 10.02.1 (2023-11-01)
Copyright (C) 2023 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.
GS>quit
[wizard: ~/camp master] asy sphere -f svg

However, I am using dvisvgm 2.13.3.

johncbowman commented 4 months ago

P.S. I just upgraded to TeXLive 2023, which uses dvisvgm 3.0.3 and can reproduce the issue. So it seems like this is really a dvisvgm issue, not an Asymptote issue.

johncbowman commented 4 months ago

A workaround is to install the ghostscript 9.53 shared library and specify -libgs=/usr/lib64/libgs.so.9.53 on the Asymptote command line (this option gets passed on to dvisvgm).

johncbowman commented 4 months ago

The issue has now been addressed in dvisvgm-3.2.2.