Re: Linker complains about undefined symbols only in release builds
Re: Linker complains about undefined symbols only in release builds
- Subject: Re: Linker complains about undefined symbols only in release builds
- From: Mark Suska <email@hidden>
- Date: Mon, 17 Apr 2006 10:15:33 -0400
I was stumped by the same problem. It took me quite some time to
figure it out.
I was linking a PowerPC-only library. The Debug configuration builds
for the current processor, which happens to be a PowerPC for me. The
Release configuration builds for both PowerPC and Intel processors.
The Debug configuration built fine but the Release configuration
failed during linking.
The solution for me was to build a PowerPC only Release configuration
by setting build configuration "Architectures" to "ppc".
What made this problem difficult to figure out was that there was no
indication that I was compiling for an Intel processor and there was
no warning to tell me that I was trying to link a PowerPC library.
I recall being stumped by this same problem with some inline ppc
assembly code. It compiled fine in Debug but not in Release. I had no
idea that I was compiling for Intel.
I will make a request to the XCode developers for these features:
- Indicate which processor is being compiled for in the Build Results
window.
- Warn when linking a library compiled for wrong processor.
On 17-Apr-06, at 8:50 AM, Greg Hurrell wrote:
I'm using a custom framework in my application but the linker is
dying with "undefined symbol" errors when I try to link the
application. Specifically it is complaining that the symbol
corresponding to one of my classes in the framework is not there.
* This occurs only in "Release" builds, not "Debug" builds
(presumably because in the "Debug" builds ZeroLink is shielding me
from the error by skipping the linking).
* The build log shows that the class in question is definitely
being compiled in both build styles.
* Running "nm" on the built framework shows that the symbol is
indeed missing from the "Release" build but is present in the
"Debug" build.
* The missing symbol is really missing, not just being stripped; I
know this because if I inspect an unstripped copy of the framework
I see that it's really not there, but only in the "Release" build.
* There are various classes in the framework and all of them work
fine except for that one mysteriously missing class.
* The framework itself compiles and links without any warnings or
errors.
* I have been building this framework and application fine for
months without this error.
* Quitting/restarting Xcode has no effect.
* Blowing away my build and build intermediates folders has no effect.
* Blowing away the shared precompiled headers cache has no effect.
* Removing the offending class and header file from the framework
target and then re-adding them has no effect.
Any suggestions for something further I could try to work around
this issue? This has me pulling my hair out...
_______________________________________________
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