Skip to content

Linux Build Broken on Swift 5.3+: kCFStringEncodingUTF8 not in scope #183

Closed
@xanderdunn

Description

@xanderdunn

Added to Package.swift:

.package(name: "OpenCombine",
    url: "https://github.com/OpenCombine/OpenCombine.git",
    from: "0.10.0")

// Added to target dependencies:
.product(name: "OpenCombine", package: "OpenCombine"),
.product(name: "OpenCombineDispatch", package: "OpenCombine"),
.product(name: "OpenCombineFoundation", package: "OpenCombine"),

On macOS 10.15.6 using Swift for Tensorflow v0.11 I am able to build successfully:

$ which swift
/Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.11.xctoolchain/usr/bin/swift
$ swift --version
Swift version 5.3-dev (LLVM db8896f3f345af2, Swift 61684f62a6132c0)
Target: x86_64-apple-darwin19.6.0

However, on Ubuntu 18.04 using Swift for Tensorflow v0.10 I am unable to build successfully:

$ which swift
/home/xander/swift-tensorflow-RELEASE-0.10-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift
$ swift --version
Swift version 5.3-dev (LLVM 55d27a5828, Swift 6a5d84ec08)
Target: x86_64-unknown-linux-gnu
$ swift build
.build/checkouts/OpenCombine/Sources/OpenCombineFoundation/Timer+Publisher.swift:343:34: error: cannot find 'kCFStringEncodingUTF8' in scope
                CFStringEncoding(kCFStringEncodingUTF8)
                                 ^~~~~~~~~~~~~~~~~~~~~

Swift for Tensorflow is based on the official dev branch.

I also tried building on the latest official 5.3 release branch on Ubuntu 18.04, still same error:

$ which swift
/home/xander/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-08-31-a-ubuntu18.04/usr/bin/swift
$ swift --version
Swift version 5.3-dev (LLVM 3fa9679add, Swift d24649a4d6)
Target: x86_64-unknown-linux-gnu
$ swift build
.build/checkouts/OpenCombine/Sources/OpenCombineFoundation/Timer+Publisher.swift:343:34: error: cannot find 'kCFStringEncodingUTF8' in scope
                CFStringEncoding(kCFStringEncodingUTF8)
                                 ^~~~~~~~~~~~~~~~~~~~~

However, I can successfully build on Ubuntu 18.04 with Swift 5.2.5 official release toolchain:

$ which swift
/home/xander/swift-5.2.5-RELEASE-ubuntu18.04/usr/bin/swift
$ swift --version
Swift version 5.2.5 (swift-5.2.5-RELEASE)
Target: x86_64-unknown-linux-gnu

It appears specifically on Linux, the build is broken on Swift 5.3 release branch, as well as dev trunk.

Strangely, I do see kCFStringEncodingUTF8 referenced in the swift-corelibs-foundation. Is there an additional #include that's required now?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions