views:

530

answers:

3

The following code crashes in an Xcode created template project.

int main(int argc, char *argv[]) 
{
    uint64_t t64 = 100000;
    double s = (double)t64; // Crash!
    ...

The crash is accompanied with the following console output and occurs on a 2.2.1 device but not on 3.0.1 devices. It occurs both compiling for Thumb or ARM.

dyld: lazy symbol binding failed: Symbol not found: ___floatundidf Referenced from: /var/mobile/Applications/15E9DC65-324D-4C3A-8477-DC8CFFA67DC1/MyApp.app/MyApp Expected in: /usr/lib/libgcc_s.1.dylib

dyld: Symbol not found: ___floatundidf Referenced from: /var/mobile/Applications/15E9DC65-324D-4C3A-8477-DC8CFFA67DC1/MyApp.app/MyApp Expected in: /usr/lib/libgcc_s.1.dylib

The problem only occurs with a Base SDK of 3.0, compiling for 2.2.1 is fine. Unfortunately I have 3.0 enhancements.

A: 

When you say it works on one iPhone project and not another, are you compiling the same code with different settings? If so I'd check to see what settings differ between the two to shed light on what might be at the root of the problem.

___floatundidf should be part of libgcc so it might be missing in the ARM version of that libary for the 2.2.1 SDK but present in 3.0.1 (hence the crash in the former but not the latter). You can use the nm tool to check for its existence in both. If it is missing from 2.2.1 you should file a bug with Apple.

fbrereto
Thanks for the reply - much appreciated. Yes this definitely works on one project but not another so the implication is that the cause is project settings. I guess I'll have to go through the project files line by line.
Robin Charlton
I've edited the question as the problem is directly related to targeting different firmware versions and isn't project-specific after all.
Robin Charlton
A: 

It works if you do. Weird

   int main(int argc, char *argv[]) {
    uint64_t t64 = 100000;
    double s = (double)(uint64_t)t64; // Crash!
    ...
John Hartzog
A: 

I have come across this issue also, we are now building with GCC 4.0 (not GCC 4.2) to work around the problem.

I will be logging a bug with Apple to look into this further.

Mathew Block