Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude arm64 simulator from CocoaPods-managed targets in Xcode 12 #2667

Merged
merged 3 commits into from
Oct 1, 2020

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Sep 30, 2020

Temporarily modified the podspecs to exclude the arm64 simulator from the CocoaPods-generated target and application target, based on the workaround in CocoaPods/CocoaPods#10065 (comment) CocoaPods/CocoaPods#10104 (comment) but conditionalized for Xcode 12, just like the Carthage workaround in #2649. Unlike that workaround, this one isn’t sensitive to patch releases of Xcode, so we don’t need the extra case for Xcode 12.0.1 seen in #2663.

Unfortunately, this workaround automatically modifies the EXCLUDED_ARCHS[sdk=iphonesimulator*] and EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 build settings of the application target, which could eventually be incompatible with another pod if that other pod employs the same workaround. #2672 tracks removing this workaround.

This workaround apparently requires Xcode 11.7 and above to build from source, so I’ve also made that a minimum requirement for both CocoaPods and Carthage users for consistency.

Before merging:

  • Lint podspecs with Xcode 11
  • Lint podspecs with Xcode 12
  • Push test podspecs to CocoaPods trunk with Xcode 12
  • Build and run internal dogfooding application in Xcode 11
    • Debug
      • Simulators
      • Devices
    • Release
      • Simulators
      • Devices
  • Build and run internal dogfooding application in Xcode 12
    • Debug
      • Simulators
      • Devices
    • Release
      • Simulators
      • Devices

Fixes #2665.

/ref #2652
/cc @mapbox/navigation-ios

@1ec5 1ec5 added build Issues related to builds and dependency management. release blocker Needs to be resolved before the release. CocoaPods labels Sep 30, 2020
@1ec5 1ec5 added this to the v1.0.0 milestone Sep 30, 2020
@1ec5 1ec5 self-assigned this Sep 30, 2020
@frederoni
Copy link
Contributor

A more reliable and faster way to install Carthage seems to be directly from the binaries hosted on GitHub

curl -OL "https://github.com/Carthage/Carthage/releases/download/0.35.0/Carthage.pkg"
sudo installer -pkg Carthage.pkg -target /

it's ~1 minute faster and I have not yet seen flaky results.

@1ec5
Copy link
Contributor Author

1ec5 commented Sep 30, 2020

The Xcode 11 CocoaPods integration tests are really unhappy with these changes. There are scores of these errors:

❌  /Users/distiller/Library/Developer/Xcode/DerivedData/PodInstall-bttgmofbdzplxmcyqmnjtjyiqtay/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/MapboxCoreNavigation.build/module.modulemap:9:12: header 'MapboxCoreNavigation-Swift.h' not found

    header "MapboxCoreNavigation-Swift.h"
           ^

along with several warnings along these lines:

Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'Pods-PodInstall' from project 'Pods')

None of the architectures in ARCHS (i386, x86_64) are valid. Consider setting ARCHS to $(ARCHS_STANDARD) or updating it to include at least one value from VALID_ARCHS (i386, x86_64) which is not in EXCLUDED_ARCHS (x86_64). (in target 'Pods-PodInstall' from project 'Pods')

Next step is to determine whether the errors are specific to this integration test or whether they would also appear in application projects built in Xcode 11.

@1ec5 1ec5 changed the title Exclude arm64 simulator from CocoaPods-managed targets Exclude arm64 simulator from CocoaPods-managed targets; require Xcode 11.7 Sep 30, 2020
@1ec5 1ec5 force-pushed the 1ec5-accounts-pods-arm64-xcode12-2665 branch 2 times, most recently from 87a3673 to 939bf68 Compare September 30, 2020 20:45
@1ec5
Copy link
Contributor Author

1ec5 commented Sep 30, 2020

@frederoni found a workaround that should hopefully work in Xcode 11.x, so we won’t need to drop Xcode 11.4–11.6 support just yet. I’m inclined to keep all the changes around test fixtures out of scope for this release-blocking issue, but we will need to hook up the UI tests to Xcode 12 and iOS 14 soon.

