Creating a portable copy of pdftotext from source

Recently we had a need to use pdftotext on a server that we couldn’t install packages on, so we decided to download the source for Xpdf and build our own copy. This is generally pretty easy, however by default it requires shared libraries to also be installed on the system that runs it, and you can’t just copy those up if you don’t have permission to write to the install locations. The fix is to build the binaries as statically linked, which means the additional libraries will be included in the main binaries. This does make the binary files larger, but that’s the price of portability.

(I’m not a compiler ninja in any way, so if you are and I’m doing this wrong, please don’t make fun of me too much!)

curl -O
tar zxvf xpdf-4.04.tar.gz
cd xpdf-4.04

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.