When I build the project there are no build errors, but when I run unit tests it says the following message.
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_Class1", referenced from:
in MyUtilityLibrary.o
"_OBJC_CLASS_$_Class2", referenced from:
in MyUtilityLibrary.o
ld: symbol(s) not found for architecture arm64
I have a SPM named MyUtilityLibrary
, that has dependency on another SPM, which generates XCFramework and puts it in derived data.
I have tried making the MyUtilityLibrary
type as dynamic
, which did not work.
If I manually provide XCFramework in MyUtilityLibrary
then it throws duplicate xcframwork error. So I think it should pick from derived data, however during unit tests it's not able to link them.
let package = Package(
name: "MyUtilityLibrary",
platforms: [.iOS(.v18)],
products: [
.library(
name: "MyUtilityLibrary",
//type: .dynamic,
targets: ["MyUtilityLibrary"]),
],
dependencies: [
.package(url: "https://github.com/microsoft/onnxruntime-swift-package-manager.git", exact: "1.20.0"),
],
targets: [
.target(
name: "MyUtilityLibrary",
dependencies: [.product(name: "onnxruntime", package: "onnxruntime-swift-package-manager"),
.product(name: "onnxruntime_extensions", package: "onnxruntime-swift-package-manager")]
),
.testTarget(
name: "MyUtilityLibraryTests",
dependencies: ["MyUtilityLibrary"]
)
]
)