[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Simulavr-devel] getopt_long patch
From: |
Theodore A. Roth |
Subject: |
Re: [Simulavr-devel] getopt_long patch |
Date: |
Thu, 24 Jan 2002 13:59:21 -0700 (MST) |
Ken,
This looks suspiciously like the compiler is trying to cat two copies of
gnu_getopt.c together and compile the resulting file. gnu_getopt.c is 1057
lines long and the redefinition of optarg is offset by that much. The
patch looks ok to me. I was able to duplicate the failure by appending
gnu_getopt.c to itself and #if'ing out the ELIDE_CODE definition.
I don't think it's the inclusion of unistd.h (or stdlib.h) that is the
problem since the error messages are for redefinitions not redeclarations.
Can you check your gnu_getopt.c file for duplication?
Ted
:)On Thu, 24 Jan 2002, ken restivo wrote:
:)
:):) Pretty good. Got a clean CVS checkout, patch applied OK. Then
:):) ./bootstrap from my GNU/Linux box. Then ./configure
:):) --with-avr-includes=/usr/local/avr/include --disable-curses on the
:):) FreeBSD 4.3 box with no errors.
:):)
:):) However:
:):)
:):) gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c gnu_getopt.c
:):) gnu_getopt.c:1171: redefinition of `optarg'
:):) gnu_getopt.c:115: `optarg' previously defined here
:):) gnu_getopt.c:1186: redefinition of `optind'
:):) gnu_getopt.c:130: `optind' previously defined here
<snip>
:):) gmake[3]: *** [gnu_getopt.o] Error 1
:):)
:):) The related globals appear to be declared in /usr/include/unistd.h on
FreeBSD:
:):) extern char *optarg; /* getopt(3) external variables */
:):) extern int optind, opterr, optopt;
:):) int getopt __P((int, char * const [], const char *));
:):)
:):) Since you don't have a FreeBSD system, this may help:
:):) http://www.freebsd.org/cgi/cvsweb.cgi/src/include
:):)
:):) I would guess that an #ifndef may fix this?
:):)