[tlbuild] build failure: duplicated extern "C" definition of getopt() when compiling a C++ program

Vladimir Volovich vvv at vsu.ru
Thu May 27 18:44:40 CEST 2010


Hi!

i've got a build failure on Solaris:

source='dvisvgm-0.8.7/src/FileFinder.cpp' object='FileFinder.o' libtool=no \
        DEPDIR=.deps depmode=none /opt/csw/bin/bash ../../../texk/dvisvgm/../../build-aux/depcomp \
        CC -DHAVE_CONFIG_H -I. -I../../../texk/dvisvgm -I../../../texk/dvisvgm/dvisvgm-0.8.7/src -I../../../texk/dvisvgm/dvisvgm-0.8.7/potracelib -I/opt/home/vvv/src/texlive/source/Work/texk -I/opt/home/vvv/src/texlive/source/texk `cat /opt/home/vvv/src/texlive/source/Work/libs/freetype2/ft-includes` -I/opt/home/vvv/src/texlive/source/Work/libs/zlib/include     -xarch=v8 -O -c -o FileFinder.o `test -f 'dvisvgm-0.8.7/src/FileFinder.cpp' || echo '../../../texk/dvisvgm/'`dvisvgm-0.8.7/src/FileFinder.cpp
"/opt/home/vvv/src/texlive/source/texk/kpathsea/getopt.h", line 140: Error: Only one of a set of overloaded functions can be extern "C".
1 Error(s) detected.
gmake[4]: *** [FileFinder.o] Error 1

which seems to be cause by double definition of getopt:

1) /usr/include/stdlib.h has

extern "C" {
...
extern int getopt ( int , char * const * , const char * ) ; 
...
}

2) /usr/include/stdio.h has the same definition of getopt as /usr/include/stdlib.h

3) source/texk/kpathsea/getopt.h has

extern "C" { 
...
extern int getopt ( ) ; 
extern int getopt_long ( ) ; 
extern int getopt_long_only ( ) ; 
...
}

which results in the above error message.

if I replace the prototype of getopt in source/texk/kpathsea/getopt.h to
match the definition from the system headers, compilation proceeds.

Best,
v.


More information about the tlbuild mailing list