Subject: Re: CVS commit: pkgsrc/pkgtools/pkg_install
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 04/11/2003 10:35:58
On Fri, 11 Apr 2003, grant beattie wrote:

> only include db1 support if on NetBSD. fixes updating problem on Solaris.

I use the pkg_* tools under Linux. This is version 20030325. (Before your
change.)

My .buildlink/lib directory is empty, but it does have a
.buildlink/include/ for /usr/include/db.h

But the configure detected it. The pkg_install-20030325/config.status has:
s%@LIBS@%-ldb1 %g

And pkg_install-20030325/lib/config.h has:
#define HAVE_DBOPEN 1
#define HAVE_DB_H 1
#define HAVE_DB1_DB_H 1
#define HAVE_NETDB_H 1
#define HAVE_LIBDB1 1

$ ldd /usr/sbin/pkg_*
/usr/sbin/pkg_add:
        libdb.so.2 => /lib/libdb.so.2 (0x2aac8000)
        libc.so.6 => /lib/libc.so.6 (0x2aad7000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaab000)
/usr/sbin/pkg_admin:
        libdb.so.2 => /lib/libdb.so.2 (0x2aac8000)
        libc.so.6 => /lib/libc.so.6 (0x2aad7000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaab000)
/usr/sbin/pkg_create:
        libdb.so.2 => /lib/libdb.so.2 (0x2aac8000)
        libc.so.6 => /lib/libc.so.6 (0x2aad7000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaab000)
/usr/sbin/pkg_delete:
        libdb.so.2 => /lib/libdb.so.2 (0x2aac8000)
        libc.so.6 => /lib/libc.so.6 (0x2aad7000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaab000)
/usr/sbin/pkg_info:
        libdb.so.2 => /lib/libdb.so.2 (0x2aac8000)
        libc.so.6 => /lib/libc.so.6 (0x2aad7000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaab000)

Although, this is not what I wanted. I wanted to it to build and
install the db from pkgsrc and link to it.

So I moved my /usr/include/db.h (and /usr/include/db1/db.h) out of the
way. Then rebuilt pkg_install which built and installed db-2.7.7nb1.
And created buildlink for it. Then the pkg_install build failed:

gcc -DHAVE_CONFIG_H -I. -I. -I/usr/include/db2  -I/usr/include -O2
-I/usr/include -c pkgdb.c -o pkgdb.o
pkgdb.c: In function `pkgdb_open':
pkgdb.c:81: `BTREEINFO' undeclared (first use in this function)
...
pkgdb.c:142: `R_NOOVERWRITE' undeclared (first use in this function)
...
pkgdb.c:192: `R_FIRST' undeclared (first use in this function)
...
pkgdb.c:192: `R_NEXT' undeclared (first use in this function)

These are defined in
/usr/pkgsrc/pkgtools/pkg_install/work.tahoma/.buildlink/include/db2/db_185.h

The pkgdb.c has:
#ifdef HAVE_DB1_DB_H
#include <db1/db.h>
#elif defined(HAVE_DB_H)
#include <db.h>
#endif

I don't have db.h nor db1/db.h buildlinked.

I think the autoconf setup needs to be modified so it checks for db_185.h
and sets some HAVE_DB_185_H. Also, it needs ot be sure to use the correct
db includes.

I made it work by manually changing pkgdb.c to have:
#include <db2/db_185.h>
(and commented out other db includes.)

That build fine and ran fine, but I see it linked to wrong library.

So I manually fixed Makefiles to use db2 instead of db1 library.

This also worked.

Can someone fix the autoconf to correctly use the db2 (or whatever is
buildlinked)?

   Jeremy C. Reed
   http://bsd.reedmedia.net/