Closed jeantuffier closed 4 hours ago
Hi!
For the record, watchosX64
is for the simulator on Intel Macs.
There is no particular reason why we don't include this target. Would you be interested in opening a pull request? Targets are handled in this file.
Hi, that's strange then. I run my project on a MacBook Pro M1. Do you have any ideas why I would get this error? It might be I have other dependencies that supports it and somehow requires it from Apollo too
In your initial message you said you explicitly added the watchosX64
target to your project? If you actually don't need it you may omit it and this should solve the issue.
I wasn't very clear and probably confused myself here, sorry. Let me try to explain better :
If I don't add the watchosX64
target to my project and only use those
listOf(
iosArm64(),
iosSimulatorArm64(),
watchosArm64(),
watchosSimulatorArm64(),
tvosArm64(),
tvosSimulatorArm64(),
)
I get the following error in xcode with any simulator :
Ignoring file '/path/to/my/mltiplatform/project/build/xcode-frameworks/Debug/watchsimulator10.5/MyProject.framework/MyProject': fat file missing arch 'x86_64', file has 'arm64' Linker command failed with exit code 1
Now if I add watchosX64
to my project to fix that issue, I obviously get
No matching variant of com.apollographql.apollo:apollo-runtime:4.0.0 was found. The consumer was configured to find a library for use during 'kotlin-metadata', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'watchos_x64'
I can make a PR of course but It might be there's something wrong with my project somewhere making xcode fail to compile it.
Thanks for following up!
Hmm yes indeed this is surprising, I don't see why XCode is complaining about x86_64
when you only have Arm64 targets in your project. And you're right that adding the target to Apollo Kotlin may not fix the issue. Are you able to make a simplified version of your project with the Apollo Kotlin dependency removed to compile and run?
Turned out xcode has a $(ARCHS_STANDARD)
property set in Build Settings > Architectures > Architectures. It has different values depending on the target. For the watch target, it has arm64, X86_64 and some others. By replacing the property with a simple "arm64" it all work smoothly.
Thanks for the help and sorry I used your time for something completely unrelated to Apollo!
TIL and no worries at all. Glad it works now.
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Kotlin usage and allow us to serve you better.
Use case
I'm trying to share my logic with a Apple project targeting WatchOS. When adding
watchosX64()
to my project, the build fails because apollo only supportsI can make xcode build the Watch Os target only if I choose the stand alone emulator and not the one saying "via Iphone". If I choose it, I get the following error:
Are there any limitations to not supporting it? If I try to build the ios app target on the iPhone simulator, I get the same error.
Describe the solution you'd like
Simply add
watchosX64()
to the supported targets