Failed to build App on Xcode 12

I can't build my app on Xcode12 anymore.
Looks like the new introduced arm64 causes the problem.

First, My app has 2 parts:
  1. My framework A.

  2. My app B. The above framework A will be integrated into app B.

So my build process contains 2 steps:
  1. Compile the framework B (for Any iOS Devices (arm64, arm7)) . I have to exclude the arm64 arch from my Build Settings. Otherwise Xcode gives me error like:

Code Block
export TOOLCHAINS\=com.apple.dt.toolchain.XcodeDefault\ com.apple.dt.toolchain.XcodeDefault
    export TOOLCHAIN_DIR\=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
    export TREAT_MISSING_BASELINES_AS_TEST_FAILURES\=NO
    export UID\=501
    export UNSTRIPPED_PRODUCT\=NO
    export USER\=tenderretail
    export USER_APPS_DIR\=/Users/tenderretail/Applications
    export USER_LIBRARY_DIR\=/Users/tenderretail/Library
    export USE_DYNAMIC_NO_PIC\=YES
    export USE_HEADERMAP\=YES
    export USE_HEADER_SYMLINKS\=NO
    export USE_LLVM_TARGET_TRIPLES\=YES
    export USE_LLVM_TARGET_TRIPLES_FOR_CLANG\=YES
    export USE_LLVM_TARGET_TRIPLES_FOR_LD\=YES
    export USE_LLVM_TARGET_TRIPLES_FOR_TAPI\=YES
    export VALIDATE_DEVELOPMENT_ASSET_PATHS\=YES_ERROR
    export VALIDATE_PRODUCT\=NO
    export VALIDATE_WORKSPACE\=YES_ERROR
    export VALID_ARCHS\=arm64\ armv7\ armv7s\ i386\ x86_64
    export VERBOSE_PBXCP\=NO
    export VERSION_INFO_BUILDER\=tenderretail
    export VERSION_INFO_FILE\=Framework_vers.c
    export VERSION_INFO_STRING\=\"@\(\#\)PROGRAM:Framework\ \ PROJECT:TenderRetailConnector-\"
    export WRAP_ASSET_PACKS_IN_SEPARATE_DIRECTORIES\=NO
    export XCODE_APP_SUPPORT_DIR\=/Applications/Xcode.app/Contents/Developer/Library/Xcode
    export XCODE_PRODUCT_BUILD_VERSION\=12B45b
    export XCODE_VERSION_ACTUAL\=1220
    export XCODE_VERSION_MAJOR\=1200
    export XCODE_VERSION_MINOR\=1220
    export XPCSERVICES_FOLDER_PATH\=/XPCServices
    export YACC\=yacc
    export arch\=undefined_arch
    export variant\=normal
    /bin/sh -c /Users/tenderretail/Library/Developer/Xcode/DerivedData/TenderRetailConnector-cdiyhmyjkzsinpavptxmkdlzwmbv/Build/Intermediates.noindex/DependantBuilds/TenderRetailConnector.build/Debug-iphonesimulator/Framework.build/Script-52DF69561A82C025000FFE9B.sh
BUILD SUCCEEDED
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: /Users/tenderretail/Library/Developer/Xcode/DerivedData/TenderRetailConnector-cdiyhmyjkzsinpavptxmkdlzwmbv/Build/Products/Debug-iphoneos/libTenderRetailConnector.a and /Users/tenderretail/Library/Developer/Xcode/DerivedData/TenderRetailConnector-cdiyhmyjkzsinpavptxmkdlzwmbv/Build/Products/Debug-iphonesimulator/libTenderRetailConnector.a have the same architectures (arm64) and can't be in the same fat output file
Command PhaseScriptExecution failed with a nonzero exit code


However, after I compiled my app A (integrated with compiled framework B, for Any iOS Device), I failed to create the IPA when I got to Product -> Archive -> Distribute App -> Ad Hoc. Xcode returns errors:
The archive contains nothing that can be signed

I Googled it, some devs said the error is caused by lacking of arm64 support in your project. But I can't compile my framework A if I enable the arm64 in its project build settings. So looks like the arm64 causes the controdict in my build process.

Is there anyone got the similar errors?
Do you have any clue for me to fix it?
I think I miss something in my project setup.

The exact development environment is:
MacOS: Catalina 10.15.7
Xcode: 12.2 (12B45b)

Replies

In your app A, have you tried add arm64 as excluded architectures for just simulator?
So you could try:
Target->app A->build setting->Excluded Architecture->Expand it then add click plus sign of debug and release for scheme -> make 'Any iOS simulator SDK' as key and value with 'arm64'.

I have the same issue, App is build using flutter but error is in Xcode. I have tried above solution but still the same issue.