Swift for Tensorflow toolchain and protobuf not compatiable?

I have been happily using the swift for tensorflow toolchain to build simple ml models but now I need to use protobuf in my project.

After importing protobuf library my project no longer builds, instead I get a bunch of nasty errors. Anyone run into this?

As workaround for now, I have split my project into two, one using the swift for tensorflow toolchain the other using the standard swift toolchain.

I’m assuming this is on Linux, because I see errors there and not in Xcode.

I believe this has to do with some of the Swift 5 support in the latest Swift Protobuf framework release, with the Swift for TensorFlow toolchain being slightly out of sync with that. To work around this, try using an older release of Swift Protobuf in your Swift Package Manager package definition:

// swift-tools-version:4.0

import PackageDescription

let package = Package(
    name: "alexnettest",
    products: [
        .executable(name: "AlexNet", targets: ["AlexNet-Swift"]),
    ],
    dependencies: [
        .package(url: "https://github.com/apple/swift-protobuf.git", .exact("1.4.0")),
    ],
    targets: [
        .target(
            name: "AlexNet-Swift",
            dependencies: ["SwiftProtobuf"],
			path: "AlexNet"),
    ]
)

I tried with the above and the current 0.3 Swift for TensorFlow toolchain and the project was able to build and use the Swift Protobuf framework within it. Looks like sometime after the 1.4.0 release is where it started diverging from what’s present in the Swift for TensorFlow branch.

I am on a Mac using swift on the command line rather xcode.

I did install protobuf 1.3.0, 1.4.0 and 1.5.0 and got the same errors for each.
But did not know about the exact syntax, will try that and report back.

thanks @bradlarson your suggestion did the trick.
I think 1.5.0 was the culprit here, downgraded 1.4.0 (exactly) and all is well.