2015-12-08 160 views
1

我试图在我的Fedora 22上快速工作。我遵循官方指示(https://swift.org/getting-started/#installing-swift)。 我能够使用快捷REPL并执行快捷文件,而无需与swift main.swiftLinux Fedora swift符号查找错误

swift.main内容编译它:

print("Hello, world!") 

当我尝试通过编译它: swiftc main.swift -o main 我会出现以下错误:

[[email protected] Sources]$ swiftc main.swift -o main -v 
Swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 778f82939c) 
Target: x86_64-unknown-linux-gnu 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swift -frontend -c -primary-file main.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -module-name main -o /tmp/main-dd738b.o 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swift-autolink-extract /tmp/main-dd738b.o -o /tmp/main-739e5f.autolink 
/usr/bin/clang++ /tmp/main-dd738b.o -L /home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux -Xlinker -rpath -Xlinker /home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux -lswiftCore @/tmp/main-739e5f.autolink -Xlinker -T /home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/x86_64/swift.ld -o main 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/libswiftCore.so: undefined reference to `uiter_setUTF8_55' 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/libswiftCore.so: undefined reference to `ucol_strcollIter_55' 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/libswiftCore.so: undefined reference to `uiter_setString_55' 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/libswiftCore.so: undefined reference to `ucol_next_55' 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/libswiftCore.so: undefined reference to `ucol_closeElements_55' 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/libswiftCore.so: undefined reference to `u_strToUpper_55' 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/libswiftCore.so: undefined reference to `ucol_strcoll_55' 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/libswiftCore.so: undefined reference to `ucol_open_55' 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/libswiftCore.so: undefined reference to `u_strToLower_55' 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/libswiftCore.so: undefined reference to `ucol_openElements_55' 
/home/christian/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/lib/swift/linux/libswiftCore.so: undefined reference to `ucol_setAttribute_55' 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation) 

难道是因为二进制文件是针对Ubuntu的吗?或者我错过了什么?

在此先感谢!

+0

看看这个:https://github.com/thawkins/fedora-swift – Moritz

+0

这看起来不错,我会测试它,并告诉你它是如何工作的! – RoodRallec

回答

0

正如您可能知道的那样,这些错误表明Swift需要一些符号,很可能是函数,但在任何正在使用的库中都不可用。函数名不会随着我响起,所以我无法真正知道如何解决这些特定的错误。

我想在这一点上,你可能想尝试从源代码构建Swift,如下所述:https://github.com/apple/swift/blob/master/README.md。在Fedora上使用Ubuntu二进制文件可能不是一个好主意。即使你经历了这些错误,其他的事情也有可能在以后出现。

我还没有尝试从源代码构建Swift,所以不能真正分享任何经验。

+0

是的,这些符号应该由swift库提供。我只是建立了一个Ubuntu 15.10,它像一个魅力。从源代码编译将是我对Fedora的下一次尝试,但现在我可以尝试使用我的Ubuntu版本。 – RoodRallec