Subject: Re: rpm 4.0.2 Build Problem (was Re: Installing Berkeley DB 3.2.9)
From: Jason Tishler <[email-masked]>
To: "Charles S. Wilson" <[email-masked]>
Cc: [email-masked]
Date: Tue, 17 Jul 2001 14:07:16 -0400

Chuck,

On Mon, Jul 16, 2001 at 08:20:16PM -0400, Charles S. Wilson wrote:
> Jason Tishler wrote
> > I followed your advice and read the spec file from the Red Hat db 3.2.9
> > RPM.  I used the information gleaned to post process make install to
> > match the harmonization mentioned above.  Then I reran configure on rpm.
> > Finally, after some head banging I managed to "build" rpm.
> 
> Wow.  That's great -- and a lot of work, I'll bet.

Actually, it was too bad -- it was a piece of cake compared to my Python
work.  I didn't even need any aspirin this time.  OK, maybe my head is
just getting harder... :,)

> Muchas gracias.

You are very welcome.

> > I will
> > entertain posting a patch once I figure out the right way to correct all
> > of the issue.  I guess that it is time to learn automake.  Sigh...
> 
> See the goat book: http://sources.redhat.com/autobook/ if you haven't 
> already done so. Chapter 25: Using GNU Autotools with Cygnus Cygwin is 
> especially interesting (if slightly out-of-date (*)).

Thanks for reminding me about the above.  I read most of the Cygwin
sections before (when Gary first announced it) and I just reread the
relevant sections again today.

See attached for a patch that enables rpm 4.0.2 to build under the
latest Cygwin.  The procedure to apply the patch and build is as follows:

    $ # save the attachment to /tmp/rpm-4.0.2.patch
    $ wget -nd -P /tmp ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-4.0.2.tar.gz
    $ tar -xzf /tmp/rpm-4.0.2.tar.gz
    $ cd rpm-4.0.2
    $ patch -p1 </tmp/rpm-4.0.2.patch
    $ aclocal
    $ autoconf
    $ automake
    $ configure
    $ make

Unfortunately, the above has the following dependencies/caveats:

    1. The aclocal step requires libtool.m4 in order to resolve
       AM_PROG_LIBTOOL.  Since I did not already have libtool installed,
       I just used the libtool.m4 from the libtool 1.3.5 tarball (which
       is the version expected by rpm 4.0.2).

    2. The aclocal step also seems to require the version of gettext.m4
       from 0.10.35.  If aclocal found the 0.10.38 version, then either
       autoconf or automake got confused such that half of the build
       wanted to use the included gettext while the other half did not.
       My workaround was to temporarily replace my gettext.m4 with the
       older one.
    
    3. The rpm source implicitly assumes that the db 3.x.y (i.e., 3.2.9)
       installation has the following directory structure and naming
       convention:

       lrwxrwxrwx <prefix>/include/db.h -> db3/db.h
       drwxr-xr-x <prefix>/include/db3/
       -r--r--r-- <prefix>/include/db3/db.h
       -r--r--r-- <prefix>/include/db3/db_185.h
       -r--r--r-- <prefix>/include/db3/db_cxx.h
       drwxr-xr-x <prefix>/lib/
       -r--r--r-- <prefix>/lib/libdb-3.1.a

I am most unhappy about #2, do you (or anyone else) know what is awry?
Also, would you (or anyone else) be interested in critiquing my patch?
My biggest concern is with the tools/Makefile.am hunk -- maybe this
should be conditional for Cygwin only?

I'm willing to submit the patch for consideration once I get some
feedback and some the above issues are resolved or dismissed.

Thanks,
Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: 732.264.8770 x235
Dot Hill Systems Corp.               Fax:   732.264.8798
82 Bethany Road, Suite 7             Email: [email-masked]
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com
diff -upr rpm-4.0.2.orig/configure.in rpm-4.0.2/configure.in
--- rpm-4.0.2.orig/configure.in	Sun Feb 25 12:13:26 2001
+++ rpm-4.0.2/configure.in	Tue Jul 17 10:39:07 2001
@@ -45,6 +45,7 @@ if test X"$GCC" = Xyes ; then
 		*-*-solaris*)	LDFLAGS_STATIC="-static";;
 		*-*-hpux*)	LDFLAGS_STATIC="-static";;
 		*-*-sysv5uw*)   LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
