23
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

swift - 4.2 では Linux でも Foundation が使える

Last updated at Posted at 2018-09-22

Swift が正式に 4.2 になりました。

色々いいことがあるのですが、個人的に一番嬉しいのは、 Linux でも macOS 同様に Foundation が使えること。これで macOS とのコード共有率が格段に上がります。

Screen Shot 2018-09-22 at 21.13.30.png

なのですが、公式Downloadページの取説のママだと

Welcome to Swift version 4.2 (swift-4.2-RELEASE). Type :help for assistance.
  1> import Foundation
error: Couldn't lookup symbols:
  _swift_FORCE_LOAD_$_swiftGlibc

という具合に使えません。clang, libicu-dev に加え、 libcurl4 も必要なのが原因です。以下は Ubuntu 18.04 の例です。

$ cd ~ # home directory で作業
$ sudo apt-get install clang libicu-dev libcurl4
$ wget https://swift.org/builds/swift-4.2-release/ubuntu1804/swift-4.2-RELEASE/swift-4.2-RELEASE-ubuntu18.04.tar.gz
$ tar xvpf swift-4.2-RELEASE-ubuntu18.04.tar.gz
$ export PATH=~/swift-4.2-RELEASE-ubuntu18.04/usr/bin:$PATH

これでうまく行ったという方はその旨コメントしていただけると嬉しいです。Enjoy!

Dan the Safe, Fast and Expressive

23
19
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?