Bug #863

Gnome won't compile: cannot find -lpcre

Added by stephane.russell about 8 years ago. Updated almost 8 years ago.

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


Target version:-


Hi, I'm really having a hard time compiling gnome with pkgsrc 2007Q3.
Most problems are minors, but I'm getting this one that's less obvious:

/usr/libexec/binutils217/elf/ld: cannot find -lpcre

The pcgr package is well installed and /usr/pkg/lib is added in the ld
library list in /etc/rc.conf. It looks like this "ld" from binutils
ignores it. Is there a different configuration for the binutils tools?
I've upgraded from DF 1.8 to 1.10 by recompiling all my server.

Thanks for any help.


-c -o queryimmodules.o `test -f 'queryimmodules.c' || echo
mmodules.c; \
then mv -f ".deps/queryimmodules.Tpo" ".deps/queryimmodules.Po"; \
else rm -f ".deps/queryimmodules.Tpo"; exit 1; \
/bin/sh ../libtool --mode=link cc -O2 -pthread -I/usr/pkg/include
e -I/usr/pkg/include/freetype2 -Wall -L/usr/pkg/lib -Wl,-R/usr/pkg/lib
ib -Wl,-R/usr/lib -pthread -o gtk-query-immodules-2.0 queryimmodules.o
11-2.0.la ../gdk-pixbuf/libgdk_pixbuf-2.0.la ../gdk/libgdk-x11-2.0.la
cc -O2 -pthread -I/usr/obj/pkgsrc/x11/gtk2/work/.buildlink/include
gsrc/x11/gtk2/work/.buildlink/include/freetype2 -Wall -Wl,-R/usr/pkg/lib
d -o .libs/gtk-query-immodules-2.0 queryimmodules.o
k/.libs -L/usr/obj/pkgsrc/x11/gtk2/work/.buildlink/lib
pkgsrc/x11/gtk2/work/.buildlink/lib/libatk-1.0.so -lpcre
gdk_pixbuf-2.0.so ../gdk/.libs/libgdk-x11-2.0.so
ibpng12.so -lpthread
so /usr/obj/pkgsrc/x11/gtk2/work/.buildlink/lib/libfreetype.so -lz
/usr/obj/pkgsrc/x11/gtk2/work/.buildlink/lib/libXi.so /u
Xcursor.so /usr/obj/pkgsrc/x11/gtk2/work/.buildlink/lib/libXrender.so
/usr/obj/pkgsrc/x11/gtk2/work/.buildlink/lib/libXau.so /u
sr/obj/pkgsrc/x11/gtk2/work/.buildlink/lib/libXdmcp.so -lrpcsvc
x11/gtk2/work/gtk+-2.12.0/gdk-pixbuf/.libs/libgdk_pixbuf-2.0.so -pthread
/usr/obj/pkgsrc/x11/gtk2/work/.buildlink/lib/libintl.so -lm
-Wl,--rpath -Wl,/usr/pkg/lib -Wl,--rpath
/usr/libexec/binutils217/elf/ld: cannot find -lpcre
gmake[4]: *** [gtk-query-immodules-2.0] Error 1
gmake[4]: Leaving directory `/usr/obj/pkgsrc/x11/gtk2/work/gtk+-2.12.0/gtk'
gmake[3]: *** [all-recursive] Error 1


#1 Updated by justin about 8 years ago

I don't have an answer for why that isn't compiling for you, but for an
immediate fix:


#2 Updated by wa1ter about 8 years ago

On Tue, 27 Nov 2007, Stephane Russell wrote:


The pkgsource build system does not look in /usr/pkg/lib during the
compile. It looks in the .buildlink/lib directory instead, as I
marked above. Now, the real question is whether libpcre appears
in your .buildlink/lib directory.

Here is mine, for example:

~# ls -l /usr/pkgsrc/x11/gtk2/work/.buildlink/lib/libpcre.*
/usr/pkgsrc/x11/gtk2/work/.buildlink/lib/libpcre.a -> /usr/pkg/lib/libpcre.a
/usr/pkgsrc/x11/gtk2/work/.buildlink/lib/libpcre.so -> /usr/pkg/lib/libpcre.so
/usr/pkgsrc/x11/gtk2/work/.buildlink/lib/libpcre.so.0 -> /usr/pkg/lib/libpcre.so.0
/usr/pkgsrc/x11/gtk2/work/.buildlink/lib/libpcre.so.0.0.1 -> /usr/pkg/lib/libpcre.so.0.0.1

If those links are not created properly during the buildlink phase,
the compile will fail later on.

#3 Updated by stephane.russell about 8 years ago

You were right, pcre was not a dependency, so it wasn't added in the
buildlink process. pcre was included in the gtk2 link with a "-lpcre"
statement, for a reason I still don't understand. I could'nt find why
that flag is added, since nothing in gtk2 requires it, not even in the
gtk2 pkgsrc build files.

Anyway, I solved the problem by adding pcre as a dependency in gtk2, and
everything is fine since. If somebody ever finds why this flag was
added, please advise me.

Thanks for the help.


#4 Updated by wa1ter about 8 years ago

On Wed, 28 Nov 2007, Stephane Russell wrote:

The 'magic' is in the buildlink3 files, which are a fundamental part of
the pkgsrc build system.

Look at x11/gtk2/buildlink3.mk, for example, and you will see
.include "../../devel/glib2/buildlink3.mk", which make sense because
glib2 is an important part of gtk2.

Between the buildlink3 system and the universally beloved libtool, you
eventually pull in /usr/pkg/lib/libglib-2.0.la, which contains this:

# Libraries that this one depends upon.
dependency_libs='-L/usr/pkg/lib -lpcre -lintl'

Trivial, really, once you've spent a decade bashing your head against
the inevitability of it all :o)

A quick and dirty way to investigate these dependencies is to do a
'bmake patch' for gtk2, which takes only a minute, and then poke
around in the work/.buildlink directory to see if libpcre shows up.
If not, you can try to work backwards from there. The work/.work.log
can also be very helpful.

#5 Updated by stephane.russell almost 8 years ago

I looked at glib2 after your post, and I could see that pcre is not a
dependecy of glib2 because glib2 provides it's own. But it's not
intalling it (it's not in it's PLIST), so it's not in it's buildlink
either. Mystery solved. ;-)

Thanks for the help.


Also available in: Atom PDF