Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Apr 96 11:34:35 MDT
From:      Greg Lehey <lehey.pad@sni.de>
To:        michael@memra.com (Michael Dillon)
Cc:        freebsd-ports@freebsd.org
Subject:   Re: Berkeley DB 1.8.5
Message-ID:  <199604220934.LAA07455@nixpbe.pdb.sni.de>
In-Reply-To: <Pine.BSI.3.93.960421231140.10172H-100000@sidhe.memra.com>; from "Michael Dillon" at Apr 21, 96 11:19 pm

next in thread | previous in thread | raw e-mail | index | archive | help
>
> Has anyone ported this to 2.1R? I unpack the source code from
> ftp.cs.berkeley.edu, go into the PORT/bsd.4.4 and type "make".
> It dies quickly with a bunch of errors like...
>
> cc -c -D__DBINTERFACE_PRIVATE -O -I. -Iinclude -I../../hash
> ../../hash/hash.c
> In file included from ../../hash/hash.c:48:
> /usr/include/stdlib.h:80: parse error before `__dead2'
> /usr/include/stdlib.h:80: warning: data definition has no type or storage
> class
> (etc)
>
> I can't figure out what is happening. I realize that this is integrated
> into the libc for -current but I don't want to upgrade my whole system
> just to get this one library. If it needs some different treatment than
> BSD 4.4, why doesn't somebody send them patches so they can add a freebsd
> option in their PORT directory?

This has nothing to do with the library itself.  For some reason, the
compiler is getting confused by the definitions in the library header
files.  Try looking at the preprocessor output:  

cc -c -D__DBINTERFACE_PRIVATE -O -I. -Iinclude -I../../hash -C -E -dD >junk.c

junk.c will contain all the header files, and will have the #defines
substituted.  Search for the string '@(#)stdlib.h', and then further
occurrences of the name 'stdlib.h'.  The lines starting with # specify
line numbers within the source files.  I'd guess that you'll find
something obvious about the definitions at line 80 and on.

For further details, see page 99-102 of my book "Porting UNIX
Software" (O'Reilly).  Unfortunately, the production department
"embellished" this section somewhat: it contains a number of \/
sequences, which shouldn't be there and which confuse the issue
somewhat.

> Actually, the linux PORT seems to compile better. I get the following
> errors but I think I can deal with them....
>
> cc -c -D__DBINTERFACE_PRIVATE -O -I. -Iinclude -I../../hash
> ../../hash/hash.c
> In file included from ../../hash/hash.c:55:
> include/db.h:54: redefinition of `int8_t'
> /usr/include/machine/types.h:57: `int8_t' previously declared here
> include/db.h:55: redefinition of `u_int8_t'
> /usr/include/machine/types.h:58: `u_int8_t' previously declared here
> include/db.h:56: redefinition of `int16_t'
> /usr/include/machine/types.h:59: `int16_t' previously declared here
> include/db.h:57: redefinition of `u_int16_t'
> /usr/include/machine/types.h:60: `u_int16_t' previously declared here
> include/db.h:58: redefinition of `int32_t'
> /usr/include/machine/types.h:61: `int32_t' previously declared here
> include/db.h:59: redefinition of `u_int32_t'
> /usr/include/machine/types.h:62: `u_int32_t' previously declared here
> *** Error code 1
>
> I'm not on the list so you'll need to Cc: me if you want to ask anything.

This one should be pretty obvious: the Linux version includes
definitions in include/db.h which have already been made in the system
header files.  Remove them, or, better, #ifdef them out (#ifdef Linux,
or whatever Linux uses to recognize its environment).

Greg



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199604220934.LAA07455>