@1ec5 1ec5 changed the title Exclude arm64 simulator from CocoaPods-managed targets; require Xcode 11.7 Exclude arm64 simulator from CocoaPods-managed targets in Xcode 12 Sep 30, 2020
@1ec5
Copy link
Contributor Author

1ec5 commented Sep 30, 2020

Xcode 12 with CocoaPods, clean build for iPhone 8 simulator in Release configuration:

/path/to/Pods/MapboxNavigation/MapboxNavigation/BottomBannerViewController.swift:2:8: error: could not find module 'MapboxCoreNavigation' for target 'arm64-apple-ios-simulator'; found: i386, x86_64-apple-ios-simulator, x86_64, i386-apple-ios-simulator
import MapboxCoreNavigation
       ^
/path/to/Build/Products/Release-iphonesimulator/MapboxNavigation/MapboxNavigation.framework/Modules/module.modulemap:9:12: error: header 'MapboxNavigation-Swift.h' not found
    header "MapboxNavigation-Swift.h"
           ^
<unknown>:0: error: could not build Objective-C module 'MapboxNavigation'
/path/to/Build/Products/Release-iphonesimulator/MapboxNavigation/MapboxNavigation.framework/Modules/module.modulemap:9:12: error: header 'MapboxNavigation-Swift.h' not found
    header "MapboxNavigation-Swift.h"
           ^
<unknown>:0: error: could not build Objective-C module 'MapboxNavigation'

@avi-c
Copy link
Contributor

avi-c commented Sep 30, 2020

I'm seeing a linker error building Apex develop branch on Nav SDK master branch, which for me resolves to commit hash 2322f7012a830794a534dbd177f2ab230136ec80.

I believe this is the same issue that is reported in #2665

@1ec5 1ec5 force-pushed the 1ec5-accounts-pods-arm64-xcode12-2665 branch from de70e46 to bd75555 Compare October 1, 2020 02:54
@1ec5
Copy link
Contributor Author

1ec5 commented Oct 1, 2020

bd7555501f5eddc749e3ac7c5bbdd471b5e29449 seems to have done the trick in both Xcode 11 and Xcode 12 for all supported build configurations.

@1ec5
Copy link
Contributor Author

1ec5 commented Oct 1, 2020

For the earlier tests, the test project was including both podspecs explicitly rather than going through CocoaPods trunk – the roundabout workflow we use for prereleases. The CocoaPods installation tests on CI use the same workflow.

The good news is that I was able to push the test MapboxCoreNavigation podspec to CocoaPods trunk: CocoaPods/Specs@9f68b48.

$ pod trunk push test-1ec5-MapboxCoreNavigation.podspec --allow-warnings
Updating spec repo `trunk`
Validating podspec
 -> test-1ec5-MapboxCoreNavigation (1.0.0+2)
    - WARN  | source: The version should be included in the Git tag.
    - 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: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Polyline' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'MapboxMobileEvents' from project 'Pods')
    - 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')

Updating spec repo `trunk`

--------------------------------------------------------------------------------
 🎉  Congrats

 🚀  test-1ec5-MapboxCoreNavigation (1.0.0+2) successfully published
 📅  September 30th, 21:18
 🌎  https://cocoapods.org/pods/test-1ec5-MapboxCoreNavigation
 👍  Tell your friends!
--------------------------------------------------------------------------------

Unfortunately, the test MapboxNavigation podspec failed validation:

$ pod trunk push test-1ec5-MapboxNavigation.podspec --allow-warnings
Updating spec repo `trunk`
Validating podspec
 -> test-1ec5-MapboxNavigation (1.0.0+2)
    - WARN  | source: The version should be included in the Git tag.
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
    - 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  | xcodebuild:  note: detected encoding of input file as Unicode (UTF-8) (in target 'test-1ec5-MapboxNavigation' from project 'Pods')
    - ERROR | [iOS] xcodebuild:  /var/folders/cl/8cgpg37n5cl78pjkbpgml94w0000gn/T/CocoaPods-Lint-20200930-18715-51k3ed-test-1ec5-MapboxNavigation/App/main.swift:1:8: error: could not find module 'MapboxNavigation' for target 'arm64-apple-ios-simulator'; found: i386, x86_64-apple-ios-simulator, x86_64, i386-apple-ios-simulator
    - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Solar' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Polyline' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'MapboxMobileEvents' from project 'Pods')
    - 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')

