Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
602 views
in Technique[技术] by (71.8m points)

linker - How can I build in XCode 4, for an iOS 3.1 deployment target, using libSystem.B?

I've recently upgraded from XCode 3 to 4, and now I'm having build problems with my iPhone project. I need to support older versions of iOS back to 3.1. With XCode 3.2.5, I had no problem building with SDK 4.2, using an iOS deployment target of 3.1. I also included a weak link to the libSystem.B library, which is required for running the app on older iOS versions. Now when I build with XCode 4, I get the linker error below. The compilation step completes, but the link step fails. If I remove the weak link to the libSystem.B library, then the build completes, but the app crashes at startup when running on iOS 3.1.

Has anyone found a solution to this problem? How do you build with XCode 4, to run on an old version of iOS?

ld: library not found for -lSystem.B collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In your project build settings under "Other Linker Flags" add the following:

-weak_library /usr/lib/libSystem.B.dylib

It should automatically be added to your Target build settings but if it isn't you should add it there as well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...