Greetings,
I'm trying to build the Apache C++ Standard Library (http://
incubator.apache.org/stdcxx) on Mac OS X Tiger. I've resolved a
number of easier porting issues but this one has me stumped.
Here's the output from a typical build:
host:~/Work/stdcxx user$ make BUILDDIR=~/Build/stdcxx
BUILDMODE=shared,debug,pthreads
make[2]: Nothing to be done for `all'.
gcc assert.o atomic-cxx.o bitset.o catalog.o codecvt.o collate.o
ctype.o ctype_bits.o exception.o export.o facet.o file.o instance.o
ios.o ios_bits.o iostore.o iostream.o iso2022.o limits.o
limits_bits.o locale_bits.o locale_body.o locale_classic.o
locale_combine.o locale_core.o locale_eq.o locale_global.o
locale_name.o memattr.o memory.o messages.o num_get.o num_put.o
punct.o random.o setlocale.o string.o strstream.o strtol.o
ti_collate.o ti_filebuf.o ti_insert_dbl.o ti_insert_int.o
ti_insert_ptr.o ti_ios.o ti_istream.o ti_messages.o ti_money_get.o
ti_money_put.o ti_moneypunct.o ti_num_get.o ti_num_put.o
ti_numpunct.o ti_ostream.o ti_streambuf.o ti_string.o ti_stringbuf.o
ti_time_get.o ti_time_put.o ti_wcollate.o ti_wfilebuf.o
ti_winsert_dbl.o ti_winsert_int.o ti_winsert_ptr.o ti_wios.o
ti_wistream.o ti_wmessages.o ti_wmoney_get.o ti_wmoney_put.o
ti_wmoneypunct.o ti_wnum_get.o ti_wnum_put.o ti_wnumpunct.o
ti_wostream.o ti_wstreambuf.o ti_wstring.o ti_wstringbuf.o
ti_wtime_get.o ti_wtime_put.o time_get.o time_put.o tmpbuf.o
typeinfo.o valarray.o vecbool.o version.o wcodecvt.o wctype.o -lsupc+
+ -lgcc_eh -o /Users/user/Build/stdcxx/lib/libstd.so.4.2.0
/usr/bin/ld: multiple definitions of symbol vtable for
std::bad_exception
exception.o definition of vtable for std::bad_exceptionin section
(__DATA,__const)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libsupc++.a
(eh_exception.o) private external definition of vtable for
std::bad_exceptionin section (__DATA,__const)
/usr/bin/ld: multiple definitions of symbol vtable for std::bad_alloc
memory.o definition of vtable for std::bad_allocin section
(__DATA,__const)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libsupc++.a
(new_handler.o) private external definition of vtable for
std::bad_allocin section (__DATA,__const)
collect2: ld returned 1 exit status
make[2]: *** [/Users/user/Build/stdcxx/lib/libstd.so] Error 1
make[1]: *** [lib] Error 2
make: *** [libstd] Error 2
Because exception.o and memory.o contain definitions of missing
virtual functions in the std::bad_alloc and std::bad_exception
classes, a vtable is created in the object files. The problem is,
these vtables are also contained in the libsupc++ library. The GNU
linker knows how to handle this (http://developer.apple.com/
documentation/DeveloperTools/gcc-4.0.1/gcc/Vague-Linkage.html#Vague-
Linkage) but the Mac OS X linker does not, at least with the options
given.
Are there link options specific to Mac OS X to resolve this problem?
Thanks,
Eric.