tospik1
tospik1

Reputation: 51

Xcode 12.4 Builds for Simulator and Device but Archiving Fails with Pods-MYAPP-frameworks.sh: line 131: ARCHS[@]: unbound variable

I am using Xcode 12.4 (updated from 12.2 hoping that my problem would be fixed). As you know with xcode 12.x we deleted VALIDARCHS, added arm64 to excluded archs in project and pod files (for simulators only). Otherwise there were build problems. I have finished my development and I am ready for apple's test flight and then eventually app store. As you know we need to archive the app and upload from organizer. However, my application's archiving fails. My problem is that I can successfully build my application for all of simulators and real devices however, when I try to archive the app it gives me an error:

Error Image Here

The bash script is PODS' script line 131 is part: intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"

# Strip invalid architectures
strip_invalid_archs() {
  binary="$1"
  warn_missing_arch=${2:-true}
  # Get architectures for current target binary
  binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
  # Intersect them with the architectures we are building for
  intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
  # If there are no archs supported by this binary then warn the user
  if [[ -z "$intersected_archs" ]]; then
    if [[ "$warn_missing_arch" == "true" ]]; then
      echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
    fi
    STRIP_BINARY_RETVAL=1
    return
  fi
  stripped=""
  for arch in $binary_archs; do
    if ! [[ "${ARCHS}" == *"$arch"* ]]; then
      # Strip non-valid architectures in-place
      lipo -remove "$arch" -output "$binary" "$binary"
      stripped="$stripped $arch"
    fi
  done
  if [[ "$stripped" ]]; then
    echo "Stripped $binary of architectures:$stripped"
  fi
  STRIP_BINARY_RETVAL=0
}

What I have done so far?

I feel like something is wrong with architectures and since archiving needs all of the available archs, it somehow cant archive it. I also think that it is a pod issue but I am really lost.

Here are my project and pod configs for architectures:

Project

Pod

# Uncomment the next line to define a global platform for your project
platform :ios, '14.3'
minimum_deployment_target = 14.3

target 'MYAPP' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for MYAPP
pod 'Firebase/Core'
pod 'Firebase/Auth'
  pod 'Firebase/Database'
        pod 'Firebase/Firestore'
  pod 'Firebase/Storage'
pod 'Firebase/Messaging'
target 'MYAPPTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'MYAPPUITests' do
    inherit! :search_paths
    # Pods for testing
  end

post_install do |installer|
    installer.generated_projects.each do |project|
        project.targets.each do |target|
            target.build_configurations.each do |config|
                # Ensure we set all Pods to match the minimum deployment target specified by the app
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_deployment_target
            end
        end
    end
installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
        configuration.build_settings['ARCHS'] = 'arm64 armv7'
    end
end



end


EDIT The postinstall part in the podfile was added after the archiving failed. Archiving does not work even if I dont have postinstall part in my podfile.

Thanks in advance. It is really disappointing to not be able to archive the app when I think I finished it. I have already spent a few days just on this. It would be great if you can help. Thank you

Upvotes: 5

Views: 5965

Answers (1)

John smith
John smith

Reputation: 65

I had the same issue and this Github issue solved my issue. TLDR: Go under build settings and remove arm64 from the valid and excluded architectures.

Upvotes: 2

Related Questions