Installing GhostPCL on FreeBSD

To install GhostPCL on FreeBSD, first install ghostscript. I don’t run X on my server so I used ghostscript-afpl-nox11 found in /usr/ports/print/

Next get GhostPCL, and save the bz2 file in /usr/local/src. For this article, I’m using GhostPCL 1.41, and FreeBSD 5.3.

Compiling GhostPCL on FreeBSD requires some changes to get it to go. Two of the errors you might see are as follows:

"pcl6_gcc.mak", line 81: Missing dependency operator
"pcl6_gcc.mak", line 89: Need an operator
"pcl6_gcc.mak", line 92: Missing dependency operator
.... and so on

This is because the makefile is using make, and should use gmake.


./obj/echogs -a ./obj/ -s - ./obj/plmain.o ./obj/plimpl.o  -lm -lpthread -ldl
sh < ./obj/
/usr/bin/ld: cannot find -ldl
gmake: *** [obj/pcl6] Error 1
gmake: Leaving directory `/usr/local/src/ghostpcl_1.41/main'
*** Error code 2

This is because the -ldl flag is not needed on FreeBSD.

I’ve attached a patch to this article that fixes both issues, as well as relocating the font files from the default /windows/fonts to /usr/local/windows/fonts. Note it does not honor PREFIX. The patch was made on FreeBSD 5.3 with GhostPCL 1.41.

After applying this patch like so:

tar -jxvf ghostpcl_1.41.tar.bz2
patch < ghostpcl_1.41_freebsd.patch.txt

Now you can build it:

cd ghostpcl_1.41
sudo gmake fonts
gmake product
gmake test # Only valuable if you have X running
sudo gmake install

That’s it! Running it goes something like:

pcl6  -dNOPAUSE -sDEVICE=pdfwrite -sAutoRotatePages=PageByPage \
    -sOutputFile=Somefile.PDF inputfile.PCL


I love your comments. Don't be shy, reply!

There are 4 replies to “Installing GhostPCL on FreeBSD

  1. Cocoa Crusty


    I am very glad I stumbled upon your site yesterday. I was getting frustrated trying to compile GhostPCL on FreeBSD 6.1. Since I am not a compiled language kind of programmer, I would have never known to use the different version of make (gmake) and the other differences you noted to the Makefile.

    Have you ever experienced seg faults when using the pdfwrite device for output? I have used two different PRN (File -> Print -> Print To File) files (printing using an HP LJ4000 PCL6 driver) and when attempting to export them to PDF the application seg faults. I can export as pretty much anything else the application offers.

    Any thoughts? Does this program rely on any other dependencies? Also, have you thought of porting this to the FreeBSD ports tree? I notice you said it doesn’t allow PREFIX. Is this something that can be worked around? I think it would be cool to make this into a port, although I have never done so, but it would seem you have much more experience in this than I.



  2. Sebastian Post author

    After reading up a little on the port creation process, I think this is very doable for me. It will probably be a few weeks, but I’m going to give it a shot!

  3. Cocoa Crusty

    Glad to hear you’re thinking of taking on this port. I read about the port creation and what not and also noticed that this port had been in the ports tree at one time but there was no maintainer so they removed it… Now, you Sebastian, can be the man! And have your name in lights on the FreeBSD web site! :)


  4. Michael


    This is exactly what I was after. It’s been a long time searching for such a tool which works under FreeBSD, thanks a lot for your help. I hope you do consider making a port.


Leave a Reply

Your email address will not be published. Required fields are marked *

The "are you a human" quiz *