Including CoreML in a Swift project for a watch app fails to compile.
Unsure if this is a Swift compilation issue or related to the frameworks or Xcode.
Any assistance would be great.
Steps to Repro:
Create a new Watch App project using Xcode 12 beta 1 (12A6159)
In the ExtensionDelegate add import CoreML
Add let _ = MLPredictionOptions() in applicationDidFinishLaunching()
Getting this error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MLPredictionOptions", referenced from:
objc-class-ref in ExtensionDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
When trying to add CoreML directly to the project Frameworks I get this error:
ld: framework not found CoreML
clang: error: linker command failed with exit code 1 (use -v to see invocation)
There must be something wrong with the build settings (or the wrong SDK is getting used)... It's looking for x86_64 while building for a watch which seems very off; I think all the watches use arm architectures.
Also, this should be in the 'Using Swift' category, not Development/Compiler. Development is for people contributing to the toolchain and core libraries, and Development/Compiler is for contributing to the compiler.
@Jon_Shier what's the best way to link CoreML manually?
I've added it to my "Link Binary with Libraries" build step and I still get ld: framework not found CoreML when linking x86_64. I can see -framework CoreML in the link command.
@Jon_Shier is correct. This turned out to be a bug in the framework SDK - it should be addressed in a coming beta release of Xcode. Unfortunately, there is no workaround.