XCode5 simulator: unknown option character `X' in: -Xlinker

此生再无相见时 提交于 2019-11-28 09:21:34

In order to understand the error, you have to understand what the command is attempting to do.

In this case it's using Libtool, which is a slightly altered version of libtool. There are some options that are specified in the command line, but what we're looking for is the destination file, and this is passed in as the -o option, who's argument is /Users/jr/ios/app/iCozi/build/DevOnly-iphonesimulator/libCozi\ Common\ Code.a, and the type of library we're generating, and in this case it's -static. Both options together explicitly state that you're making a static library archive.

Because you're making a static library archive, the only thing you're actually doing is taking .o files and possibly .a files and turning them into another .a file. This can be roughly equated to the creating of a .zip file from a set of files (.o), and the contents of other .zip files (.a). There are very few things you can do while making this archive, for example you can't specify libraries that need to be implicitly linked while building a static archive, you can't specify that you're going to require entitlements.

libtool is complaining because it doesn't understand the options that are being used for a static library that are being passed in. In this case the options are:

-Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/jr/ios/app/iCozi/build/iCozi.build/DevOnly-iphonesimulator/Cozi\ Common\ Code.build/Cozi\ Common\ Code.xcent

These are options that are present when you're trying to link in an entitlements file, which means that some options is specifying the use of an entitlements file. In this case, you found the correct solution yourself, which was to remove the entitlements file specified in the project settings -> Code Signing -> Code Signing Entitlements -> DevOnly.

I met the same problem, and my approach to solve is to erase the unsupported option "-Xliner" in the command line of libtool (Actually i think this option should be supported by libtool, as is documented in the manual of libtool in gnu. Might be xcode disable it in libtool?)

To erase this option, i first try to find out which setting generate it. In my side, it's code signing. I built the project with code signing "iOS Distribution" while an identity correspond to this signing is also exist in keychain. This will result in the build tool read this identity and try to do something like generate extra link option for libtool.

To dismiss it, I change the signing to "iOS Developer". And i think a remove of correspond identity also works.

Hope my solution could be helpful to you.

First check the scheme that you build for Debug (Product -> Scheme -> Manage schemes then select target and press Edit) Go to the Build Settings (both in project and target), find Code signing and change to Automatic in Debug in Provisioning Profile and Don't code sign in Debug in Code Signing Identity. It helped me, hope it will help someone else too)

My first quick take on this error is that it's a false alarm. If I were you, I would do some troubleshooting accordingly and clean up Xcode, project and simulator settings etc.

Try deleting Xcode's preferences file (from common and user library both) and restart Xcode -

/Library/Preferences

com.apple.dt.Xcode

/Users/YourUsername/Library/Preferences ( I have following 3 files related to Xcode there )

com.apple.dt.Xcode.plist

com.apple.dt.Xcode.LSSharedFileList.plist

com.apple.dt.Xcode.plist.BoGEJ0T

Alternatively - try building the project on some other machine (or switch to some other user on same machine).

This is not the ultimate solution, But in my case, This accord because I was trying to use "ReactiveCocoa" with this pod:

pod 'ReactiveCocoa', '3.0.0-alpha.1'

And it automatically installed "LlamaKit", witch you don't necessarily need when using ReactiveCocoa...

So first I removed the podfile, run "pod install". Then deleted the "Podfile.lock" file (At the same folder as your project).

Then used this pod:

pod 'ReactiveCocoa'

and run "pod install" once again. clean project, run, and good luck.

I had a file with a "+" in the file name in my pods folder for some reason. Deleted it and it worked great

I also met the Apple Mach-O Librarian Error. But after checking my build settings, I found Code Signing entitlement of both myProject and Pods were empty.

As it might be a problem of static library, I just changed the Mach-O type setting of Pods-myExtension from static library to Dynamic library and found it worked!

Mach-O type can be found in Pods-myExtension -> Build settings -> Linking.

Hope it helps:)

FWIW, this exact error can also occur on Xcode 7.3.1 if the "Code Signing Entitlements" build setting has been mistakenly set for an static library build target, where it doesn't really apply.

To fix this issue , kindly change the schema to debug in simulator, this is because you have selected to release.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!