Discussion:
getopt _getopt_internal declaration clash on Solaris 5.10
(too old to reply)
Gavin Smith
2017-04-29 17:11:38 UTC
Permalink
Raw Message
---
On Solaris 5.10, compilation fails due to a conflict in gnulib's getopt module.
https://pretest.housegordon.org/g/4602/logs/make.log?inlined=1
(search for "getopt_int" to find the error).
===
gcc -DHAVE_CONFIG_H -I. -I../.. -D_REENTRANT -g -O2 -MT getopt.o -MD -MP -MF $depbase.Tpo -c -o getopt.o getopt.c &&\
mv -f $depbase.Tpo $depbase.Po
getopt_int.h:25:12: error: conflicting types for '_getopt_internal'
extern int _getopt_internal (int ___argc, char **___argv,
^
In file included from ./getopt.h:34:0,
from getopt.h:34,
/opt/csw/include/getopt.h:118:12: note: previous declaration of '_getopt_internal' was here
extern int _getopt_internal (int argc, char *const *argv,
^
getopt.c:702:1: error: conflicting types for '_getopt_internal'
_getopt_internal (int argc, char **argv, const char *optstring,
^
In file included from ./getopt.h:34:0,
from getopt.h:34,
/opt/csw/include/getopt.h:118:12: note: previous declaration of '_getopt_internal' was here
extern int _getopt_internal (int argc, char *const *argv,
^
*** Error code 1
make: Fatal error: Command failed for target `getopt.o'
On a Solaris 5.10 system I have access to, /opt/csw/include/getopt.h
is a GNU libc include file from 1997. It is probably the same file that
you are using, as the declaration is on the same line (118).

I know it is possible to compile on this system with the right
environment because it's done successfully on the OpenCSW buildfarm.
(See https://buildfarm.opencsw.org/buildbot/waterfall?category=texinfo
for logs).

I tried compiling Texinfo 6.3 the same way and didn't get the same
error, so it is probably due to a change in Gnulib.

I found in the older gnulib, the _getopt_internal had been redefined
as rpl_getopt_internal after the system header had been read, so the
definition clash did not occur.

I'm copying bug-gnulib into this email to see if the Gnulib developers
can take this any further.

I believe the section that #define's the function names is now in
getopt-pfx-ext.h. _getopt_internal is not redefined there. Formerly,
I believe it was in getopt.h that _getopt_internal was redefined,
like this:

# define _getopt_internal __GETOPT_ID (getopt_internal)
Paul Eggert
2017-04-29 18:11:29 UTC
Permalink
Raw Message
Thanks for the heads-up. I installed the attached Gnulib patch, which I hope fix
things. Please give it a try.

Loading...