A BUGNOTE has been added to this bug.
======================================================================
http://www.dbmail.org/mantis/bug_view_advanced_page.php?bug_id=0000177
======================================================================
Reported By:                mobrien
Assigned To:                
======================================================================
Project:                    DBMail
Bug ID:                     177
Category:                   Authentication layer
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             26-Feb-05 23:50 CET
Last Modified:              10-Mar-05 02:59 CET
======================================================================
Summary:                    Compile Fails - FBSD users Unable to build Dbmail 
latest
Description: 
compile fails on 
[snip]
gcc -DHAVE_CONFIG_H -I. -I. -I. -fomit-frame-pointer -g -O2 -W -Wall
-Wpointer-arith -Wstrict-prototypes -c pop3d.c 
In file included from misc.h:32, 
from pop3d.c:41: 
/usr/include/unistd.h:376: error: conflicting types for 'dm_getopt' 
dm_getopt.h:62: error: previous declaration of 'dm_getopt' was here 
/usr/include/unistd.h:376: error: conflicting types for 'dm_getopt' 
dm_getopt.h:62: error: previous declaration of 'dm_getopt' was here 
[snip]
======================================================================

----------------------------------------------------------------------
 mobrien - 26-Feb-05 23:53 CET 
----------------------------------------------------------------------
Category "GENERAL" (sri)

----------------------------------------------------------------------
 mobrien - 01-Mar-05 15:44 CET 
----------------------------------------------------------------------
FBSD 5.3 Line 374-376 re:getopt Offending line is 376
374 | #ifndef _GETOPT_DECLARED                           
375 | #define _GETOPT_DECLARED                           
376 | int      getopt(int, char * const [], const char *);

Also:
FBSD 4.10 error message =
[snip]
In file included from misc.h:32,                           
                 from pop3d.c:41:                          
/usr/include/unistd.h:112: conflicting types for `dm_getopt'
[snip]

where /usr/include/unistd.h is like this:
110 |extern char *optarg;                    /* getopt(3) external
variables */
111 |extern int optind, opterr, optopt;                                   
   
112 | int      getopt __P((int, char * const [], const char *));

----------------------------------------------------------------------
 aaron - 01-Mar-05 18:32 CET 
----------------------------------------------------------------------
I don't have access to a FreeBSD 5.x machine, so if you can figure this
out, please send a patch. Basically you need to take a look into
db_getopt.h, configure.in, acincludes.m4 to see if the tests for GNU-style
getopt are correct for FreeBSD 5.3.

This has all been tested on FreeBSD 4.7 and OpenBSD 3.6, but apparently
FreeBSD 5.x is doing something differently!

----------------------------------------------------------------------
 mobrien - 02-Mar-05 02:33 CET 
----------------------------------------------------------------------
Very sage advice. Thanks, Aaron.

NOTE: I didn't think FBSD 4.7 had native GNU-like getopt -- not until 5.0
branch for native getopt. Anyway, so Aaron you may have a magic-bullet
solution in the contrib getopt on your 4.7 host.

Anyway... for FBSD 4.8 /4.9 /4.10 and 4.11 (don't have 4.7) build fails
for 2_0_Branch since about 01/15/2005 

TO FIX THIS ...
For FBSD 4.x Versions only: I link /usr/local/include/getopt.h to
./dm_getopt.h to build dm_getopt.o after installing getopt-1.1.3_1 from
/usr/ports/misc/getopt. (I tried forcing with configure.in to use contrib
getopt in /usr/local but no luck.)

so, to dbmail install directory after installing getopt-1.1.3_1

mv dm_getopt.h dm_getopt.h.ORIG
ln -s /usr/local/include/getopt.h ./dm_getopt.h

./configure --with-XXsql

gmake
gmake install
/* everything happy but I guess that's a wierd way to do this */


More to do on FBSD 5.3 but it is building OK by altering configure.in or
config.in to remove dm_getopt and use native getopt (/usr/include/ not
/usr/local/include.  That's wierd. Configure should have decided that on
its own (?)

I wonder if dm_getopt is a nicely intended convenience but a
cross-platform breaker. Perhaps a require OS-specific getopt is safer. The
latter might be more 'future proof'. 

I will try and finalize something.

----------------------------------------------------------------------
 aaron - 10-Mar-05 02:59 CET 
----------------------------------------------------------------------
Actually, I'd rather if our getopt is "GNU or Death" and only use system
getopt when it really, really is GNU. The problem is that unistd.h pulls
in getopt.h. So I've added defines to trigger the include guards _GETOPT_H
and GETOPT_H to keep it out.

Try applying this patch.

Bug History
Date Modified  Username       Field                    Change              
======================================================================
26-Feb-05 23:50mobrien        New Bug                                      
26-Feb-05 23:53mobrien        Bugnote Added: 0000591                       
01-Mar-05 15:44mobrien        Bugnote Added: 0000592                       
01-Mar-05 18:32aaron          Bugnote Added: 0000593                       
02-Mar-05 02:33mobrien        Bugnote Added: 0000594                       
10-Mar-05 02:59aaron          Bugnote Added: 0000596                       
======================================================================

Reply via email to