Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This is second time I get segmentation fault error when I try to run GhostScript on any PDF file with pdfwrite
First time it was my previous Ubuntu 11.04 distro, which afterwards I completely remove (not because of gs), format my drive etc, and then install 11.04 again

I don't know what could be the problem. I work with GS a lot, and now all of a sudden I start getting this errors on any file, like something went wrong with this package or some of it's dependencies.
I searched Synaptic history if there maybe some recent update could cause GS crippling but there was nothing

I reported problems in the past (at least two times) on GS Launchpad branch, but no one even replied, and as a matter of fact no one ever replied to me on Launchpad for any report I issue, so I thought to remove completely ghostscript and install some other version.
At first I thought to add Debian stable repository, and install better tested version, but it turned out that perhaps that's not very good idea - adding Debian repository in Ubuntu.

As I can't "force" Synaptic to some previous GS version (as there is only one it seems - problematic one) I don't know how to approach this problem and wanted to ask how to install previous version, 8.71 preferably, because that's the last version in Debian stable.


Update:

I removed GS 9.01 (and bunch of other packages on the way) and followed Boris' advice, as I didn't know what else can I do.

I installed:

libgs8_8.71~dfsg2-9_i386.deb
ghostscript_8.71~dfsg2-9_i386.deb

and tested GS interpreter and all was working fine.

Now I wanted to put back all those packages removed by GS 9.01 removal, and I needed to first install ghostscript-x:

ghostscript-x_8.71~dfsg2-9_i386.deb

This is where problem begins:

Error:
Breaks existing package 'gsfonts' that conflict: 'gs'.
But the '/home/zetah/gs/ghostscript-x_8.71~dfsg2-9_i386.deb' provides it via: 'gs,gs-afpl,gs-esp,gs-gpl'

I didn't want to brake things so I removed just installed libgs8 and ghostscript and tried to remove gsfonts package (which additionally removed abiword, gnumeric,..) and then install all again.
But I found out that gsfonts is required by ghostscript and installed whenever ghostscript is installed (so ever before being able to install ghostscript-x package).

Now after installing libgs8 and ghostscript, when I try to install ghostscript-x I get:

Error:
Breaks existing package 'ghostscript' that conflict: 'gs'.
But the '/home/zetah/gs/ghostscript-x_8.71~dfsg2-9_i386.deb' provides it via: 'gs,gs-afpl,gs-esp,gs-gpl'

It's exactly the same if I try with Ubuntu 10.10 ghostscript 8.71 packages from Launchpad

share|improve this question
    
Have you tried simply downloading the GhostScript package from debian repository, and installing with dpkg? It is at ftp.debian.org/debian/pool/main/g/ghostscript There might be a better way. –  Boris Bukh Dec 7 '11 at 9:07
    
I thought of it, but wouldn't that mess with some Ubuntu packages as there are many packages depending on GS, libgs etc? –  zetah Dec 7 '11 at 9:09
    
Possibly. But it might better than being stuck with a broken package. Unless things go horribly wrong, you should be able to go back. Hopefully, someone more knowledgeable than myself will come along, and answer your question. –  Boris Bukh Dec 7 '11 at 19:33

4 Answers 4

Here is solution tried & tested on Ubuntu 12.04 LTS....

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

share|improve this answer
    
The answer above mine answer has remaining parts. Is it fine to copy major part from it OR from the link I posted? –  rahul286 Aug 25 '12 at 19:33
    
Your answer should standalone without people having to click on the link to know what to do. If you are referring from other sources, please reference it properly. –  jokerdino Aug 26 '12 at 5:28
    
Please check now. Posted everything here. Removed link as its no longer needed. Exception - if I discover any issue with my ghostscript compilation, I will have to edit stuff at 2 places! ;-) –  rahul286 Aug 26 '12 at 10:50
    
Thanks much for taking care of your answer. :)) –  jokerdino Aug 26 '12 at 12:01
    
@jokerdino my pleasure :-) –  rahul286 Sep 4 '12 at 12:47

Try installing a newer version instead: https://launchpad.net/~dns/+archive/gnu

share|improve this answer
    
This is good idea, only that I already solved this problem. I used that PPA to update gnumeric (latest version has conditional formatting) and missed to search for solution to my ghostscript problem. Too late... –  zetah Dec 15 '11 at 18:40

As an alternative solution - you could compile the older version of ghostscript.

download and extract the tar file

Download the tar file from launchpad.

setup the build environment

sudo apt-get build-dep ghostscript-x

compile and install ghostscript

cd [ghostscript folder location]
sh autogen.sh
make
sudo make install

binaries

All the binaries are installed in /usr/local/bin

Thus if you run gs -v:

GPL Ghostscript 8.71 (2010-02-10) Copyright (C) 2010 Artifex Software, Inc. All rights reserved.

If you want to run ghostscript you can reassign the current symbolic link:

sudo rm /usr/bin/ghostscript
sudo ln -s /usr/local/bin/gs /usr/bin/ghostscript
share|improve this answer
    
I didn't try this, but I expect it to work as explained. Seems like a working alternative in similar scenarios not just ghostscript. –  zetah Dec 15 '11 at 18:38

I also asked this question on Debian forums: link, and with the help by member damgaard I've been able to downgrade GhostScript without too much trouble

Here is overview of this more general scheme which I believe can be used in similar situation, compiled from damgaard's posts:

After removing offending package (GS 9.01) search for last Ubuntu version supporting desired package (GS 8.71) - that is Ubuntu 10.10, so it's repositories are added to helper file: /etc/apt/sources.list.d/maverick.list

Investigating which packages are affected by this downgrade idea, we can get this list:

ghostscript ghostscript-cups ghostscript-doc ghostscript-x libgs8 evince evince-common libevdocument3 libevview3 libspectre1

on which we run this one-liner (as sudo):

for a in ghostscript ghostscript-cups ghostscript-doc ghostscript-x libgs8 evince evince-common libevdocument3 libevview3 libspectre1; do echo -e "Package: $a\nPin: release a=maverick\nPin-Priority: 700" > /etc/apt/preferences.d/ps_downgrade_policies_$a; done

which creates following files in /etc/apt/preferences.d/ folder:

ps_downgrade_policies_evince
ps_downgrade_policies_evince-common
ps_downgrade_policies_ghostscript
ps_downgrade_policies_ghostscript-cups
ps_downgrade_policies_ghostscript-doc
ps_downgrade_policies_ghostscript-x
ps_downgrade_policies_libevdocument3
ps_downgrade_policies_libevview3
ps_downgrade_policies_libgs8
ps_downgrade_policies_libspectre1

with this example content:

Package: package-name-here
Pin: release a=maverick
Pin-Priority: 1000

Then run:

sudo apt-get update
sudo apt-get dist-upgrade

Thanks damgaard :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.