我对迅捷是全新的.它刚刚作为Linux的开源发布,我想尝试一下.这是在ubuntu 14.04上.clang按先决条件安装.
:这里要求clang版本3.6也在ubuntu 14.04上.我先用clang 3.4尝试了这些第一步,但是按照链接中的说明更新到3.6并重试了.结果相同.
我已经下载了https://swift.org/builds/ubuntu1404/swift-2.2-SNAPSHOT-2015-12-01-b/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz到〜/ Downloads /.安装脚本和swift的第一步:
$ cd /tmp $ tar xf ~/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz $ PATH=/tmp/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin/:"$PATH" $ clang++ --version Ubuntu clang version 3.6.0-2ubuntu1~trusty1 (tags/RELEASE_360/final) (based on LLVM 3.6.0) Target: x86_64-pc-linux-gnu Thread model: posix $ which swift /tmp/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin//swift $ swift --version Swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 778f82939c) Target: x86_64-unknown-linux-gnu $ swift Welcome to Swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 778f82939c). Type :help for assistance. 1> 1 + 2 opening import file for module 'SwiftShims': No such file or directory 1>
根据这个入门指南它应该打印而不是
$R0: Int = 3
怎么了,怎么解决?
编辑:尝试手动查找该文件:它显然未包含在安装中:
$ find swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/ | grep -i shims swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/FoundationShims.h swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/SwiftStddef.h swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/module.map swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/UnicodeShims.h swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/GlobalObjects.h swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/HeapObject.h swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/RuntimeShims.h swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/RefCount.h swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/RuntimeStubs.h swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/LibcShims.h swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/CoreFoundationShims.h swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/shims/SwiftStdint.h
编辑:当我尝试swift build
helloworld示例时,会生成以下输出:
/tmp/Hello$ swift build:0: error: opening import file for module 'Swift': No such file or directory swift-build: exit(1): ["/tmp/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin/swiftc", "--driver-mode=swift", "-I", "/tmp/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/pm", "-L", "/tmp/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/pm", "-lPackageDescription", "/tmp/Hello/Package.swift"]
编辑:截至2015-12-22的新发现
自从我发布这个问题以来,已经发布了至少两个关于swift for linux的快照:2015-12-10和2015-12-18.我试过这些,但他们没有解决这个问题.
这里的邮件列表主题(帖子1,帖子2,帖子3)是关于同样的问题.有人建议在主目录下安装swift会有所帮助.它在我的情况下没有帮助,错误信息仍然是相同的.
更有趣的是,该邮件列表线程包含对使用strace创建的REPL错误的分析.将特定的strace输出与REPL工作的系统的strace输出进行比较会很有趣.
编辑:更多信息截至2015-12-26:
新的快速发布日期已于2015-12-22发布.此版本表现出同样的问题.
关于此问题的另一个线程已经出现了快速的邮件列表上从这里开始.遇到问题的用户也在此处发布了strace输出.
我有同样的问题.事实证明,我已经添加了ppa:ubuntu-toolchain -r/test repo,以便在我的Mint发行版(17.2)上安装g ++ - 4.9.一旦我清除了存储库并将各种库恢复到原始版本,swift终于为我工作了.
具体来说,我不得不跑
sudo apt-get install ppa-purge sudo ppa-purge -d trusty ppa:ubuntu-toolchain-r/test
清理时,ppa-purge抱怨为了解决冲突,它必须删除在Ubuntu Trusty仓库中找不到的相当多的软件包(包括build-essential,xorg,gcc,x11-等真正的核心软件包) xserver-utils ...),所以我做了一个笔记,并在清除后立即重新安装.要非常小心.
我认为在安装g ++ 4.9时被覆盖的一些库会产生冲突.我已经在新的Mint安装上验证了这一切.