Swift 在 Ubuntu : Handling whitespace in object file names 上构建

标签 swift linux ubuntu clang

我正在尝试在 Ubuntu 18.04 上构建一个 swift 应用程序。这是一个vapor具有以下 Package.swift 的应用:

// swift-tools-version:4.0
import PackageDescription

let package = Package(
    name: "Project",
    dependencies: [
        .package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
        .package(url: "https://github.com/vapor/fluent-sqlite.git", from: "3.0.0"),
        .package(url: "https://github.com/vapor-community/vapor-ext.git", from: "0.3.0"),
        .package(url: "https://github.com/attaswift/BigInt.git", from: "3.1.0")
    ],
    targets: [
        .target(name: "App", dependencies: ["FluentSQLite", "Vapor", "ServiceExt", "BigInt"]),
        .target(name: "Run", dependencies: ["App"]),
        .testTarget(name: "AppTests", dependencies: ["App"])
    ]
)

现在我正在调用 swift build:获取包工作,编译工作,但链接导致以下许多错误消息:

clang: error: no such file or directory: '/home/ubuntu/project/.build/x86_64-unknown-linux/debug/BigInt.build/Words'
clang: error: no such file or directory: 'and'
clang: error: no such file or directory: 'Bits.swift.o'

我正在使用 this BigInt package不幸的是,它的文件名中有一些空格,例如Words and Bits.swift。这导致文件 .build/x86_64-unknown-linux/debug/BigInt.build/Words and Bits.swift.o 但 Linux 上的 swift 编译器似乎不允许在这些文件名中使用空格。

现在,我可以 fork 存储库并更改所有文件名。但也许有另一个更简单的解决方案来解决这个问题?

额外的困惑:我尝试在 docker 容器 ( dockerfile ) 中做同样的事情并且它有效......似乎他们使用的是 clang-3.8 而不是默认的 clang-6,也许这可能是问题所在?!

最佳答案

我没有找到直接的解决方案,而是找到了使其正常工作的方法。也许它会帮助有同样问题的人:

确保使用 Swift 版本 4.2.2(而不是例如 4.2.0)。他们显然以某种方式解决了这些版本之间的这个问题。 🤷‍♂️

关于Swift 在 Ubuntu : Handling whitespace in object file names 上构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54723017/

相关文章:

c++ - 从 C++ 代码触发 vlc 播放器

ios - 在 UIButton 和 UIToolbar 中使用系统图标?

ios - 弹出现有 View Controller 并加载父 View Controller

linux - "make check"安装HDF5失败

linux - MATLAB Linux 内存不足错误

r - 打印前 8 列和最后 3 个非零列之一 linux/awk/sed/R

php - Magento:创建发票时出现 500 内部服务器错误

ios - 使用 Healthkit 获取和设置医疗 ID 中的信息?

ios - Kinvey:由于错误而未保存对象:无法映射 'X' ,一个不存在的属性

linux - "cannot execute binary file"尝试在 linux 上运行 shell 脚本时