# .testTarget wont build with xcframework as .binaryTarget

**URL:** <https://forums.swift.org/t/testtarget-wont-build-with-xcframework-as-binarytarget/68889>\
**Category:** Using Swift\
**Tags:** objective-c, packagemanager, testing, xcframework\
**Created:** [December 8, 2023, 11:39am UTC](https://forums.swift.org/t/testtarget-wont-build-with-xcframework-as-binarytarget/68889 "2023-12-08T11:39:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dvkellerman](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dvkellerman/32/31035_2.png) [@dvkellerman](https://forums.swift.org/u/dvkellerman)\
**Post date:** [December 8, 2023, 11:39am UTC](https://forums.swift.org/t/testtarget-wont-build-with-xcframework-as-binarytarget/68889/1 "2023-12-08T11:39:52Z")

</div>

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
// 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:

```swift
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?

---

<div class="post-metadata">

**Author:** ![dvkellerman](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dvkellerman/32/31035_2.png) [@dvkellerman](https://forums.swift.org/u/dvkellerman)\
**Post date:** [December 12, 2023, 10:18am UTC](https://forums.swift.org/t/testtarget-wont-build-with-xcframework-as-binarytarget/68889/2 "2023-12-12T10:18:57Z")

</div>

Okay, i found my issue. Maybe it will help someone else...

Basically i had two functions which similar names:  
`initWithKeypairData` and `initWithKeypairData:publicKeyOctets:`

One was a pure C function, and the other was inside Obj-C class.

For some reason Xcode was not able to build testing Target, but other targets were building.  
Changing the name of the pure C function did the trick.
