Swift on Linux: Make very first step work

后端 未结 5 836
灰色年华
灰色年华 2021-02-19 20:19

I am totally new to swift. It has just been released as open source for linux and I wanted to try it. This is on ubuntu 14.04. clang is installed as per prerequisites.

5条回答
  •  [愿得一人]
    2021-02-19 20:54

    I repeated the same steps as you described on a brand-new Ubuntu 14.04 Azure VM and got the expected

    $R0: Int = 3
    

    Interestingly, it worked fine even without Clang or GCC! Later I installed Clang-3.5, and it worked as well.

    Is it possible that they have sneaked in a new tarball with the same name? The MD5 hash of the one I got is here:

    user@ubuntu1:/tmp/junk$ md5sum swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz 
    a93f52921c491b747cad256904c8742f  swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz
    

    Does yours match? If so, you may want to try a different installation of Ubuntu 14.04 if you have access to one.

    I have also been able to successfully use swift build as instructed in https://swift.org/getting-started/#using-the-build-system . Removing the clang-3.5 package broke swift build, just as I had suspected, but REPL swift still worked as it did originally, before installing Clang for the first time. Then I installed Clang-3.4, and swift build was back in business.

    Update 1/3/2016:

    Using the hints from the various comments on this question, I've been able to reproduce the error on my Ubuntu 14.04 Azure VM. As an alternative solution, the problem can also be addressed by manipulating $LD_LIBRARY_PATH, see Unable to compile "hello world" program with Swift on Ubuntu 14.04.

提交回复
热议问题