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: aaron
======================================================================
Project: DBMail
Bug ID: 177
Category: Authentication layer
Reproducibility: always
Severity: major
Priority: normal
Status: feedback
======================================================================
Date Submitted: 26-Feb-05 23:50 CET
Last Modified: 25-Mar-05 15:44 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.
----------------------------------------------------------------------
mobrien - 10-Mar-05 09:10 CET
----------------------------------------------------------------------
FRESH CVS with patch < dbmail-getopt.diff
FreeBSD 5.3 Feb 6 CVSUP
[snip]
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:65: error: previous declaration of 'dm_getopt' was here
/usr/include/unistd.h:376: error: conflicting types for 'dm_getopt'
dm_getopt.h:65: error: previous declaration of 'dm_getopt' was here
gmake[2]: *** [pop3d.o] Error 1
[snip]
----------------------------------------------------------------------
aaron - 10-Mar-05 14:23 CET
----------------------------------------------------------------------
Try the v2 patch (replace the original dm_getopt.h first).
----------------------------------------------------------------------
mobrien - 11-Mar-05 02:14 CET
----------------------------------------------------------------------
Nice going, Aaron. Clever.
dbmail-getopt-v2.diff resolves bug for 5.3. I did a couple of fresh builds
on different 5.3 hosts using fresh svn and it works like a charm for
dbmail_2_branch.
I can't say 'yay or nay' for FBSD V 4.10/11. The hosts I have with these
versions are production and now too heavily customized for a reliable
test. I can't see why your patch would not work and would cause the use of
dm_getopt on a virgin (no native getopt nor workaround) install of FBSD
4.1x. Does that sound right to you?
I think the bug is fixed.
----------------------------------------------------------------------
paul - 11-Mar-05 10:07 CET
----------------------------------------------------------------------
patch applied.
----------------------------------------------------------------------
aaron - 12-Mar-05 20:31 CET
----------------------------------------------------------------------
Confirmed to work and committed to SVN. All done here.
----------------------------------------------------------------------
paul - 25-Mar-05 10:12 CET
----------------------------------------------------------------------
It doesn't seem to work for all freebsd variants.
----------------------------------------------------------------------
aaron - 25-Mar-05 14:08 CET
----------------------------------------------------------------------
Better specify which!
----------------------------------------------------------------------
paul - 25-Mar-05 15:44 CET
----------------------------------------------------------------------
Problems reported for:
FreeBSD:
4.11
4.9
MacOS X:
10.3.8
<copy:from Mike's post to the list>
SUGGESTION:
1) I don't think you can solve the getopt problem for legacy
4.x FreeBSD unless dm_getopt is changed. What about using
Frodo's (http://www.frodol.dds.nl/getopt.html) getopt
instead of Benjamin Sittler's dm_getopt?
2) Could the DBMail configure.in point, if OS FBSD 4.x, to
native getopt?
</copy>
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
10-Mar-05 03:01aaron File Added: dbmail-getopt.diff
10-Mar-05 09:10mobrien Bugnote Added: 0000599
10-Mar-05 14:23aaron File Added: dbmail-getopt-v2.diff
10-Mar-05 14:23aaron Bugnote Added: 0000600
11-Mar-05 02:14mobrien Bugnote Added: 0000601
11-Mar-05 10:06paul File Added: 01_quota.dpatch
11-Mar-05 10:07paul File Deleted: 01_quota.dpatch
11-Mar-05 10:07paul Bugnote Added: 0000602
12-Mar-05 20:31aaron Bugnote Added: 0000605
12-Mar-05 20:31aaron Assigned To => aaron
12-Mar-05 20:31aaron Resolution open => fixed
12-Mar-05 20:31aaron Status new => resolved
25-Mar-05 10:12paul Bugnote Added: 0000628
25-Mar-05 10:12paul Resolution fixed => reopened
25-Mar-05 10:12paul Status resolved => feedback
25-Mar-05 14:08aaron Bugnote Added: 0000630
25-Mar-05 15:44paul Bugnote Added: 0000631
======================================================================