在centos 7上运行ghostscript命令时出错

eagi6jfj  于 2022-11-07  发布在  其他
关注(0)|答案(1)|浏览(890)

我已经在CentOS 7服务器上安装了Ghostscript。
当我简单地命令gs时,它返回以下内容

GPL Ghostscript 9.25 (2018-09-13)
Copyright (C) 2018 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GPL Ghostscript 9.25: Cannot open X display `(null)'.

****Unable to open the initial device, quitting.

当我尝试通过以下命令将缩略图转换为pdf时

gs -sDEVICE=pngalpha -dFirstPage=1 -dLastPage=1 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r200 -o tmp/foo.png bar.pdf

它将返回以下结果

GPL Ghostscript 9.25 (2018-09-13)
Copyright (C) 2018 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Segmentation fault

当我在不同系统上运行上述两个命令时,它们都能正常工作。
帮助解决CentOS系统的问题。

rwqw0loc

rwqw0loc1#

不幸的是,我可以在CentOS 7系统上随机复制PDF文件,重现此问题。这似乎是Red Hat Enterprise Linux 7(包括CentOS 7等克隆/衍生版本)中随附的Ghostscript中的一个错误。此问题可能已在Ghostscript上游被称为bug #699815Segmentation fault for pdf input to pngalpha driver“。
但是,根据Red Hat Enterprise Linux Life Cycle,Red Hat Enterprise Linux 7已经处于维护支持2阶段,根据我的经验,Red Hat不太可能在剩余的产品生命周期内修复此问题。因为只有“选中(由红帽自行决定)紧急优先级错误修复建议(RHBA)可能会被释放”(通常只有在购买了RHEL订阅的Red Hat客户提出请求时才会释放)。
即使这很可能不是您要寻找的答案,也没有太多的选择。请尝试更新的RHEL克隆/衍生版本(例如Rocky Linux 9),其中包含更新版本的Ghostscript,或尝试通过将上游补丁添加到existing SRPM package来自行修补旧Ghostscript。

相关问题