G'day folks!
Trying to create a distributable library using SPM.
I have 3 targets: library_ios(pure swift code), library_ios_objc(obj-c and c code) and library-Tests defined in Package.swift
:
// swift-tools-version: 5.8
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "library_ios",
defaultLocalization: "en",
platforms: [
.iOS(.v14),
],
products: [
.library(name: "library_ios", targets: ["library_ios"]),
],
dependencies: [
.package(url: "https://github.com/lukepistrol/SwiftLintPlugin", from: "0.2.2")
],
targets: [
.target(
name: "library_ios",
dependencies: ["library_ios_objc"],
resources: [.process("Resources")],
plugins: [
.plugin(name: "SwiftLint", package: "SwiftLintPlugin"),
]),
.target(
name: "library_ios_objc",
dependencies: ["openssl"],
publicHeadersPath: "Include"),
.testTarget(
name: "library-Tests",
dependencies: ["library_ios"]
),
.binaryTarget(name: "openssl", path: "./Frameworks/openssl.xcframework"),
]
)
The targets library_ios
and library_ios_objc
are building successfully.
But the testing target build fails, and gives me this error message:
ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
ld: Undefined symbols:
_initKeypairWithData, referenced from: {{ ....here the compiler references place where i call a pure C funtion... }}
(Obviosuly CoreAudioTypes has nothing to do here, since i don't use this framework in my lib)
Xcframework contains ios-arm64
, ios-arm64-simulator
and macos-arm64
static frameworks (without modulemaps) generate by xcodebuild -create-xcframework
.
Any idea why this happens?