Bug #1769

Can't compile with PCRE support using Sun Studio 12 w/ PCRE in non-standard location

Added by alexs77 about 7 years ago. Updated about 7 years ago.

Status:FixedStart date:
Priority:NormalDue date:
Assignee:-% Done:


Target version:1.4.21
Missing in 1.5.x:


I have pcre 7.8 installed in /opt/pcre and I'm trying to compile lighttpd-1.4.19 using Sun Studio 12 compiler on Sun Solaris 10 Sparc.

I compile lighttpd with the following script:

#! /opt/csw/bin/bash




export LDFLAGS=-R${inst_dir}/lib
#export SQLITE_CFLAGS=-I${inst_prefix}/sqlite-3.6.2/include
#export SQLITE_LIBS=-L${inst_prefix}/sqlite-3.6.2/lib
export SQLITE_CFLAGS=-I/opt/sqlite/include
export SQLITE_LIBS=-L/opt/sqlite/lib

export PATH="/opt/pcre/bin:$PATH" 

pushd ${prg}-${v}
./configure --prefix=${inst_dir} \
  --with-webdav-props --with-webdav-locks --with-zlib --with-bzip2 \
  --with-pcre \
  && gmake -j2 && gmake install

During the configure run, I see that pcre isn't being used. In config.log, there's:

configure:23995: found /opt/pcre/bin/pcre-config
configure:24007: result: /opt/pcre/bin/pcre-config
configure:24021: checking for pcre_compile in -lpcre
configure:24056: /opt/SUNWspro/bin/cc -o conftest -g  -D_REENTRANT -D__EXTENSIONS__ -I/opt/pcre/include -R/opt/lighttpd/lib conftest.c -lpcre  -lresolv -lnsl -lsocket  -L/opt/pcre/lib -R/opt/pcre/lib -lpcre >&5
"conftest.c", line 74: warning: statement not reached
ld: fatal: library -lpcre: not found
ld: fatal: File processing errors. No output written to conftest

The compiler command used was:

/opt/SUNWspro/bin/cc -o conftest -g  -D_REENTRANT -D__EXTENSIONS__ -I/opt/pcre/include -R/opt/lighttpd/lib conftest.c -lpcre  -lresolv -lnsl -lsocket  -L/opt/pcre/lib -R/opt/pcre/lib -lpcre

When I put the -L/opt/pcre/lib BEFORE the first use of -lpcre, then it works. Working compiler command:

/opt/SUNWspro/bin/cc -L/opt/pcre/lib -o conftest -g  -D_REENTRANT -D__EXTENSIONS__ -I/opt/pcre/include -R/opt/lighttpd/lib conftest.c -lpcre  -lresolv -lnsl -lsocket  -L/opt/pcre/lib -R/opt/pcre/lib -lpcre

conftest.c Magnifier - conftest.c (13.9 KB) alexs77, 2008-09-11 10:51


#1 Updated by stbuehler about 7 years ago

Imho this is an autoconf or sun compiler/linker problem; the only way out of this i see is to just drop the check (as pcre-config should be good enough).

But that wouldn't fix problems with other libraries in non-standard locations of course.

I am not a ld expert, so.. are you sure you don't have to add the library path to a global config anyway?

#2 Updated by stbuehler about 7 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

Fixed in r2323

Also available in: Atom