Subject: Help with new pkg and (?) buildlink lib inclusion
To: None <>
From: Christopher W. Richardson <>
List: tech-pkg
Date: 04/26/2007 10:28:57
Hi, all!

I'm working on creating my first package, and, for better or
worse, I didn't pick a trivial one -- so please bear with me if I
do silly things.

I'm working on getting Midgard CMF into pkgsrc.  I actually think
I most of the way there -- I do have a couple of other questions
on how to do things The Right Way, but I'll ask those separately,
after I get things fully functional.  For now ...

The package actually consists of four packages: midgard-core
(which provides shared libraries), midgard-php, midgard-apache,
and midgard-data.  I've got them all successfully compiling and
installing in a pkg_comp chroot, so I'm optimistic I'm on the
right track. For the record, this is on

uname -a
NetBSD ns 2.1.0_STABLE NetBSD 2.1.0_STABLE (GRIZZLY) #0: Sun May
7 22:58:34 PDT 2006 cwr@ns:/usr/obj/sys/arch/i386/compile/GRIZZLY i386

Cutting to the chase, midgard-apache adds a little snippet to be
included in httpd.conf, which looks like this:

LoadModule midgard_module /usr/pkg/lib/httpd/
Listen 8001
NameVirtualHost *:8001
Include /usr/pkg/etc/midgard/apache/vhosts/[^\.#]*

After including said snipped, apache fails to start with:

Cannot load / into server:
Undefined PLT symbol "mgd_init_ex"

mgd_init_ex is defined in libmidgard, and I've confirmed
separately that I can load that by doing so in php.  So, I'm
thinking that for some reasons, this package isn't properly
linking against libmidgard.  However, the Makefile, post
configure, seems to say the right things:

AM_LDFLAGS =  -L/usr/pkg/lib -Wl,-R/usr/pkg/lib
-L/usr/pkg/lib/mysql -Wl,-R/usr/pkg/lib/mysql   -lintl
-lmysqlclient -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lgobject-2.0
-lglib-2.0 -lintl -lxml2   -L/usr/pkg/lib -lmidgard

Perhaps indicating that all of the above is a red herring, I did
a ktrace on apache, and it ends thusly:

28757 httpd    CALL  open(0x48120200,0,0xffffffff)
28757 httpd    NAMI  "/usr/pkg/lib/mysql/"
28757 httpd    RET   open -1 errno 2 No such file or directory
28757 httpd    CALL  munmap(0x4873b000,0x8000)
28757 httpd    RET   munmap 0
28757 httpd    CALL  write(2,0xbfbfcd10,0x42)
28757 httpd    GIO   fd 2 wrote 66 bytes
	"Syntax error on line 1 of /usr/pkg/etc/midgard/apache/httpd.conf:
28757 httpd    RET   write 66/0x42
28757 httpd    CALL  write(2,0xbfbfcd10,0x97)
28757 httpd    GIO   fd 2 wrote 151 bytes
	"Cannot load /usr/pkg/lib/httpd/ into server: /usr/pk\
         g/lib/httpd/ Undefined PLT symbol \"mgd_init_ex\" (\
         symnum = 23)
28757 httpd    RET   write 151/0x97
28757 httpd    CALL  exit(1)
Any suggestions would, as always, be highly appreciated.  Of
course, I can provide any additional information needed.