RPM Community Forums

Mailing List Message of <rpm-devel>

Re: empty struct in rpmdb/db_emu.h

From: Jeff Johnson <n3npq@mac.com>
Date: Sun 25 Nov 2007 - 06:18:09 CET
Message-Id: <DB9468EB-AA8D-448C-BD5E-9DE329FDC737@mac.com>

On Nov 24, 2007, at 9:35 PM, David Halik wrote:

>
> Sun Studio and Solaris 9 is once again being more strict than gcc.  
> I ran into this while compiling 5.0a3:
>
> cc -c  -I../. -I../build -I../lib -I../popt -I../rpmdb -I../rpmio - 
> I../rpmconstant -I/usr/local/include -I/usr/local/include/python2.4  
> -I/usr/local/include/beecrypt -I/usr/local/ssl/include - 
> DRPM_OS_SOLARIS=020900 -I/usr/local/include/neon   -g -xs - 
> D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DNE_LFS   -g   - 
> DVERSION=\"5.0a3\" -DXS_VERSION=\"5.0a3\" -KPIC "-I/usr/perl5/5.6.1/ 
> lib/sun4-solaris-64int/CORE"   rpmxs.c
> "../rpmdb/rpmtag.h", line 104: warning: enumerator value overflows  
> INT_MAX (2147483647)
> "../lib/rpmcli.h", line 157: warning: integer overflow detected: op  
> "<<"
> "../rpmdb/db_emu.h", line 38: warning: syntax error:  empty member  
> declaration
> "../rpmdb/db_emu.h", line 39: zero-sized struct/union
> cc: acomp failed for rpmxs.c
>
> A quick look at db_emu.h shows that struct __db_txn is in fact  
> empty. A little googling points out that C99 does not allow empty  
> struct declarations, so I'm guessing gcc is allowing it and  
> continuing while SS is maor anal as usual. Can I just do an int  
> dummy; here, or is there a more preferred workaround?
>

So you're compiling without Berkeley DB?

 From rpmdb/rpmdb.h:

#if defined(WITH_DB)
#include "db.h"
#else
#include "db_emu.h"
#endif

If you build with BDB, then db_txn will not be an empty structure.

Note: The "optional" in the INSTALL document is what the Berkeley DB  
haters wish
to see; "mandatory" is far closer to reality because rpm -BDB has  
hardly ever been used,
particularly on non-linux with non-gcc compilers.

 From INSTALL
Berkeley-DB [1] optional  4.5     4.6.21  http://www.oracle.com/ 
database/berkeley-db.html
...
[1] db/sqlite: Modified Berkeley-DB copy bundled with RPM.
                Building RPM against stock external Berkeley-DB not  
officially supported.
                Building RPM against SQLite-only not officially  
supported.
                Building RPM against at least one of Berkeley-DB or  
SQLite required.
                Use modified bundled Berkeley-DB copy, please!

> BTW, I decided to go with the much more simpler way of getting  
> around my rpmconstant linking issue by including ../lib/.libs/ 
> librpm.so ../rpmdb/.libs/librpmdb.so to the final rpmconstant  
> linkage. I'm not sure if this is going to break down the road, but  
> it seems to hold up so far.
>

Good.

73 de Jeff
Received on Sun Nov 25 06:18:21 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.