Xcode Linking - Command Ld failed with a nonzero exit code

6.2k Views Asked by At

I try to create an Objective-C Framework with Relocatable Object File for Mach-O Type in Xcode Build Settings.

When I build the framework, the command Ld failed with a nonzero exit code error appears. The error description is clang: error: invalid argument '-compatibility_version 1' only allowed with '-dynamiclib'. It will be fine if I change the Mach-O Type with Dynamic Library.

Do you guys know how to fix this error with Relocatable Object File without change to Dynamic Library?

2

There are 2 best solutions below

1
Kiel On BEST ANSWER

I found the answer when I change the Compatibility Version and Current Library Version to an empty text

0
Reyansh Jatoliya On

Remove STSecurity framework and keychain access if you are getting Ld failed with nonzero.

Screenshot

1