google-maps-ios-utils
google-maps-ios-utils copied to clipboard
[SPM] GoogleMaps 6.x.x XCFramework Not Compiling on x86_64
Environment details
- Specify the API at the beginning of the title: GoogleMaps
- OS type and version: macOS 11.6.1
- Library version and other environment information: XCode 13.2
Steps to reproduce
Using the XCFrameworks from here
We created a Package.swift to wrap these frameworks up:
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "GoogleMaps",
platforms: [
.iOS(.v13),
.macOS(.v10_15),
],
products: [
.library(
name: "GoogleMapsBase",
targets: [
"GoogleMapsBase"
]
),
.library(
name: "GoogleMapsCore",
targets: [
"GoogleMapsCore"
]
),
.library(
name: "GoogleMaps",
targets: [
"GoogleMaps",
"GoogleMapsBase",
"GoogleMapsCore"
]
),
.library(
name: "GoogleMapsM4B",
targets: [
"GoogleMapsM4B"
]
),
],
targets: [
.binaryTarget(
name: "GoogleMaps",
path: "Frameworks/GoogleMaps.xcframework"
),
.binaryTarget(
name: "GoogleMapsBase",
path: "Frameworks/GoogleMapsBase.xcframework"
),
.binaryTarget(
name: "GoogleMapsCore",
path: "Frameworks/GoogleMapsCore.xcframework"
),
.binaryTarget(
name: "GoogleMapsM4B",
path: "Frameworks/GoogleMapsM4B.xcframework"
),
]
)
This works fine, we can include the SPM package in Xcode and it'll resolve and pull in the frameworks. However, when we go to build on an X86_64 simulator we get a ton of Undefined symbols for architecture x86_64 errors.
I was under the impression that these frameworks ship with both arm64 and x86 support, and looking at the contents of the .xcframework that seems to be the case. I would expect this to just work but there seems to be an issue here somewhere. This happens on an existing project as well as on a brand new project.
Stack trace
Build logs are attached below: GMSearchAppLogs.txt
Is this also an issue while trying to install the XCFramework using one of the supported methods (Carthage or installing manually?). Or does this issue only happen while using the XCFrameworks via SPM as shown in your Package.swift?
I haven't tried it any other way, other than by wrapping it via SPM. We only use SPM at work so was trying to get it functional for the GoogleMaps SDK now that .xcframework are available.
SPM is not supported yet so there could be integration issues while using it. I recommend using either Carthage or installing the XCFrameworks manually to get around this issue.
See: https://issuetracker.google.com/issues/141721633
SPM is not supported yet so there could be integration issues while using it. I recommend using either Carthage or installing the XCFrameworks manually to get around this issue.
See: https://issuetracker.google.com/issues/141721633
We'll wait for SPM support, manually installing at scale is really not feasible and adding a second dependency manager on top of SPM with Carthage isn't ideal either. Am a little confused what would be missing for SPM support because xcframeworks should work with SPM in most cases, do you happen to know what is missing?
Is this also an issue while trying to install the XCFramework using one of the supported methods (Carthage or installing manually?). Or does this issue only happen while using the XCFrameworks via SPM as shown in your Package.swift?
I have the same issue as @luispadron using Carthage (GoogleMaps 6.0.1-beta, xcframeworks GoogleMaps and GoogleMapsBase) when I try to build my project for x86_64 Simulator. So the problem probably lies not in the integration with SPM but in the xcframeworks themselves.
UPDATE: I didn't add GoogleMapsCore.xcframework and that resulted in Undefined symbols for architecture x86_64 errors.
@luispadron SPM has very limited support for static framework bundles, which GoogleMaps XCFrameworks are. I previously attempted to create a GitHuhb repository to host XCFrameworks to support SPM but ran into some issues due to this structure. I will revisit this once SPM has better support for static framework bundles, or alternatively, GoogleMaps XCFrameworks switches to dynamic frameworks.
@elena-gordienko can you file a separate issue detailing your bug? AFAIK, 6.0.1-beta works using Carthage and installing it manually on both arm64 and x86 simulators. Thanks.
@arriolac You are right, I've checked it once again and it turns out that the 6.0.1-beta works using Carthage and when installing it manually. The mistake was mine, I forgot to add GoogleMapsCore. Updated my previous comment. Thank you!
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!
Can you provide an update to the progress of this please?
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!