[!] The spec did not pass validation, due to 2 errors.

[!] Can't merge user_target_xcconfig for pod targets: ["test-1ec5-MapboxCoreNavigation", "test-1ec5-MapboxNavigation"]. Singular build setting EXCLUDED_ARCHS[sdk=iphonesimulator*] has different values.

[!] Can't merge user_target_xcconfig for pod targets: ["test-1ec5-MapboxCoreNavigation", "test-1ec5-MapboxNavigation"]. Singular build setting EXCLUDED_ARCHS[sdk=iphonesimulator*] has different values.

But the build setting values don’t differ between the two podspecs, at least not literally. Perhaps the resolved value differs somehow. I wonder if we can leave out the user_target_xcconfig bit. That’s part is rather invasive to the application target, and it risks conflicts with other pods anyways. Earlier, I was unable to get the test project to build without it, but at the time I had only applied the workaround to MapboxCoreNavigation, not MapboxNavigation.

Comment on lines 55 to 58
s.user_target_xcconfig = {
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => '$(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))',
'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200' => 'arm64 arm64e armv7 armv7s armv6 armv8'
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remove this bit, then I’m able to push to CocoaPods trunk: CocoaPods/Specs@f966ab4.

$ pod trunk push test-1ec5-MapboxNavigation.podspec --allow-warnings
Updating spec repo `trunk`
Validating podspec
 -> test-1ec5-MapboxNavigation (1.0.0+2)
    - WARN  | source: The version should be included in the Git tag.
    - 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: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Polyline' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'MapboxMobileEvents' from project 'Pods')
    - 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')
    - NOTE  | xcodebuild:  note: detected encoding of input file as Unicode (UTF-8) (in target 'test-1ec5-MapboxNavigation' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Solar' from project 'Pods')

Updating spec repo `trunk`

--------------------------------------------------------------------------------
 🎉  Congrats

 🚀  test-1ec5-MapboxNavigation (1.0.0+2) successfully published
 📅  September 30th, 21:54
 🌎  https://cocoapods.org/pods/test-1ec5-MapboxNavigation
 👍  Tell your friends!
--------------------------------------------------------------------------------

@1ec5
Copy link
Contributor Author

1ec5 commented Oct 1, 2020

This workaround automatically modifies the EXCLUDED_ARCHS[sdk=iphonesimulator*] and EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 build settings of the application target, which could eventually be incompatible with another pod if that other pod employs the same workaround. #2672 tracks removing this workaround.

We’ve also found that the workaround does not work in CocoaPods 1.10.0.beta.2 due to CocoaPods/CocoaPods#10026. Upgrading to CocoaPods 1.10.rc.1 fixes that issue.

@1ec5 1ec5 force-pushed the 1ec5-accounts-pods-arm64-xcode12-2665 branch from 702ee99 to c8fbff2 Compare October 1, 2020 19:15
@1ec5 1ec5 force-pushed the 1ec5-accounts-pods-arm64-xcode12-2665 branch from c8fbff2 to b3dc679 Compare October 1, 2020 19:20
@1ec5 1ec5 merged commit 9300b59 into master Oct 1, 2020
@1ec5 1ec5 deleted the 1ec5-accounts-pods-arm64-xcode12-2665 branch October 1, 2020 21:28
@1ec5
Copy link
Contributor Author

1ec5 commented Oct 1, 2020

Cherry-picked to the release-v1.0 branch as adb2cbc, ca2c7e2, and 5055b73.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues related to builds and dependency management. release blocker Needs to be resolved before the release.
Projects
None yet
4 participants