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: 01-Apr-05 07:06 CEST
======================================================================
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>
----------------------------------------------------------------------
aaron - 25-Mar-05 16:50 CET
----------------------------------------------------------------------
The getopt you linked to in getopt(1), to be called from shell scripts. Ben
Sittler's getopt is getopt(3), to be called from C programs.
FreeBSD 4.x's getopt is absolutely completely non-GNU compatible, which
means #ifdef's, no long options (we'll use them eventually I'm sure) and
subtly different semantics on the command line. It is precisely because of
FreeBSD 4.x that I have a replacement getopt.
If someone is getting the same old errors, or new and different errors,
please post them. So far reopening this bug has been way too vague to fix
anything...
----------------------------------------------------------------------
aaron - 25-Mar-05 18:50 CET
----------------------------------------------------------------------
dm_getopt builds cleanly on Mac OS X 10.2 (SourceForge compile farm), what
didn't build was serverchild.c (bug files separately).
Ok, found it on FreeBSD 4.10. Here's what I'm going to do: always use
dm_getopt, and rename everything to point to it. No more system getopt at
all, GNU or not.
Patch coming soon.
----------------------------------------------------------------------
mobrien - 25-Mar-05 23:22 CET
----------------------------------------------------------------------
What you say is right, Aaron. Frodo's link is not too helpful either,
dating back to 1997... Oddly, his package works in concert with gnugetopt
(as a requirement) and once installed, DBMail will build. In reading
through the posts I see one more thing. Where getopt-1.3.1 is installed in
/usr there's a problem. But when added to that is getopt-1.3.1_1 in
/usr/local, DbMail can build relying on native getopt. I am wondering
about the linked libraries? I am afraid I just don't understand it well
enough. I wish I could be more help. The getopt issue with legacy FBSD is
long standing. It is an aberration. I have some capability to test a FBSD
range from 4.9 to 4.11 if that would help. Say the word. - Mike
----------------------------------------------------------------------
aaron - 26-Mar-05 21:38 CET
----------------------------------------------------------------------
I just tested the v3 patch on FreeBSD 4.8, Mac OS X 10.2 and Gentoo Linux.
Committed to SVN.
----------------------------------------------------------------------
tjn - 01-Apr-05 06:37 CEST
----------------------------------------------------------------------
Another simple way to resolve problem on FreeBSD 5.21 is just comment
"extern int dm_getopt(int argc, char * argv[], const char *opts);" in
dm_getopt.h
----------------------------------------------------------------------
aaron - 01-Apr-05 06:54 CEST
----------------------------------------------------------------------
I'm not sure what you mean about the extern... but does the v3 patch work
for you? It's in CVS right now, and will appear in 2.0.5 and later
versions unless we get bug reports that it doesn't work!
----------------------------------------------------------------------
tjn - 01-Apr-05 07:06 CEST
----------------------------------------------------------------------
/* UNIX-style short-argument parser
extern int dm_getopt(int argc, char * argv[], const char *opts); */
works for me.
Actually for freebsd 5.2.1 was a few problems.
"mysq_config" was not fount (specified manually)
with flag --with-mysql while compiling, (mysql.h) was not fond. In my
system it
was located in /usr/local/mysql/include
after was error ld -lmysqlclient not found, linking libmysqlclient.so as
libmysqlclient.a (it was in /usr/local/mysql/lib) problem was fixed.
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
25-Mar-05 16:50aaron Bugnote Added: 0000632
25-Mar-05 18:50aaron Bugnote Added: 0000633
25-Mar-05 23:22mobrien Bugnote Added: 0000634
26-Mar-05 21:03aaron File Added: dbmail-getopt-v3.diff
26-Mar-05 21:09aaron File Added: dbmail-getopt-v3.diff
26-Mar-05 21:09aaron File Deleted: dbmail-getopt-v3.diff
26-Mar-05 21:38aaron Bugnote Added: 0000635
01-Apr-05 06:37tjn Bugnote Added: 0000642
01-Apr-05 06:54aaron Bugnote Added: 0000643
01-Apr-05 07:06tjn Bugnote Added: 0000644
======================================================================