Cannot build archive when using xcodebuild -archive

I am using this command below for generating frameworks.

Code Block
xcodebuild archive -scheme EmojisSdk -destination="generic/platform=iOS" -destination="generic/platform=iOS Simulator" SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES


But on running it gives the following errors as

ld: library not found for -lPods-EmojisSdk

clang: error: linker command failed with exit code 1 (use -v to see invocation)


Code Block
ARCHIVE FAILED
The following build commands failed:
Ld /Users/apple/Library/Developer/Xcode/DerivedData/EmojisSdk-fikbvvvqdtuqxlbkevszkztpcfdh/Build/Intermediates.noindex/ArchiveIntermediates/EmojisSdk/IntermediateBuildFilesPath/EmojisSdk.build/Release-maccatalyst/EmojisSdk.build/Objects-normal/x86_64/Binary/EmojisSdk normal x86_64
Ld /Users/apple/Library/Developer/Xcode/DerivedData/EmojisSdk-fikbvvvqdtuqxlbkevszkztpcfdh/Build/Intermediates.noindex/ArchiveIntermediates/EmojisSdk/IntermediateBuildFilesPath/EmojisSdk.build/Release-maccatalyst/EmojisSdk.build/Objects-normal/arm64/Binary/EmojisSdk normal arm64
(2 failures)


My Xcode version is 11.6
Command line tools Xcode 12.0


Also when using the following command

Code Block
xcodebuild archive -scheme EmojisSdk -destination="iOS" -destination="macOS" SKIP_INSTALL=NO


the frameworks get created and then after that when XCFramework is generated and zipped then after that the pod lint will give error as

Code Block
ld: building for iOS Simulator, but linking in dylib built for iOS, file '/var/folders/75/ml860n6960j8j6b6zg_tqhj80000gn/T/CocoaPods-Lint-20200824-7262-1j2oy6b-EmojisSdk/Pods/EmojisSdk/EmojisSdk.xcframework/ios-arm64/EmojisSdk.framework/EmojisSdk'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the App editor. (in target 'App' from project 'App')
    warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
    BUILD FAILED
    
    
    The following build commands failed:
    Ld /Users/dushyantpawar/Library/Developer/Xcode/DerivedData/App-foslikxmswhxbycjremlfsjfztqu/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/arm64/Binary/App normal arm64
    (1 failure)
   Testing with `xcodebuild`. 
 -> EmojisSdk (0.0.3)
    - WARN  | http: The URL (`http://192.168.0.105:8080/newiosworkingdirectory21Aug2020/EmojisSdk/EmojisSdk.zip`) doesn't use the encrypted HTTPS protocol. It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. This will be an error in future releases. Please update the URL to use https.
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | xcodebuild:  note: Building targets in parallel
    - NOTE  | xcodebuild:  note: Using codesigning identity override: -
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: [CP] Unable to find matching .xcframework slice in ' true ios-arm64/EmojisSdk.framework ios-arm64_x86_64-simulator/EmojisSdk.framework' for the current build architectures (arm64 i386 x86_64).
    - NOTE  | [iOS] xcodebuild:  ld: warning: ignoring file EmojisSdk/EmojisSdk.xcframework/ios-arm64/EmojisSdk.framework/EmojisSdk, building for iOS Simulator-x86_64 but attempting to link with file built for iOS-arm64
    - NOTE  | [iOS] xcodebuild:  ld: warning: ignoring file EmojisSdk/EmojisSdk.xcframework/ios-arm64/EmojisSdk.framework/EmojisSdk, building for iOS Simulator-i386 but attempting to link with file built for iOS-arm64
    - NOTE  | [iOS] xcodebuild:  clang: error: linker command failed with exit code 1 (use -v to see invocation)
    - NOTE  | [iOS] xcodebuild:  warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the App editor. (in target 'App' from project 'App')
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
Analyzed 1 podspec.
[!] The spec did not pass validation, due to 1 error and 1 warning.



Please help as I am new to this Xcode and swift frameworks.

I am having the same issue while running pod lint against a framework compiled with Xcode 12 beta 4 and 6, error is:

    The following build commands failed:

    Ld /Users/<username>/Library/Developer/Xcode/DerivedData/App-fvgguosjareejfejmqgeiwccnzmo/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/arm64/Binary/App normal arm64

    (1 failure)

   Testing with xcodebuild

This was not happening with Xcode 11.x versions.
Did you find any workaround for this?


I got similar issue when I use new xcode12 command line tool xcodebuild to archive project for xcframework. It cannot recognise related x86_64 binary in my fat static library.
Same here!!!

Did you find any workaround for this?
I have the same error after updating to xcode Version 12.0 (12A7209)
Guess everyone building a fat lib will have this problem. The arm64 architecture for the simulator (Apple Silicon) conflicts with the arm64 built for a device and LIPO doesn't want to merge. In my build, I just force the architecture to x86_64 and i386 when building for the sim. Now, just need to figure out cocoapods with this changes...

Edit: https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios
Same problem with xCode 12.
A brand new day, a brand new problem.

I have the same issue, any update? Thanks!

Cannot build archive when using xcodebuild -archive
 
 
Q