Problems with linking to own static libs

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
IronAvatar
Posts: 23
Joined: Sat Nov 25, 2006 5:53 am

Problems with linking to own static libs

Post by IronAvatar »

I've had some errors thrown up by some of my own static libs during linking. At first, I thought it was something screwy with my use of rtti and templates, but it appears that my own static libs have problems linking to the sdk static libs.

Does anybody have any idea as to why this would be?
IronAvatar
Posts: 23
Joined: Sat Nov 25, 2006 5:53 am

Post by IronAvatar »

I've resolved most of the link issues by munging all of the cpp files used to generate the libs into the exe. I guess the majority of those were due to link order (the one thig I hate about gcc based tool-chains).

But the problem remains that I'm getting a link error with the vtables of a few classes, which use some templates to wrap around a custom rtti system.

So yet again, any ideas anybody?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Our crystal ball is cloudy, and so we have no clue what your errors say.
So don't expect much of a useful answer.
But clearly if you're having link-order problems, you should read the many many threads that have been posted on the same topic, and use -Wl,--start-group for starters.
IronAvatar
Posts: 23
Joined: Sat Nov 25, 2006 5:53 am

Post by IronAvatar »

Hah. I almost had a snipy reply, but youre perfectly correct.

The link errors that I'm getting are

Code: Select all

../../../Magma/obj/psp/release/Core/MgObject.o&#58;&#40;.rodata._ZTIN6MgCore6IClassINS_7CObjectENS_11CNullObjectEEE&#91;typeinfo for MgCore&#58;&#58;IClass<MgCore&#58;&#58;CObject, MgCore&#58;&#58;CNullObject>&#93;+0x0&#41;&#58; undefined reference to `vtable for __cxxabiv1&#58;&#58;__si_class_type_info'
../../../Magma/obj/psp/release/Core/MgObject.o&#58;&#40;.rodata._ZTIN6MgCore11CNullObjectE&#91;typeinfo for MgCore&#58;&#58;CNullObject&#93;+0x0&#41;&#58; undefined reference to `vtable for __cxxabiv1&#58;&#58;__class_type_info'
../../../Magma/obj/psp/release/Render/MgCamera.o&#58;&#40;.rodata._ZTIN8MgRender7CCameraE&#91;typeinfo for MgRender&#58;&#58;CCamera&#93;+0x0&#41;&#58; undefined reference to `vtable for __cxxabiv1&#58;&#58;__si_class_type_info'

../../../Magma/obj/psp/release/Render/MgCamera.o&#58;&#40;.rodata._ZTIN6MgCore6IClassIN8MgRender7CCameraENS_7CObjectEEE&#91;typeinfo for MgCore&#58;&#58;IClass<MgRender&#58;&#58;CCamera, MgCore&#58;&#58;CObject>&#93;+0x0&#41;&#58; undefined reference to `vtable for __cxxabiv1&#58;&#58;__si_class_type_info'

../../../Magma/obj/psp/release/Render/psp/MgRenderManagerPsp.o&#58;&#40;.rodata._ZTIN8MgRender17CRenderManagerPspE&#91;typeinfo for MgRender&#58;&#58;CRenderManagerPsp&#93;+0x0&#41;&#58; undefined reference to `vtable for __cxxabiv1&#58;&#58;__class_type_info'
I've done as you've ordered, I mean, suggested and done a quick look on the link order issue which I guess makes perfect sense now that I think about it. I may just try and tell the linker to link in everything and rely on psp-strip to remove anything that isn't used.

All I have to do after that is figure out get rid of the rtti related link errors. I have a feeling that it might be because I'm not linking in the C++ std lib though.
Post Reply