[solved] Bad codegen

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

[solved] Bad codegen

Post by Brocan »

Hi all,

I'm new in iOS development, and i'm doing a small application with ogre...

All was going well until i've called to the material manager and texture manager to obtain texture and material ptrs... since then i've some linking errors:
ld: bad codegen, pointer diff in boost::thread_exception::thread_exception()to global weak symbol vtable for boost::thread_exceptionfor architecture armv6
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 failed with exit code 1

ld: bad codegen, pointer diff in boost::thread_exception::thread_exception()to global weak symbol vtable for boost::thread_exceptionfor architecture armv7
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 failed with exit code 1
If I comment all these code and only create a TexturePtr var in my class, y get the same error!
class OgreSystem {
....
Ogre::TexturePtr m_Texture;
...
}
ld: bad codegen, pointer diff in Ogre::SharedPtr<Ogre::Texture>::SharedPtr()to global weak symbol vtable for Ogre::SharedPtr<Ogre::Texture>for architecture armv6

ld: bad codegen, pointer diff in Ogre::SharedPtr<Ogre::Texture>::SharedPtr()to global weak symbol vtable for Ogre::SharedPtr<Ogre::Texture>for architecture armv7
Any ideas? i'm using iOS ogre sdk 1.7.3 and i'm linking against the dependencies provided by this sdk. The include searchs paths are also aimed to the dependencies directories... My ogre class where this material calls and ptrs are is a c++ class.

I'm compiling with iOS 4.3 and deployement target 4.1, xcode 3.2.6.

If i comment the code that access to the material and texture ptrs the project compiles without problems.

Thanks in advance!
Last edited by Brocan on Tue Aug 02, 2011 11:46 am, edited 2 times in total.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Bad codegen

Post by masterfalcon »

It's a really cryptic error that's for sure. Try changing the symbol visibility settings in your project.
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Re: Bad codegen

Post by Brocan »

masterfalcon wrote:It's a really cryptic error that's for sure. Try changing the symbol visibility settings in your project.
I've solved it by getting and storing the normal ptrs instead the shared ptrs, i got it using get() method, but i don't know what are the memory implications of this... BTW is a very strange error, i'll try latter changing the symbol visibility settings...
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Re: Bad codegen

Post by Brocan »

I get the same problem with I compile in release mode.

Code: Select all

ld: bad codegen, pointer diff in OgreSystem::createCameraBackground(int, int)to global weak symbol vtable for Ogre::SharedPtr<Ogre::Resource>for architecture armv6

Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 failed with exit code 1
How i can change this symbol visibilities? (this IDE is going to make me crazy :| )

Edit: I've read that setting "Symbols Hidden by Default" to Yes solves the problem, but after set it, i've the same problem. The crazy thing is that this error only appears in release :evil: . I've also set the inline methods hidden to yes, without any success.

I'm working in a device mode if it helps
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Re: [solved] Bad codegen

Post by Brocan »

I'm astonished. I've set the option "Compile for Thumbs" to NO, and all codegens problems in release and debug configurations have disappear... even i can store TexturePtr in the class again!!! :roll:

But i haven't any idea of what is the objective of this option :lol:
User avatar
zafery
Kobold
Posts: 35
Joined: Thu Oct 25, 2007 10:37 am
x 1

Re: [solved] Bad codegen

Post by zafery »

hi

before i had some strange problem's too, i choose LLVM compiler 2.0 for C/C++ compiler version solves all my strange problem. (by the way i am using xcode4)

have a nice day...
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Re: [solved] Bad codegen

Post by Brocan »

The problems appear again, but finally i've solved it!! Recompiling ogre with symbols hidden by default on all targets solves it!

Papercut related to this here: http://www.ogre3d.org/forums/viewtopic.php?f=22&t=66677
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: [solved] Bad codegen

Post by masterfalcon »

I just posted in that thread with a possible fix for visibility. Let me know if that fixes the issue for you