我正在尝试在我的Ubuntu WSl上构建sourcekit-lsp。已成功安装swift-5.2.5-RELEASE-ubuntu20.04
amal@DESKTOP-CJJEUS7:~/sourcekit-lsp$swift --version
Swift version 5.2.5 (swift-5.2.5-RELEASE)
Target: x86_64-unknown-linux-gnu并且还从主分支克隆sourcekit-lst,安装了两个sudo apt install libsqlite3-dev libncurses5-dev,按照documentation的每一步操作,但在构建时我得到了这个错误。
swift build -Xcxx -I/home/amal/swift-5.2.5-RELEASE-ubuntu20.04/usr/lib/swift -Xcxx -I/home/amal/swift-5.2.5-RELEASE-ubuntu20.04/usr/lib/swift/Block
/home/amal/sourcekit-lsp/.build/checkouts/swift-package-manager/Sources/PackageLoading/ManifestLoader.swift:530:55: error: type 'JSONEncoder.OutputFormatting' has no member 'withoutEscapingSlashes' encoder.outputFormatting = [.sortedKeys, .withoutEscapingSlashes]
/home/amal/sourcekit-lsp/.build/checkouts/swift-package-manager/Sources/PackageLoading/ManifestLoader.swift:530:55: error: type 'JSONEncoder.OutputFormatting' has no member 'withoutEscapingSlashes' encoder.outputFormatting = [.sortedKeys, .withoutEscapingSlashes]
/home/amal/sourcekit-lsp/.build/checkouts/swift-package-manager/Sources/PackageLoading/ManifestLoader.swift:530:55: error: type 'JSONEncoder.OutputFormatting' has no member 'withoutEscapingSlashes' encoder.outputFormatting = [.sortedKeys, .withoutEscapingSlashes]
[137/214] Compiling Statistic.cpp你知道我做错了什么吗?请帮帮忙。
发布于 2020-11-01 20:34:45
当它像这样静默地失败时,通常是因为您缺少一些依赖项。确保您安装了所有
sudo apt-get install curl clang libicu-dev git libatomic1 libxml2 \
libcurl4 zlib1g-dev libbsd0 tzdata libssl-dev libsqlite3-dev \
libblocksruntime-dev libncurses5-dev libicu-dev libblocksruntime-dev \
libpthread-workqueue-dev -y然后,我仍然在sourcekit-lsp的main分支上失败,并出现错误
/home/rock64/Software/sourcekit-lsp/.build/checkouts/swift-package-manager/Sources/PackageLoading/ManifestLoader.swift:548:55: error: type 'JSONEncoder.OutputFormatting' has no member 'withoutEscapingSlashes'
encoder.outputFormatting = [.sortedKeys, .withoutEscapingSlashes]
~^~~~~~~~~~~~~~~~~~~~~~但改用本地克隆的swift-package-manager有助于编译。我刚刚修改了sourcekit-lsp项目中Package.swift文件末尾的依赖项,以获取本地spm,如下所示
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
// Building standalone.
package.dependencies += [
.package(name: "IndexStoreDB", url: "https://github.com/apple/indexstore-db.git", .branch("main")),
//.package(name: "SwiftPM", url: "https://github.com/apple/swift-package-manager.git", .branch("main")),
.package(name: "SwiftPM", path: "/home/rock64/Software/swift-package-manager"),
.package(url: "https://github.com/apple/swift-tools-support-core.git", .branch("main")),
.package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "0.3.0")),
]
} else {
⋮并在文件中删除了失败的枚举案例encoder.outputFormatting = [.sortedKeys, .withoutEscapingSlashes]
swift-package-manager/Sourcswift-package-manager/Sources/PackageLoading/ManifestLoader.swiftes/PackageLoading/ManifestLoader.swift
所以现在只剩下encoder.outputFormatting = [.sortedKeys]了
只需确保使用路径,并且不要忘记在本地克隆的swift-package-manager中提交更改
这应该可以帮助您完成编译阶段。我可以确认服务器在vim和vscode中运行良好,但由于枚举编辑,可能会有一些隐藏的小故障。稍后我将进一步研究它。
https://stackoverflow.com/questions/63604002
复制相似问题