gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:14:39 25 4
gpt4 key购买 nike

我正在尝试在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com