+		*-*-cygwin*)	LDFLAGS_STATIC="";; # static linking on Cygwin is bad!
 		*-*-*)		LDFLAGS_STATIC="-all-static";;
 	esac
 elif test X"$CC" = Xcc ; then
@@ -398,6 +399,9 @@ done
 
 AC_CHECK_FUNC(fork, [], [echo "using vfork() instead of fork()";
 	LIBOBJS=fakefork.o])
+
+AC_CHECK_FUNC(errx, [], [echo "using included err.c";
+	LIBOBJS="$LIBOBJS err.o"])
 
 dnl AmigaOS and IXEmul have a fork() dummy
     case "$target" in
diff -upr rpm-4.0.2.orig/lib/db3.c rpm-4.0.2/lib/db3.c
--- rpm-4.0.2.orig/lib/db3.c	Wed Feb 14 19:16:09 2001
+++ rpm-4.0.2/lib/db3.c	Mon Jul 16 14:07:30 2001
@@ -135,7 +135,7 @@ static int db_fini(dbiIndex dbi, const c
 
 	xx = db_env_create(&dbenv, 0);
 	xx = cvtdberr(dbi, "db_env_create", rc, _debug);
-#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 1
+#if DB_VERSION_MAJOR == 3 && (DB_VERSION_MINOR == 1 || DB_VERSION_MINOR == 2)
 	xx = dbenv->remove(dbenv, dbhome, 0);
 #else
 	xx = dbenv->remove(dbenv, dbhome, NULL, 0);
@@ -213,7 +213,7 @@ static int db_init(dbiIndex dbi, const c
  /* dbenv->set_tx_max(???) */
  /* dbenv->set_tx_recover(???) */
     if (dbi->dbi_no_fsync) {
-#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 1
+#if DB_VERSION_MAJOR == 3 && (DB_VERSION_MINOR == 1 || DB_VERSION_MINOR == 2)
 	xx = db_env_set_func_fsync(db3_fsync_disable);
 #else
 	xx = dbenv->set_func_fsync(dbenv, db3_fsync_disable);
@@ -231,7 +231,7 @@ static int db_init(dbiIndex dbi, const c
 #endif	/* __USE_DB3 */
 
 #if defined(__USE_DB3)
-#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 1
+#if DB_VERSION_MAJOR == 3 && (DB_VERSION_MINOR == 1 || DB_VERSION_MINOR == 2)
     rc = dbenv->open(dbenv, dbhome, eflags, dbi->dbi_perms);
 #else
     rc = dbenv->open(dbenv, dbhome, NULL, eflags, dbi->dbi_perms);
diff -upr rpm-4.0.2.orig/tools/Makefile.am rpm-4.0.2/tools/Makefile.am
--- rpm-4.0.2.orig/tools/Makefile.am	Mon Dec 11 13:41:27 2000
+++ rpm-4.0.2/tools/Makefile.am	Tue Jul 17 11:14:32 2001
@@ -31,6 +31,7 @@ pkgbin_PROGRAMS = javadeps
 
 rpmsort_SOURCES =	rpmsort.c
 rpmsort_LDFLAGS =
+rpmsort_LDADD = $(myLDADD) @LIBMISC@
 
 javadeps_SOURCES =	javadeps.c
 
diff -upr rpm-4.0.2.orig/tools/rpmsort.c rpm-4.0.2/tools/rpmsort.c
--- rpm-4.0.2.orig/tools/rpmsort.c	Wed Dec  6 18:30:16 2000
+++ rpm-4.0.2/tools/rpmsort.c	Mon Jul 16 14:20:10 2001
@@ -6,6 +6,7 @@
 #include "depends.h"
 #include "header.h"
 #include "debug.h"
+#include "err.h"
 
 extern int _depends_debug;

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/