Friday 25 September 2009

Code: iPhone linker error (__restore_vfp_d8_d15_regs)

In my iPhone development I encountered link errors along the lines of:
"___restore_vfp_d8_d15_regs", referenced from:
-[Blah blah:] in blah.o
"___save_vfp_d8_d15_regs", referenced from:
-[Blah blah:] in blah.o

Google had a little to say about it. Unfortunately, it all appeared wrong.

The issue was a subtle one. The application's "Library search paths" (LIBRARY_SEARCH_PATHS) variable has some historic cruft in it which caused the linker to pull in and old incompatible version of libstdc++, with a consequence of much hilarity and hair-pulling.

When I removed "$(SDKROOT)/usr/lib/gcc/arm-apple-darwin9/4.0.1" from the list (not sure where this had come from) the application magically linked one more, and kittens and puppies danced with my iPhone once more.

6 comments:

Jamie said...

Thanks for posting this - saved me a lot of frustration!

springrider said...
This comment has been removed by the author.
springrider said...

well, another reason will cause this problem, if your target device is iPad/iPhone compatiable, the "archeitecures" in project setting might be "Optimized armv6 armv7", took me hours to figure out, I changed it to "standard armv6", works for iPhone. reference: http://opensource.apple.com/source/gcc/gcc-5646/gcc/config/arm/arm.c

Anonymous said...

Serious props for this tip. Many more kittens and puppies are dancing!

Andy said...

Thank you! saved me hours of agony as well. I was adding a cpp library to an iOS project in which the original dev used the Three20 library-- which was explicitly linking to several old versions of libstdc++

Miri said...

Thank you! I would never guess this is the reason. You save a lot of my hours too.