PGXS problem with pdftotext

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: PGXS problem with pdftotext
Date: 2009-07-02 20:20:42
Message-ID: 4A4CD04A0200002500028307@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've been wondering whether anyone else would want to use the
functions we wrote to extract text from PDF documents stored in bytea
columns. If so, I would need to sort out the problems I've been
having with builds through the PGXS techniques. Here's the directory,
after a successful build under contrib:

kgrittn(at)project-db:~/postgresql-8.3.7/contrib/pdftotext> ll
total 108
-rw-r--r-- 1 kgrittn dbas 22990 2009-04-14 17:14 libpdftotext.a
lrwxrwxrwx 1 kgrittn dbas 19 2009-04-14 17:14 libpdftotext.so ->
libpdftotext.so.0.0
lrwxrwxrwx 1 kgrittn dbas 19 2009-04-14 17:14 libpdftotext.so.0 ->
libpdftotext.so.0.0
-rwxr-xr-x 1 kgrittn dbas 21666 2009-04-14 17:14 libpdftotext.so.0.0
-rw-r--r-- 1 kgrittn dbas 443 2009-04-14 17:14 Makefile
-rw-r--r-- 1 kgrittn dbas 2980 2008-07-22 13:00 pdftotext.c
-rw-r--r-- 1 kgrittn dbas 14184 2009-04-14 17:14 pdftotext.o
-rw-r--r-- 1 kgrittn dbas 285 2009-04-14 17:14 pdftotext.sql
-rw-r--r-- 1 kgrittn dbas 285 2008-07-22 13:00 pdftotext.sql.in
-rw-r--r-- 1 kgrittn dbas 4658 2009-04-13 17:02 poppler_compat.cc
-rw-r--r-- 1 kgrittn dbas 355 2008-07-22 13:00 poppler_compat.h
-rw-r--r-- 1 kgrittn dbas 8208 2009-04-14 17:14 poppler_compat.o
-rw-r--r-- 1 kgrittn dbas 733 2008-07-22 13:00 README.pdftotext

Here's the Makefile contents:

MODULE_big = pdftotext
OBJS = pdftotext.o poppler_compat.o
DATA_built = pdftotext.sql
DOCS = README.pdftotext

PG_CPPFLAGS =-I/usr/include/poppler -shared -fpic
SHLIB_LINK = -lpoppler -L/usr/local/lib

ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pdftotext
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif

If we export PGXS=1 and make ; sudo make install outside the
PostgreSQL build tree, it seems to build and deploy OK, but it can't
find the poppler implementation at run time. If we do it in the build
tree, all is good. Where's the problem? Is the SHLIB_LINK setting
proper? What's the right way to do this?

BTW, libpoppler is GPL licensed, and always reminds me of what
Churchill said about democracy, if that affects anyone's interest in
the code. You're likely to need to tweak the code based on the
particular version of libpoppler you're using. If you use an older
version of libpoppler, it can crash the whole PostgreSQL environment
if you try to use it with a PDF using newer features. :-(

If anyone's still interested, and I can fix the build problem, I'll
throw the source code onto pgfoundry.

-Kevin

"It has been said that democracy is the worst form of government
except all the others that have been tried."

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-07-02 20:51:15 bug in Google translate snippet
Previous Message Zdenek Kotala 2009-07-02 19:42:07 Re: First CommitFest: July 15th