Safely resolve dylib warning?

2019-09-03 20:53发布

问题:

Xcode is giving me this warning:

ld: warning: duplicate dylib /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/system/libSystem.host.dylib

There's an SO answer here: Duplicate dylib warning in xcode

which says to find and delete the duplicate. Using locate I see 2 files:

locate libSystem.host.dylib

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/usr/lib/system/libSystem.host.dylib

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/system/libSystem.host.dylib

So, the question is - how do I safely resolve the duplicate dylib warning:

  • should I delete the 3.2 dylib and, if so, will it cause a problem when I compile for iPad?
  • or should I delete the entire iPhoneSimulator3.2.sdk and, if so, does that mean I lose my iPad simulator?
  • or should I do something else?

回答1:

I have both files too and no such warning.

And from the answer you've linked I would say this means you should check your project and delete the duplicate reference to the file there.

When you delete the physical file most likely your "duplicate dylib" warning will turn into a "file not found" error.

As a general rule: when you have to change something in /Developer or lets say outside of your user directory there is a high chance that you are doing something wrong.

EDIT:

Summary: No, it's not safe to delete arbitrary files from the SDK.



回答2:

This warning appeared when i built one Project using PhoneGap.Finally, I found my project was built with iOS4.2,and the PhoneGapLib.xcodeproj was built with iOS5(Latest iOS).I change one to make them same, then everything is OK.