RexOnRoids
RexOnRoids

Reputation: 14040

Xcode linker error on iPhone app (Only on simulator)

Im getting this linker error that won't let me compile. It only happens on the simulator.

KEY POINTS:
- Happens only in simulator
- Similar to THIS question, but found no FRAMEWORK_SEARCH_PATHS in my .pbxproj file
- Though my OS is 10.6.2, I had to build target 1.5 to avoid other linker errors
- libxml2.dylib IS required and is in my Frameworks group
- The other cited libraries I have never heard of.
- Tried bringing in those other Libs under frameworks, didn't solve.


Build SpaceTweet of project SpaceTweet with configuration Debug

Ld build/Debug-iphonesimulator/SpaceTweet.app/SpaceTweet normal i386
cd "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)"
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk "-L/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator" -L/Users/Scott/Desktop "-L/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/../../libYAJLIPhone-0" -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk/usr/lib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib "-F/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator" -filelist "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/SpaceTweet.build/Debug-iphonesimulator/SpaceTweet.build/Objects-normal/i386/SpaceTweet.LinkFileList" -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -framework AVFoundation -framework MessageUI -lYAJLIPhone -lxml2 -o "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator/SpaceTweet.app/SpaceTweet"

ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libxml2.dylib, missing required architecture i386 in file
ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libSystem.dylib, missing required architecture i386 in file
ld: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libobjc.A.dylib, missing required architecture i386 in file
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1



CLUE:
Again, MY question is very similar to THIS SOLVED QUESTION except that in my case I did NOT find a FRAMEWORK_SEARCH_PATHS entry in the .pbxproj file in my project bundle and thus could not solve in the manner in which that question was solved.

Upvotes: 2

Views: 26598

Answers (4)

Mashood .H
Mashood .H

Reputation: 1772

Follow the steps:

Solution 1

Right click on Xcode in applications folder

Get Info

Check Open using Rosetta

Open Xcode

Open project

Clean build folder

Run project

By opening Xcode using Rosseta, no other build settings or configurations are needed.

Solution 2

Go to “Product” in the menu bar

Destination

Destination Architectures

Show both

Pick a simulator from the device dropdown menu that has Rosseta next to it.

Run project

Upvotes: 0

JasmineOT
JasmineOT

Reputation: 2068

I have the same issue. And it turns out to run my release version code on debug environment. Click "Edit schema..." and change Build Configuration to Release solved my problem.

Upvotes: 4

SpaceTrucker
SpaceTrucker

Reputation: 1168

I had the same thing happen to me. I deleted and re added all my frameworks and still had the same issue. To get rid of the error finally I had to delete the path pointing to the offending library from Library Search Paths under build settings.

Upvotes: 0

cdespinosa
cdespinosa

Reputation: 20799

The problem is this:

-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib 

That's telling your Simulator (i386) build to use files from the Device (arm) /usr/lib.

Find in your target where /usr/lib is (just use the Search bubble in the target's Get Info / Build Settings tab) and delete it. The compiler will use the correct platform's usr/lib if it's not told to use the wrong one first.

Upvotes: 12

Related Questions