Re: bug in gcc 4.0.1? ld: duplicate symbol typeinfo
Re: bug in gcc 4.0.1? ld: duplicate symbol typeinfo
- Subject: Re: bug in gcc 4.0.1? ld: duplicate symbol typeinfo
- From: Luis Soltero <email@hidden>
- Date: Thu, 31 Jan 2008 06:02:35 -0500
Update... since posting this I have tried the gcc 4.2 preview... same
problem. The linker still complains about having doubly defined symbols.
I will try xcode 2.5 next.
Any help on this subject is greatly appreciated.
--luis
Luis Soltero wrote:
Hello All,
I have a 50K+ application that compiles on OS X 10.4 using xcode 2.X,
Linux using gcc 4.1.2 and gcc 3.X, Windows using VC++ 6 but I cant get
it to link under xcode 3.0 using gcc 4.0.1.
When I try to link the application I get the following error
ld: duplicate symbol typeinfo for CXGateFramein MACGCCRelease/Mail.o
and MACGCCRelease/cxgateframe.o
What is really strange is that the class defined in Mail.cpp defines a
variable of type CXGateFrame * but does nothing unusual with it. It
just references the pointer to a class object of the type in question.
dumping the symbols with nm we see that CXGateFrame is being defined
in Mail.o although there is no declaration for it in the code.
luis-solteros-mac-mini:MACGCCDebug lsoltero$ nm Mail.o | grep CXGate
00035de0 S __ZTI11CXGateFrame
00035eec S __ZTS11CXGateFrame
00035a40 S __ZTV11CXGateFrame
CXGateFrame is really defined in cxgateframe.o
luis-solteros-mac-mini:MACGCCDebug lsoltero$ nm cxgateframe.o | grep
__ZT.11CXGateFrame
0003b6c0 S __ZTI11CXGateFrame
0003b6d4 S __ZTS11CXGateFrame
0003ad40 S __ZTV11CXGateFrame
So the linker is correct in complaining that the variable has been
defined in 2 places.
Looking at the assembly output for both cxgateframe.s and Mail.s we
see that indeed the class is being defined in Mail.cpp as if it were
the file containing the definition!
__ZTV11CXGateFrame:
.long 0
.long __ZTI11CXGateFrame
.long __ZNK11CXGateFrame12GetClassInfoEv
.long __ZN11CXGateFrameD1Ev
.long __ZN11CXGateFrameD0Ev
.long __ZNK8wxObject13CreateRefDataEv
.long __ZNK8wxObject12CloneRefDataEPK15wxObjectRefData
.long __ZN12wxEvtHandler12ProcessEventER7wxEvent
.long
__ZN12wxEvtHandler16SearchEventTableER12wxEventTableR7wxEvent
.long __ZN12wxWindowBase12TryValidatorER7wxEvent
.long __ZN12wxWindowBase9TryParentER7wxEvent
.long __ZNK11CXGateFrame13GetEventTableEv
.long __ZNK11CXGateFrame17GetEventHashTableEv
.long __ZN12wxEvtHandler17DoSetClientObjectEP12wxClientData
.long __ZNK12wxEvtHandler17DoGetClientObjectEv
.long __ZN12wxEvtHandler15DoSetClientDataEPv
.long __ZNK12wxEvtHandler15DoGetClientDataEv
Here is exactly the same code appearing in cxgateframe.cpp
__ZTV11CXGateFrame:
.long 0
.long __ZTI11CXGateFrame
.long __ZNK11CXGateFrame12GetClassInfoEv
.long __ZN11CXGateFrameD1Ev
.long __ZN11CXGateFrameD0Ev
.long __ZNK8wxObject13CreateRefDataEv
.long __ZNK8wxObject12CloneRefDataEPK15wxObjectRefData
.long __ZN12wxEvtHandler12ProcessEventER7wxEvent
.long
__ZN12wxEvtHandler16SearchEventTableER12wxEventTableR7wxEvent
.long __ZN12wxWindowBase12TryValidatorER7wxEvent
.long __ZN12wxWindowBase9TryParentER7wxEvent
.long __ZNK11CXGateFrame13GetEventTableEv
.long __ZNK11CXGateFrame17GetEventHashTableEv
.long __ZN12wxEvtHandler17DoSetClientObjectEP12wxClientData
.long __ZNK12wxEvtHandler17DoGetClientObjectEv
So it seems that GCC is looking at the include files getting confused
and defining a class for an class that uses the class in question but
doesn't define it! CC -E shows that nothing unusual is going on at
the preprocessor level.
Looking at the symbol dump for Mail.o on a Linux machine running GCC
4.1.2 we see
lsoltero@xmac:~/wxXGate/wxXGate/GTKGCCDebug$ nm Mail.o | grep CXGateFrame
U _ZN11CXGateFrameD0Ev
U _ZN11CXGateFrameD1Ev
0000000000005610 T _ZN5CMailC1EP11CXGateFrameb
0000000000005a6e T _ZN5CMailC2EP11CXGateFrameb
U _ZNK11CXGateFrame12GetClassInfoEv
U _ZNK11CXGateFrame13GetEventTableEv
U _ZNK11CXGateFrame17GetEventHashTableEv
0000000000000000 V _ZTI11CXGateFrame
0000000000000000 V _ZTS11CXGateFrame
0000000000000000 V _ZTV11CXGateFrame
Which is correct!!!! The symbol types are 'V' and *** NOT *** 'S's as
the are on the Mac... So it looks like
Has any one other than Jermome Seydous (see below) and I run into this
issue? Is there a newer version of GCC for mac OS X that fixes this
bug? Can anyone help? Does anyone have a work around?
Here is Jerome's posting to this same list.
----------------------------------------
* *Subject*: *ld: duplicate symbol typeinfo*
* From: Jérôme Seydoux <email@hidden <mailto:email@hidden>>
* Date: Mon, 19 Nov 2007 13:22:35 +0100
------------------------------------------------------------------------
Hello,
After migrating to Mac OS X 10.5 and XCode 3, I have the
following link error in my project:
ld: duplicate symbol typeinfo for TArray<long>in CMailBrowser.o and
CPMApp.o
CMailBrowser.o and CPMApp.o are two c++ classes, which have some
PowerPlant classes in common in their superclasses. Some of these
superclasses have a member variables of class TArray, which is a
PowerPlant template class.
I don't understand what this link error means, why it was not occurring
with previous versions of XCode, and what can I do to fix it?
Thanks for any help
Jérôme
-----------------------------------------------
Thanks in advance.
--luis
--
Luis Soltero, Ph.D., MCS
Director of Software Development, CTO
Global Marine Networks, LLC
StarPilot, LLC
Tel: 865-379-8723
Fax: 865-681-5017
E-Mail: email@hidden
Web: http://www.globalmarinenet.net
Web: http://www.starpilotllc.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden