Opened 15 years ago

Closed 15 years ago

#469 closed defect

getopt changes in r14327 breaks build on OpenSolaris

Reported by: Tomas Carnecky Owned by: Olly Betts
Priority: normal Milestone: 1.0.20
Component: Build system Version: 1.1.5
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: Solaris

Description

depbase=`echo common/getopt.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
        /bin/sh ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I./common -I./include    -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wundef -Wshadow -Woverloaded-virtual -Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -Winit-self -Wlogical-op -Wmissing-declarations -fvisibility=hidden -m64 -MT common/getopt.lo -MD -MP -MF $depbase.Tpo -c -o common/getopt.lo common/getopt.cc &&\
        mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./common -I./include -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wundef -Wshadow -Woverloaded-virtual -Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -Winit-self -Wlogical-op -Wmissing-declarations -fvisibility=hidden -m64 -MT common/getopt.lo -MD -MP -MF common/.deps/getopt.Tpo -c common/getopt.cc  -fPIC -DPIC -o common/.libs/getopt.o
In file included from /usr/lib/gcc/i386-pc-solaris2.11/4.5.0/../../../../include/c++/4.5.0/cstdlib:68:0,
                 from common/getopt.cc:165:
common/getopt.cc:79:7: error: previous declaration of 'char* Xapian::Internal::optarg' with 'C++' linkage
/usr/include/stdlib.h:226:14: error: conflicts with new declaration with 'C' linkage
common/getopt.cc:94:5: error: previous declaration of 'int Xapian::Internal::optind' with 'C++' linkage
/usr/include/stdlib.h:227:12: error: conflicts with new declaration with 'C' linkage
common/getopt.cc:114:5: error: previous declaration of 'int Xapian::Internal::opterr' with 'C++' linkage
/usr/include/stdlib.h:227:20: error: conflicts with new declaration with 'C' linkage
common/getopt.cc:120:5: error: previous declaration of 'int Xapian::Internal::optopt' with 'C++' linkage
/usr/include/stdlib.h:227:28: error: conflicts with new declaration with 'C' linkage
gmake[2]: *** [common/getopt.lo] Error 1
gmake[2]: Leaving directory `/export/home/tomc/ospkg/tmp/xapian-core-1.1.5'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/export/home/tomc/ospkg/tmp/xapian-core-1.1.5'
gmake: *** [all] Error 2
[ scotch ] ospkg (master) - /tmp/xapian-core-1.1.5/ $

Commenting out the block which defines optXXX to Xapian::Internal::optXXX see allows xapian to build again.

Change History (2)

comment:1 by Olly Betts, 15 years ago

Component: OtherBuild system
Milestone: 1.0.20
Operating System: AllSolaris
Status: newassigned
Summary: r14327 breaks build on OpenSolarisgetopt changes in r14327 breaks build on OpenSolaris

Hmm, so Solaris declares getopt stuff in stdlib.h, which the man page doesn't seem to mention.

I think we need to stop digging and just apply a fix targetted at Cygwin. It doesn't seem ideal that we're creating a second definition of optind, etc on some platforms, but it only actually seems to cause issues on Cygwin. So reverted the recent getopt changes in r14421 and applied a targetted fix in r14422.

Needs backporting for 1.0.20.

comment:2 by Olly Betts, 15 years ago

Status: assignedclosed

Checked the fix compiles on Solaris, and backported for 1.0.20 in r14423.

Note: See TracTickets for help on using tickets.