Subject: pkg/32733: shared-mime-info buildlink pkg-config wrapper doesn't find all modules
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <jml@ascia.fi>
List: pkgsrc-bugs
Date: 02/04/2006 17:45:00
>Number:         32733
>Category:       pkg
>Synopsis:       shared-mime-info buildlink pkg-config wrapper doesn't find all modules
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 04 17:45:00 +0000 2006
>Originator:     Juha-Matti Liukkonen
>Release:        Mac OS X 10.4.4
>Organization:
Ascia Oy
>Environment:
Darwin rousku.podzone.org 8.4.0 Darwin Kernel Version 8.4.0: Tue Jan  3 18:22:10 PST 2006; root:xnu-792.6.56.obj~1/RELEASE_PPC Power Macintosh powerpc

>Description:
When using any native pkgconfig enabled component (with shared-mime-info), work/.tools/bin/pkg-config does not find modules, whereas /usr/pkg/bin/pkg-config run directly does. Problem is that the wrapper script forces libpath to work/.buildlink/lib/pkgconfig, which is populated only with a _subset_ of /usr/pkg/lib/pkgconfig, not from $PKG_CONFIG_PATH.

rousku:~/Projects/pkgsrc/databases/shared-mime-info admin$ ls -l work/.buildlink/lib/pkgconfig/
total 24
lrwxr-xr-x   1 admin  staff  34 Feb  4 19:26 glib-2.0.pc -> /usr/pkg/lib/pkgconfig/glib-2.0.pc
lrwxr-xr-x   1 admin  staff  37 Feb  4 19:26 gmodule-2.0.pc -> /usr/pkg/lib/pkgconfig/gmodule-2.0.pc
lrwxr-xr-x   1 admin  staff  44 Feb  4 19:26 gmodule-export-2.0.pc -> /usr/pkg/lib/pkgconfig/gmodule-export-2.0.pc
lrwxr-xr-x   1 admin  staff  47 Feb  4 19:26 gmodule-no-export-2.0.pc -> /usr/pkg/lib/pkgconfig/gmodule-no-export-2.0.pc
lrwxr-xr-x   1 admin  staff  37 Feb  4 19:26 gobject-2.0.pc -> /usr/pkg/lib/pkgconfig/gobject-2.0.pc
lrwxr-xr-x   1 admin  staff  37 Feb  4 19:26 gthread-2.0.pc -> /usr/pkg/lib/pkgconfig/gthread-2.0.pc
rousku:~/Projects/pkgsrc/databases/shared-mime-info admin$ ls -l /usr/pkg/lib/pkgconfig/
total 84
-r--r--r--   1 root  wheel  299 Feb  4 19:21 fontconfig.pc
-r--r--r--   1 root  wheel  249 Feb  4 18:09 fribidi.pc
-rw-r--r--   1 root  wheel  248 Feb  4 19:21 gimpprint.pc
-r--r--r--   1 root  wheel  356 Feb  4 18:43 glib-2.0.pc
-r--r--r--   1 root  wheel  264 Feb  4 05:06 glitz-agl.pc
-r--r--r--   1 root  wheel  268 Feb  4 18:43 gmodule-2.0.pc
-r--r--r--   1 root  wheel  268 Feb  4 18:43 gmodule-export-2.0.pc
-r--r--r--   1 root  wheel  267 Feb  4 18:43 gmodule-no-export-2.0.pc
-r--r--r--   1 root  wheel  219 Feb  4 18:17 gnome-mime-data-2.0.pc
-r--r--r--   1 root  wheel  259 Feb  4 18:43 gobject-2.0.pc
-r--r--r--   1 root  wheel  250 Feb  4 18:43 gthread-2.0.pc
-rw-r--r--   1 root  wheel  251 Feb  4 19:21 libclamav.pc
-rw-r--r--   1 root  wheel  283 Feb  4 19:21 libexslt.pc
-r--r--r--   1 root  wheel  788 Feb  4 03:17 libidn.pc
-r--r--r--   1 root  wheel  274 Feb  4 12:59 libpcre.pc
-r--r--r--   1 root  wheel  237 Feb  4 05:15 libpng12.pc
-rw-r--r--   1 root  wheel  278 Feb  4 19:21 libxml-2.0.pc
-rw-r--r--   1 root  wheel  274 Feb  4 19:21 libxslt.pc
-rw-r--r--   1 root  wheel  262 Feb  4 19:21 openssl.pc
-r--r--r--   1 root  wheel  275 Feb  4 19:21 xcursor.pc
-r--r--r--   1 root  wheel  520 Feb  4 19:21 xft.pc

Note that I have already copied every native .pc file (e.g. /usr/lib/pkgconfig/libxml-2.0.pc) from $PKG_CONFIG_PATH to $PREFIX/lib/pkgconfig, so even the full pkgsrc pkgconfig set isn't symlinked.
>How-To-Repeat:
pkgsrc-current: cd pkgsrc/databases/shared-mime-info; bmake

rousku:~/Projects/pkgsrc/databases/shared-mime-info admin$ work/.tools/bin/pkg-config --libs "\
                  libxml-2.0 >= 2.4 \
                  glib-2.0 >= 2.0.0"
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
rousku:~/Projects/pkgsrc/databases/shared-mime-info admin$ /usr/pkg/bin/pkg-config --libs "\
                  libxml-2.0 >= 2.4 \
                  glib-2.0 >= 2.0.0"
-L/usr/pkg/lib -lxml2 -lpthread -lz -lm -lglib-2.0 -liconv  

>Fix:
1) Don't override the libpath in the wrapper script, or 2) populate work/.buildlink/lib/pkgconfig from $PKG_CONFIG_PATH (or even the full $PREFIX/lib/pkgconfig). Or as a workaround: "bmake wrapper; cd work/.buildlink/lib/pkgconfig; ln -s /usr/pkg/lib/pkgconfig/* ."