2015-12-08 186 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