Compiling ghostscript 8.71 from sources

Compiling ghostscript 8.71 from sources on ubuntu. Including workaround for error " warning: implicit declaration of function ‘gettimeofday’ [-Wimplicit-function-declaration]"

In a recent project, where we are working on converting PDF based newspapers to interactive image slideshows, we came across an issue with ghostscript version 9.05. This version was breaking rendering of some Marathi fonts present in PDF.

When tested on ghostscript version 8.71, conversion was working properly. So we decided to downgrade ghostscript from version 9.05 to 8.71 on our server running Ubuntu 12.04 LS. Below are steps we followed.

Compiling ghostscript 8.71 from sources

Download sources from http://downloads.ghostscript.com/public/

wget http://downloads.ghostscript.com/public/ghostscript-8.71.tar.gz

Uncompress downloaded source code & change to directory.

tar xvf ghostscript-8.71.tar.gz
cd ghostscript-8.71

Configure it (I used all defaults)

./configure

Start compilation with

make

If you encounter following error:

./base/gp_unix.c:148:2: warning: implicit declaration of function ‘gettimeofday’ [-Wimplicit-function-declaration]
make: *** [obj/gp_unix.o] Error 1

Compile using

make XCFLAGS=-DHAVE_SYS_TIME_H=1

Finally install compiled binaries using

make install

At this point you will ghostscript will be installed at /usr/local/bin/gs

There are other methods to install old versions also, but compilation is safer alternative IMHO.

About the project:

rtCamp is working on an exciting project to connect WordPress with conventional newspaper publishing. The project is in early stages and a sample can be seen at http://anandnagri.com/e-paper/22-aug-2012-3/ (Note: you may see some text in images broken if you visit this on Aug 24 or Aug 25 as all images are recreated using ghostscript 8.71 right now)

 

3 Comments

Mitesh Shah March 22, 2014

./configure fails

./configure
checking for gcc… no
checking for cc… no
checking for cl.exe… no
configure: error: in `/root/ghostscript-8.71′:
configure: error: no acceptable C compiler found in $PATH
See `config.log’ for more details.

Solution: apt-get install build-essential

Tom June 13, 2014

Thanks!
make XCFLAGS=-DHAVE_SYS_TIME_H=1
solved my issue.

Tom June 13, 2014

I’ve had to stick with 8.71 for a long time now because custom TCPDF fonts aren’t rendering at all in newer versions.