Introduction to Ghostscript
Ghostscript is a versatile
processor for PostScript data with the ability to render PostScript
to different targets. It used to be part of the cups printing
stack, but is no longer used for that.
This package is known to build and work properly using an LFS-7.7
If you wish, you can download additional fonts.
FreeType-2.6.1, libjpeg-turbo-1.4.2, libpng-1.6.19, LibTIFF-4.0.6,
and Little CMS-2.7
Cairo-1.14.2, Cups-2.1.0, Fontconfig-2.11.1 (required, if you are
installing any suggested font), GTK+-2.24.28, Little
CMS-1.19 (not used by default, nor if lcms2 is present or
found), libidn-1.32, libpaper-1.1.24+nmu4, and X Window
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/gs
Installation of Ghostscript
The Ghostscript build system is
not user-friendly. In order to use system copies of various
graphics libraries, you must do it using unconventional methods.
GPL Ghostscript includes (old)
copies of several libraries. Some of these seem to have been
patched to fix known vulnerabilities, but others of these copies
are less-well maintained. To ensure that any future fixes are
applied throughout the whole system, it is recommended that you
first install the released versions of these libraries and then
configure GPL Ghostscript to link
If you have installed these dependencies on your system, remove the
copies of expat, freetype, lcms2, libjpeg, libpng and zlib:
sed -i 's/ZLIBDIR=src/ZLIBDIR=$includedir/' configure.ac configure &&
rm -rf expat freetype lcms2 jpeg libpng zlib
./configure --prefix=/usr \
To compile the shared library
libgs.so, run the following additional command as
an unprivileged user:
This package does not come with a test suite. A set of example
files may be used for testing, but it is only possible after
installation of the package.
Now, as the
If you want the shared library too:
Now make the documentation accessible from the normal place:
ln -sfv ../ghostscript/9.16/doc /usr/share/doc/ghostscript-9.16
If you have downloaded any fonts, unpack them to
/usr/share/ghostscript and ensure the ownerships
of the files are
in the command below for the fonts you wish to install:
tar -xvf ../
<font-tarball> -C /usr/share/ghostscript --no-same-owner &&
fc-cache -v /usr/share/ghostscript/fonts/
You can now test the rendering of various postscript and pdf files
/usr/share/ghostscript/9.16/examples , for
example (you need an X window system display):
gs -q -dBATCH /usr/share/ghostscript/9.16/examples/tiger.eps
's/ZLIBDIR=src/ZLIBDIR=$includedir/' ... : Fixes
building with system Zlib.
This option makes gs
libgs.so slightly smaller.
Remove this option if you've not installed LibTIFF-4.0.6.
ln -sfv ../ghostscript-9.16/doc
... : This puts a symbolic link to the
documentation where it is expected to be found.
--disable-cups: this option will save a
tiny amount of space by not linking gs and
libgs.so to the Cups-2.1.0 libraries if you have installed
dvipdf, eps2eps, font2c, gs, gsbj, gsc
(from soinstall), gsdj, gsdj500, gslj, gslp, gsnd, gsx (from
soinstall), lprsetup.sh, pdf2dsc, pdf2ps, pf2afm, pfbtopfa,
pphs, printafm, ps2ascii, ps2epsi, ps2pdf, ps2pdf12, ps2pdf13,
ps2pdf14, ps2pdfwr, ps2ps, ps2ps2, unix-lpr.sh, and
/usr/lib/ghostscript, /usr/share/ghostscript, and
is an interpreter for Adobe Systems' PostScript(tm) and
Portable Document Format (PDF).
functionality to other programs, such as GSView, ImageMagick, and libspectre.
GPL Ghostscript provides many
different scripts used to convert PostScript, PDF, and other
formats. Please refer to the HTML documentation or the man pages
for information about the capabilities provided.