Cannot access USB serial port via binary target within a package

My Swift app accesses the USB serial port via a C++ API built as a universal dylib. When the dylib is added as a framework via "Frameworks, Libraries, and Embedded Content", it works fine. When instead the dylib is included as a binary target within an xcframework inside a Package, I get an error indicating a permissions issue.

The package looks like this:

// swift-tools-version:5.3
import PackageDescription

let package = Package(
    name: "BrainFlow",
    platforms: [
        .macOS(.v10_14)
    ],
    products: [
        .library(
            name: "BrainFlow",
            targets: ["BrainFlow", "BoardController", "BrainBitLib", "DataHandler",
                      "GanglionLib", "MLModule", "MuseLib"])
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
    ],
    targets: [
        .target(
            name: "BrainFlow"
        ),
        .binaryTarget(
            name: "BoardController",
            path: "BoardController.xcframework"
        ),
        .binaryTarget(
            name: "BrainBitLib",
            path: "BrainBitLib.xcframework"
        ),
        .binaryTarget(
            name: "DataHandler",
            path: "DataHandler.xcframework"
        ),
        .binaryTarget(
            name: "GanglionLib",
            path: "GanglionLib.xcframework"
        ),
        .binaryTarget(
            name: "MLModule",
            path: "MLModule.xcframework"
        ),
        .binaryTarget(
            name: "MuseLib",
            path: "MuseLib.xcframework"
        ),
        .testTarget(
            name: "BrainFlowTests",
            dependencies: ["BrainFlow"]
        )
    ]
)


Replies

It was an entitlements issue, not a Package issue. To fix it I had to disable App Sandbox via the Entitlements File.

I had tried to enable the USB entitlement via the App Sandbox settings, but that did not help. What other entitlements do I need in order to open the serial port in read/write mode?

I am up against the same issue. I need to read and write serial data plus control RTS and DTR lines to write to the flash memory of a processor on a proprietary device. The "open(fd,flags)" function fails when sandbox is enabled. It works properly when sandbox is disabled. Without sandbox, it appears that I cannot validate the app. I am in the middle of a Catch-22