This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc-3.2-3: bootstrap build fails (HAVE_DECL_GETOPT not in config.h?)


Trying to build gcc-3.2-3 from scratch.  Have the near latest versions of
everything in cygwin (see cygcheck.out).

Used the following configure command line:

/usr/src/gcc-3.2-3/configure --with-program-suffix=-3.2-3-test --prefix=$HOM
E/projects/install 2>&1

My config.status file shows:

#!/bin/sh
# This file was generated automatically by configure.  Do not edit.
# This directory was configured as follows:
/usr/src/gcc-3.2-3/configure --with-gcc-version-trigger=/usr/src/gcc-3.2-3/g
cc/version.c --host=i686-pc-cygwin --with-program-suffix=-3.2-3-test --prefi
x=/home/mhcox/projects/install --norecursion
# using "mh-frag"

The build fails on compiling pure.cc in
./i686-pc-cygwin/libstdc++-v3/libsupc++ with the following output:

/bin/sh ../libtool --tag CXX --tag disable-shared --mode=compile
/home/mhcox/projects/build/gcc-3.2-3/gcc/xgcc -shared-libgcc -B/home/mhcox/p
rojects/build/gcc-3.2-3/gcc/ -nostdinc++  -L/home/mhcox/projects/build/gcc-3
.2-3/i686-pc-cygwin/libstdc++-v3/src -L/home/mhcox/projects/build/gcc-3.2-3/
i686-pc-cygwin/libstdc++-v3/src/.libs -B/home/mhcox/projects/install/i686-pc
-cygwin/bin/ -B/home/mhcox/projects/install/i686-pc-cygwin/lib/ -isystem
/home/mhcox/projects/install/i686-pc-cygwin/include -I/usr/src/gcc-3.2-3/lib
stdc++-v3/../gcc -I/usr/src/gcc-3.2-3/libstdc++-v3/../include -I/home/mhcox/
projects/build/gcc-3.2-3/i686-pc-cygwin/libstdc++-v3/include/i686-pc-cygwin 
-I/home/mhcox/projects/build/gcc-3.2-3/i686-pc-cygwin/libstdc++-v3/include -
I/usr/src/gcc-3.2-3/libstdc++-v3/libsupc++   -g -O2 -fno-implicit-templates 
 -Wall -Wno-format -W -Wwrite-strings -Winline  -fdiagnostics-show-location=
once  -ffunction-sections -fdata-sections -g    -c
/usr/src/gcc-3.2-3/libstdc++-v3/libsupc++/pure.cc
/home/mhcox/projects/build/gcc-3.2-3/gcc/xgcc -shared-libgcc -B/home/mhcox/p
rojects/build/gcc-3.2-3/gcc/ -nostdinc++ -L/home/mhcox/projects/build/gcc-3.
2-3/i686-pc-cygwin/libstdc++-v3/src -L/home/mhcox/projects/build/gcc-3.2-3/i
686-pc-cygwin/libstdc++-v3/src/.libs -B/home/mhcox/projects/install/i686-pc-
cygwin/bin/ -B/home/mhcox/projects/install/i686-pc-cygwin/lib/ -isystem
/home/mhcox/projects/install/i686-pc-cygwin/include -I/usr/src/gcc-3.2-3/lib
stdc++-v3/../gcc -I/usr/src/gcc-3.2-3/libstdc++-v3/../include -I/home/mhcox/
projects/build/gcc-3.2-3/i686-pc-cygwin/libstdc++-v3/include/i686-pc-cygwin 
-I/home/mhcox/projects/build/gcc-3.2-3/i686-pc-cygwin/libstdc++-v3/include -
I/usr/src/gcc-3.2-3/libstdc++-v3/libsupc++ -g -O2 -fno-implicit-templates -W
all -Wno-format -W -Wwrite-strings -Winline -fdiagnostics-show-location=once
 -ffunction-sections -fdata-sections -g -c
/usr/src/gcc-3.2-3/libstdc++-v3/libsupc++/pure.cc -o pure.o
cc1plus: warning: -ffunction-sections may affect debugging on some targets
In file included from /usr/include/unistd.h:8,
                 from /usr/src/gcc-3.2-3/libstdc++-v3/libsupc++/pure.cc:34:
/usr/src/gcc-3.2-3/include/getopt.h:115: declaration of C function `int
   getopt()' conflicts with
/usr/include/sys/unistd.h:125: previous declaration `int getopt(int, char*
   const*, const char*)' here
make[4]: *** [pure.lo] Error 1
make[4]: Leaving directory
`/home/mhcox/projects/build/gcc-3.2-3/i686-pc-cygwin/libstdc++-v3/libsupc++'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory
`/home/mhcox/projects/build/gcc-3.2-3/i686-pc-cygwin/libstdc++-v3'
make[2]: *** [all-recursive-am] Error 2
make[2]: Leaving directory
`/home/mhcox/projects/build/gcc-3.2-3/i686-pc-cygwin/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: Leaving directory `/home/mhcox/projects/build/gcc-3.2-3'
make: *** [bootstrap] Error 2

Looking at /usr/src/gcc-3.2-3/include/getopt.h it looks like __GNU_LIBRARY__
and HAVE_DECL_GETOPT are not being defined/set:

#if defined (__STDC__) && __STDC__
/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1.  If it is
   undefined, we haven't run the autoconf check so provide the
   declaration without arguments.  If it is 0, we checked and failed
   to find the declaration so provide a fully prototyped one.  If it
   is 1, we found it so don't provide any declaration at all.  */
#if defined (__GNU_LIBRARY__) || (defined (HAVE_DECL_GETOPT) &&
!HAVE_DECL_GETOPT)
/* Many other libraries have conflicting prototypes for getopt, with
   differences in the consts, in stdlib.h.  To avoid compilation
   errors, only prototype getopt for the GNU C library.  */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
# if !defined (HAVE_DECL_GETOPT)
extern int getopt ();					<<<<<< line 115 (that conflicting getopt() seen by
the compiler)
# endif
#endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
		        const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
			     const char *shortopts,
		             const struct option *longopts, int *longind);

/* Internal only.  Users should not call this directly.  */
extern int _getopt_internal (int argc, char *const *argv,
			     const char *shortopts,
		             const struct option *longopts, int *longind,
			     int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
extern int getopt_long_only ();

extern int _getopt_internal ();
#endif /* __STDC__ */

In the output from configure had the following lines:
...
checking for unistd.h... yes
...
checking whether getopt is declared... yes

Also, the following line is in the config.cache at the top of the tree:

gcc_cv_have_decl_getopt=${gcc_cv_have_decl_getopt='yes'}

but not in ./i686-pc-cygwin (under which libstdc++/libsup++ is built).

I greped through all the config.h files for HAVE_DECL_GETOPT, but could not
find it.
>From the output of configure and the config.cache (at the top of the tree)
it looks like
it should have defined it.  Also, since it seems like __GNU_LIBRARY__ should
be defined/set
(I'm not sure if libsup++ is part of the GNU library).  My guess is that
there's a
problems with the configure script generator or it's input (or, more likely,
I'm not
building it correctly :-).  I'm not very familiar with autoconf, autoheader,
etc. so
I hesitate to try to fix it on my own (are there any user guides/tutorials
on using
these tools?).

Also, I think the line 114 in getopt.h should be:

#if !defined(HAVE_DECL_GETOPT) && !defined(__cplusplus)

That way C++ code could include this file without a problem (assuming that
getopt()
is declared somewhere else, e.g. unistd.h)

Mike

Attachment: cygcheck.out
Description: Binary data

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]