[clue-tech] Broke Apache by upgrading PCRE

William bkimball1 at yahoo.com
Sat Jul 9 15:53:36 MDT 2005


--- Matt Gushee <mgushee at havenrock.com> wrote:
> Do you know what your Apache uses PCRE for? Mine doesn't, and neither do 
>    any of the modules I have installed--at least not directly.

Actually, before running into this problem, I had no idea that Apache was interested in PCRE.  You
might find it interesting that Apache DOES compile its own version of the PCRE utilities.  Here's
a find for "pcre*" against the Apache source (pulled down for curiosity; I haven't yet compiled
this because I'd rather stick with the RPMs on this for convenience -- have you ever tried to
install Apache2 from source with mod_perl AND mod_auth_mysql AND mod_ssl AND php4?  It's a joke,
at best, and an excersise in frustration otherwise):

/usr/src/httpd-2.0.54/include/pcreposix.h
/usr/src/httpd-2.0.54/srclib/pcre
/usr/src/httpd-2.0.54/srclib/pcre/pcre.dsp
/usr/src/httpd-2.0.54/srclib/pcre/pcre.hw
/usr/src/httpd-2.0.54/srclib/pcre/pcre.def
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcre.3
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcreposix.3
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcreposix.txt
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcre.html
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcretest.1
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcreposix.html
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcregrep.1
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcregrep.txt
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcregrep.html
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcre.txt
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcretest.txt
/usr/src/httpd-2.0.54/srclib/pcre/doc/pcretest.html
/usr/src/httpd-2.0.54/srclib/pcre/pcre.c
/usr/src/httpd-2.0.54/srclib/pcre/pcreposix.c
/usr/src/httpd-2.0.54/srclib/pcre/pcregrep.c
/usr/src/httpd-2.0.54/srclib/pcre/pcre-config.in
/usr/src/httpd-2.0.54/srclib/pcre/pcreposix.dsp
/usr/src/httpd-2.0.54/srclib/pcre/pcreposix.h
/usr/src/httpd-2.0.54/srclib/pcre/pcretest.c
/usr/src/httpd-2.0.54/srclib/pcre/pcre.in
/usr/src/httpd-2.0.54/srclib/pcre/pcredemo.c


> > Error message when executing "service httpd start" (as root):
> > =============================================================
> > Starting httpd: /usr/sbin/httpd: symbol lookup error: /usr/lib/libpcreposix.so.0: undefined
> > symbol: pcre_compile2     [FAILED]
> 
> Let's see ... you probably know this, but just for the sake of 
> thoroughness, "symbol lookup error" means that *something* is trying to 
> call a function that is expected to be provided by an external library, 
> but for some reason that function is unavailable. From the above error 
> message, it appears that some function in libpcreposix is attempting to 
> call pcre_compile2. Now, what library would provide that?
> 
> Well, time to play "Grep-the-Headers." On my system:
> 
>    $ grep pcre_compile /usr/include/*.h
>    /usr/include/pcre.h:extern pcre *pcre_compile(const char *, int, ...
> 
> So there is a 'pcre_compile' function defined in libpcre. I'd be willing 
> to bet that (1) some version of libpcre has a 'pcre_compile2' function, 
> but not the one I have, and (2) if you run the above 'grep' command, you 
> will also find 'pcre_compile' but not 'pcre_compile2'.
> 

$ grep pcre_compile /usr/lib/pcre/include/*.h
/usr/lib/pcre/include/pcre.h:PCRE_DATA_SCOPE pcre *pcre_compile(const char *, int, const char **,
int *,
/usr/lib/pcre/include/pcre.h:PCRE_DATA_SCOPE pcre *pcre_compile2(const char *, int, int *, const
char **,

The latest PCRE does provide pcre_compile2 -- it adds a new pointer argument (the 3rd int *
argument) for returning error numbers (per the documentation).

> So first of all I would check the timestamps on the relevant libraries:
> 
>    $ ls -l /path/to/libs/libpcre*
> 
> libpcre.so.* and libpcreposix.so.* should have been created at the same 
> time. If they weren't, that is presumably because you compiled/installed 
> one of them but not the other. In that case you would need to rebuild 
> PCRE, this time making sure that both libs get built ... maybe there's a 
> configure option, '--with-posix' or something like that?
> 
> On the other hand, if the two libraries were created at the same time, 
> it could be a bug in PCRE ... but I wouldn't rule out a configuration 
> problem just yet.

There's the rub.  There were SO many symlinks in there pointing between several pcre libraries
that I just dumped them all and recompiled the new PCRE again.  [WARNING:  This was a VERY BAD
thing to do because, apparently, even grep uses PCRE so the configure script was hosed.  I had to
restore libpcre.so from another box to get grep working again, afterwhich I was able to recompile
and install the new PCRE.]  In the end, I reinstalled apache from yum (RPM) and it was FINALLY
happy again.  "service start httpd" brought it right up!  :)

> Two things that come to mind are:
> 
> Did you remember to run 'ldconfig' after you installed PCRE?

I don't know what ldconfig is, but at your recommendation, I'm running it after "make install" as
just "ldconfig", now.  I believe I've seen this recommended elsewhere, so no big deal to add this
step.  If I need to add some values to the ldconfig command, I don't know what they'd be because
none of the README/INSTALL files of any programs I install make any mention of it.

> Is it possible you have another version of either libpcre or 
> libpcreposix that you installed once and forgot about ... in 
> /usr/local/lib, for example? Check all the paths listed in 
> /etc/ld.so.conf; and if you have $LD_LIBRARY_PATH defined, check those 
> paths too.

While I haven't been installing PCRE before this latest excersise, this was apparently the problem
-- too many versions floating around.

> Hope this helps.

You've been a great help!  Thanks for the guidance!!  :)


William Kimball, Jr.
"Programming is an art form that fights back!"  =)


		
____________________________________________________
Sell on Yahoo! Auctions – no fees. Bid on great items.  
http://auctions.yahoo.com/
_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech



More information about the clue-tech mailing list