{"id":3092,"date":"2016-06-25T16:17:28","date_gmt":"2016-06-25T22:17:28","guid":{"rendered":"http:\/\/dev.iachieved.it\/iachievedit\/?p=3092"},"modified":"2016-06-26T07:01:03","modified_gmt":"2016-06-26T13:01:03","slug":"swift-3-0-for-ubuntu-16-04-xenial-xerus","status":"publish","type":"post","link":"https:\/\/dev.iachieved.it\/iachievedit\/swift-3-0-for-ubuntu-16-04-xenial-xerus\/","title":{"rendered":"Swift 3.0 for Ubuntu 16.04 Xenial Xerus"},"content":{"rendered":"<p><a href=\"https:\/\/swift.org\/\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/badge\/Swift-3.0-orange.svg?style=flat\" alt=\"Swift 3.0\" \/><\/a><\/p>\n<p>In our zeal to get Swift 3.0 on as many Linux systems as possible we went ahead and got a jumpstart on building for <b>Ubuntu 16.04<\/b>, also known as <a href=\"http:\/\/releases.ubuntu.com\/16.04\/\">Xenial Xerus<\/a>, for X86 systems.  Installation is as easy as using our APT repository with <code>apt-get<\/code>.  Binaries are installed into <code>\/opt\/swift\/swift-3.0<\/code>, so you <i>will need<\/i> to update your path after installing the 3.0 package.  <b>Editor&#8217;s note:<\/b>  For the rationale as to why we use <code>\/opt\/swift<\/code> rather than <code>\/usr\/bin\/<\/code>, see <a href=\"https:\/\/lists.swift.org\/pipermail\/swift-dev\/Week-of-Mon-20160425\/001838.html\">this thread<\/a> on the swift-dev mailing list.<\/p>\n<p><b>1.  Add the repository key<\/b><\/p>\n<pre class=\"crayon:false\">\nwget -qO- http:\/\/dev.iachieved.it\/iachievedit.gpg.key | sudo apt-key add -\n<\/pre>\n<p><b>2.  Add the Xenial repository to <code>sources.list<\/code><\/b><\/p>\n<pre class=\"crayon:false\">\necho \"deb http:\/\/iachievedit-repos.s3.amazonaws.com\/ xenial main\" | sudo tee --append \/etc\/apt\/sources.list\n<\/pre>\n<p><b>3.  Run <code>apt-get update<\/code><\/b><\/p>\n<pre class=\"crayon:false\">\nsudo apt-get update\n<\/pre>\n<p><b>4.  Install swift-3.0!<\/b><\/p>\n<pre class=\"crayon:false\">\nsudo apt-get install swift-3.0\n<\/pre>\n<p><b>5.  Update that <code>PATH<\/code>!<\/b><\/p>\n<pre class=\"crayon:false\">\nexport PATH=\/opt\/swift\/swift-3.0\/usr\/bin:$PATH\n<\/pre>\n<p><b>6.  Try it out<\/b><\/p>\n<pre class=\"crayon:false\">\ngit clone https:\/\/github.com\/apple\/example-package-dealer\ncd example-packager-dealer\nswift build\nCompiling Swift Module 'FisherYates' (1 sources)\nLinking Library:  .build\/debug\/FisherYates.a\nCompiling Swift Module 'PlayingCard' (3 sources)\nLinking Library:  .build\/debug\/PlayingCard.a\nCompiling Swift Module 'DeckOfPlayingCards' (1 sources)\nLinking Library:  .build\/debug\/DeckOfPlayingCards.a\nCompiling Swift Module 'Dealer' (1 sources)\nLinking Executable:  .build\/debug\/Dealer\n<\/pre>\n<p>Run it!<\/p>\n<pre class=\"crayon:false\">\n.build\/debug\/Dealer\n<\/pre>\n<h2>FAQ<\/h2>\n<p><b>Q.<\/b>  Did Apple build these binaries?<br \/>\n<b>A.<\/b>  No, I built them on my personal server using the instructions I posted <a href=\"http:\/\/dev.iachieved.it\/iachievedit\/keeping-up-with-open-source-swift\/\">here<\/a>.<\/p>\n<p><b>Q.<\/b>  What git revisions are included in the build?<br \/>\n<b>A.<\/b>  You can use <code>apt-cache show swift-3.0<\/code> to see this information.  For example:<\/p>\n<pre class=\"crayon:false\">\n# apt-cache show swift-3.0\nPackage: swift-3.0\nConflicts: swift-2.2\nVersion: 1:3.0-0ubuntu10+xenial1\nArchitecture: amd64\nInstalled-Size: 370463\nMaintainer: iachievedit (support@iachieved.it)\nDepends: clang (>= 3.6), libicu-dev\nHomepage: http:\/\/dev.iachieved.it\/iachievedit\/swift\nPriority: optional\nSection: development\nFilename: pool\/main\/s\/swift-3.0\/swift-3.0_3.0-0ubuntu10+xenial1_amd64.deb\nSize: 72513864\nSHA256: b1bf548f353466ea72696089a8b666956a2603edb467eb0517e858eb1ba86511\nSHA1: 5dd02b14d21f2e821040de3bb1052561653fcfcd\nMD5sum: f2c3d3b9517a303cc86558b6c560a8d6\nDescription: Open Source Swift\n This is a packaged version of Open Source Swift 3.0 built from\n the following git revisions of the Apple Github repositories:\n       Clang:  460d629e85\n        LLVM:  8d0086ac3e\n       Swift:  1abe85ab41\n  Foundation:  4c15543f82\nDescription-md5: a6b1dd247c7584b61692a101d9d0e5fa\n\n<\/pre>\n<p>The source tree is <i>untouched<\/i> for each build.<\/p>\n<p><b>Q.<\/b>  Do you test the binaries before you upload them?<br \/>\n<b>A.<\/b>  The Swift build process tests the resulting binaries, and I then do run some basic tests and compile my own applications, but there is currently no separate exhaustive test suite.<\/p>\n<p><b>Q.<\/b>  Are you releasing builds on a set schedule?<br \/>\n<b>A.<\/b>  Not really, though I may try to stay in sync with the releases from Apple.  The idea was to get something out for folks to experiment with and start coding Swift on Linux.<\/p>\n<p><b>Q.<\/b>  Where is everything installed?<br \/>\n<b>A.<\/b>  Everything gets put in <code>\/opt\/swift\/swift-3.0\/usr<\/code>.<\/p>\n<p><b>Q.<\/b>  How do I decipher the package version number?<br \/>\n<b>A.<\/b>  This was my first take on what I thought should be an appropriate package version number.  Breaking it down, <code>3.0-0ubuntu10+xenial1<\/code> should be:<\/p>\n<ul>\n<li>3.0 is the version of Swift that is packaged\n<li>-0ubuntu10 indicates that this is the 2nd package for Ubuntu, with the 0 indicating that there is no upstream Debian package upon which this package was based\n<li>+xenial1 indicates that this package is for Xenial Xerus\n<\/ul>\n<p>I <i>think<\/i> I got that right, but if you feel otherwise please do drop me a line at <code>support@iachieved.it<\/code>.<\/p>\n<h2>How Does This Work?<\/h2>\n<p>I used <a href=\"http:\/\/xn.pinkhamster.net\/blog\/tech\/host-a-debian-repository-on-s3.html\">these awesome instructions<\/a> on how to host a Debian package repository on Amazon S3.  I tried to set up a Launchpad PPA, but quite frankly, got tired of trying to wade through all the metadata required to put together a simple package.  I&#8217;m sure for hosting distribution repositories it&#8217;s all required, but for this it felt like overkill.  The folks that develop <a href=\"https:\/\/github.com\/jordansissel\/fpm\">fpm<\/a> also have some choice things to say about it.<\/p>\n<p>The packaging scripts we use to build everything and upload to the repository can be found <a href=\"\nhttps:\/\/github.com\/iachievedit\/package-swift\">Github<\/a>.  For Swift 3.0 make sure and look at the <code>swift-3.0<\/code> branch.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our zeal to get Swift 3.0 on as many Linux systems as possible we went ahead and got a jumpstart on building for Ubuntu 16.04, also known as Xenial Xerus, for X86 systems. Installation is as easy as using our APT repository with apt-get. Binaries are installed into \/opt\/swift\/swift-3.0, so you will need to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3095,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[7,32,48,47,46],"class_list":["post-3092","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-swift","tag-swift-2","tag-swift-3-0","tag-swift-ubuntu-16-04","tag-ubuntu","tag-xenial-xerus"],"_links":{"self":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/3092"}],"collection":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/comments?post=3092"}],"version-history":[{"count":10,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/3092\/revisions"}],"predecessor-version":[{"id":3104,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/3092\/revisions\/3104"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media\/3095"}],"wp:attachment":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media?parent=3092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/categories?post=3092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/tags?post=3092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}