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

Binary dependencies are unavailable in XCFramework format #2672

Closed
2 of 3 tasks
1ec5 opened this issue Oct 1, 2020 · 8 comments
Closed
2 of 3 tasks

Binary dependencies are unavailable in XCFramework format #2672

1ec5 opened this issue Oct 1, 2020 · 8 comments
Assignees
Labels
build Issues related to builds and dependency management. UI Work related to visual components, Android Auto, Camera, 3D, voice, etc.

Comments

@1ec5
Copy link
Contributor

1ec5 commented Oct 1, 2020

Update: This issue has been fixed as of v2.0.0-alpha.1, but there are no plans to fix it in v1.x. A workaround is in place that allows v1.x to build for devices and simulators on Intel-based Macs and to build for devices but not simulators on Apple Silicon–based Macs.

The linker error in #2665 (specific to CocoaPods and Xcode 12) forced us to implement a workaround in #2667 that sets the EXCLUDED_ARCHS build setting not only in the MapboxCoreNavigation and MapboxNavigation framework targets but also in the developer’s application target. That gets us past the immediate issue and allows us to release v1.0.0, but it sets us up for incompatibility down the line. If another pod employs the same workaround, an application would be unable to install both pods at the same time.

The better fix is to rebuild all three binary dependencies with Xcode 12 and distribute them as XCFrameworks. Once that build is available, we can remove the workaround from the podspecs:

Migrating these dependencies to XCFrameworks will also allow developers to use Carthage directly without a workaround script once Carthage/Carthage#3019 is released.

/cc @mapbox/navigation-ios

@1ec5 1ec5 added build Issues related to builds and dependency management. CocoaPods labels Oct 1, 2020
@1ec5 1ec5 added this to the v1.0.1 milestone Oct 1, 2020
@1ec5 1ec5 added the blocked Blocked by dependency or unclarity. label Oct 1, 2020
@1ec5
Copy link
Contributor Author

1ec5 commented Oct 22, 2020

This is what it looks like when multiple pods set EXCLUDED_ARCHS to different values:

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

It’s only a warning, but that might be because both pods happen to specify interchangeable values.

@1ec5
Copy link
Contributor Author

1ec5 commented Nov 13, 2020

It’s only a warning, but that might be because both pods happen to specify interchangeable values.

It’s a warning when integrating the pod into a real project, at least in Debug if not also Release. But when linting the podspec or pushing it to CocoaPods trunk, it results in an error: #2739.

@1ec5 1ec5 modified the milestones: v1.1.1, v1.2.0 Nov 25, 2020
@1ec5 1ec5 self-assigned this Dec 1, 2020
@1ec5
Copy link
Contributor Author

1ec5 commented Dec 17, 2020

Now that MapboxAccounts v2.3.1 and MapboxNavigationNative v28.1.0 are available, it should be possible to remove the arm64 workaround from MapboxCoreNavigation.podspec and apply the user_target_xcconfig override to just MapboxNavigation.podspec:

# https://github.com/mapbox/mapbox-navigation-ios/issues/2665
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'
}
s.pod_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'
}
# https://github.com/mapbox/mapbox-navigation-ios/issues/2665
s.pod_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'
}

@1ec5 1ec5 removed the blocked Blocked by dependency or unclarity. label Dec 17, 2020
@1ec5 1ec5 added the UI Work related to visual components, Android Auto, Camera, 3D, voice, etc. label Dec 20, 2020
@1ec5 1ec5 changed the title CocoaPods podspec changes EXCLUDED_ARCHS build setting in application target Binary dependencies are unavailable in XCFramework format Dec 20, 2020
@1ec5
Copy link
Contributor Author

1ec5 commented Dec 20, 2020

All of MapboxCoreNavigation’s binary dependencies are now available as XCFrameworks, so MapboxCoreNavigation can now be built for simulators on M1-based Macs. For CocoaPods users, #2770 (available in v1.2.0-beta.1) streamlined the MapboxCoreNavigation podspec to no longer override the EXCLUDED_ARCHS build setting, which will improve compatibility with non-Mapbox frameworks. For Carthage users, Carthage/Carthage#3019 has landed but hasn’t been released yet, so you’ll need to build Carthage from source and build and embed MapboxAccounts.xcframework, MapboxCommon.xcframework, and MapboxNavigationNative.xcframework into your application target.

MapboxNavigation additionally depends on the map SDK, which still isn’t available as an XCFramework: mapbox/mapbox-gl-native-ios#171. For CocoaPods users, the podspec still overrides the EXCLUDED_ARCHS build setting, which may cause CocoaPods errors like #2739 when using the navigation SDK alongside some non-Mapbox pods. For Carthage users, the workaround script (mirrored here) is still required for now.

@1ec5
Copy link
Contributor Author

1ec5 commented Feb 3, 2021

As of #2771, Carthage users who only need MapboxCoreNavigation can now use SPM instead of Carthage to install that library with support for Apple Silicon. Here are some instructions, but you’ll need to use .branch("main") for now until v1.3.0 comes out.

@1ec5
Copy link
Contributor Author

1ec5 commented Feb 20, 2021

As of #2808 and v2.0.0-alpha.1, both MapboxCoreNavigation and MapboxNavigation support SPM. SPM actually defaults to static linking, which is even better in some ways than XCFramework. #2810 tracks removing the Carthage workaround in favor of relying on Carthage’s built-in XCFramework support.

Part of the arm64 workaround is still in one of the CocoaPods podspecs. Leaving this issue open to track removing that workaround, which is blocked by mapbox/mapbox-gl-native-ios#171 in the v1.x branch and mapbox/mapbox-maps-ios#48 in the v2.x branch.

@truburt
Copy link

truburt commented Feb 26, 2021

@1ec5 , is it for 1.3.0 or 2.0 now?

@1ec5
Copy link
Contributor Author

1ec5 commented Mar 5, 2021

Fixed in #2808 for v2.0.0-alpha.1.

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. UI Work related to visual components, Android Auto, Camera, 3D, voice, etc.
Projects
None yet
Development

No branches or pull requests

3 participants