[Xapian-tickets] [Xapian] #396: Build failure on Mac OS 10.6
Xapian
nobody at xapian.org
Mon Aug 31 01:45:43 BST 2009
#396: Build failure on Mac OS 10.6
--------------------------+-------------------------------------------------
Reporter: james | Owner: olly
Type: defect | Status: assigned
Priority: normal | Milestone: 1.0.16
Component: Build system | Version: 1.0.15
Severity: normal | Keywords:
Blockedby: | Platform: Mac OS X
Blocking: |
--------------------------+-------------------------------------------------
Changes (by olly):
* status: new => assigned
* component: Other => Build system
* milestone: => 1.0.16
Old description:
> xapian-core has the following build error on Mac OS 10.6 (Snow Leopard):
>
> 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 -Woverloaded-virtual -Wundef -Wshadow
> -Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -fvisibility=hidden
> -g
> -O2 -MT common/getopt.lo -MD -MP -MF common/.deps/getopt.Tpo -c
> common/getopt.cc -fno-common -DPIC -o common/.libs/getopt.o
> In file included from
> /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h:61,
> from
> /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h:41,
> from /usr/include/c++/4.2.1/cstring:50,
> from common/getopt.cc:164:
> common/getopt.cc:84: error: previous declaration of ‘char* optarg’ with
> ‘C++’ linkage
> /usr/include/unistd.h:515: error: conflicts with new declaration with ‘C’
> linkage
> common/getopt.cc:99: error: previous declaration of ‘int optind’ with
> ‘C++’
> linkage
> /usr/include/unistd.h:516: error: conflicts with new declaration with ‘C’
> linkage
> common/getopt.cc:119: error: previous declaration of ‘int opterr’ with
> ‘C++’
> linkage
> /usr/include/unistd.h:516: error: conflicts with new declaration with ‘C’
> linkage
> common/getopt.cc:125: error: previous declaration of ‘int optopt’ with
> ‘C++’
> linkage
> /usr/include/unistd.h:516: error: conflicts with new declaration with ‘C’
> linkage
> make[2]: *** [common/getopt.lo] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
New description:
xapian-core has the following build error on Mac OS 10.6 (Snow Leopard):
{{{
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 -Woverloaded-virtual -Wundef -Wshadow
-Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -fvisibility=hidden -g
-O2 -MT common/getopt.lo -MD -MP -MF common/.deps/getopt.Tpo -c
common/getopt.cc -fno-common -DPIC -o common/.libs/getopt.o
In file included from
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h:61,
from
/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h:41,
from /usr/include/c++/4.2.1/cstring:50,
from common/getopt.cc:164:
common/getopt.cc:84: error: previous declaration of ‘char* optarg’ with
‘C++’ linkage
/usr/include/unistd.h:515: error: conflicts with new declaration with ‘C’
linkage
common/getopt.cc:99: error: previous declaration of ‘int optind’ with
‘C++’
linkage
/usr/include/unistd.h:516: error: conflicts with new declaration with ‘C’
linkage
common/getopt.cc:119: error: previous declaration of ‘int opterr’ with
‘C++’
linkage
/usr/include/unistd.h:516: error: conflicts with new declaration with ‘C’
linkage
common/getopt.cc:125: error: previous declaration of ‘int optopt’ with
‘C++’
linkage
/usr/include/unistd.h:516: error: conflicts with new declaration with ‘C’
linkage
make[2]: *** [common/getopt.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
}}}
--
Comment:
It's better to put the extern "C" in the header as that will also work on
platforms which don't declare optarg, etc in their system headers.
Fixed in trunk r13431, though not tested as I don't have OS X.
If someone can confirm that fix works for 1.0.x, I'll backport it - the
[/changeset/13431/trunk/xapian-
core/common/gnu_getopt.h?format=diff&new=13431 patch to
common/gnu_getopt.h] applies cleanly to 1.0.x too.
--
Ticket URL: <http://trac.xapian.org/ticket/396#comment:2>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list