Package Details: swift-bin 4.0.3-2

Git Clone URL: https://aur.archlinux.org/swift-bin.git (read-only)
Package Base: swift-bin
Description: Official binary builds of the Swift programming language.
Upstream URL: https://swift.org
Keywords: apple language swift swiftlang
Licenses: Apache
Conflicts: lldb, swift-language-git
Provides: swift-language
Replaces: swift-language-bin
Submitter: ashleyis
Maintainer: refi.64
Last Packager: refi.64
Votes: 46
Popularity: 1.443259
First Submitted: 2015-12-04 17:31
Last Updated: 2018-02-17 19:46

Pinned Comments

refi.64 commented on 2018-02-08 22:13

New package release! Changes include:

  • libcurl should now work out-of-the-box, without having to use LD_PRELOAD.
  • Header includes work.
  • Version warnings won't be printed. This means that Swift commands that assume any output is erroneous will succeed, and any compiled programs also won't print version information warnings. This ALSO means that any binaries you compile will use a custom dynamic linker (stored in /usr/lib/swift/arch/ld.so), and that an incredibly ugly hack was necessary in order to make this work.

Note that the signing key comment by @FredBezies still applies, so make sure you enter:

gpg --recv-keys --keyserver hkp://pgp.mit.edu EF5430F071E1B235

Enjoy!

FredBezies commented on 2017-09-21 05:28

Swift 4.x.x provides a new signing key. So before building it, please enter this key : gpg --recv-keys --keyserver hkp://pgp.mit.edu EF5430F071E1B235

And there is no easy way - as I tried this morning - to work around libcurl issue :(

Latest Comments

refi.64 commented on 2018-02-17 19:45

@wezm Sorry, that should be fixed now. I somehow managed to miss committing a small but necessary change that therefore broke swiftc.

wezm commented on 2018-02-16 03:21

FYI I installed this and tried to build some projects that use swift package manager and they all failed with an error like, "The manifest file at /path/to/a/file is empty". I then built swift form source using the swift AUR package, which also has the 4.0.3 version and it appears to work.

refi.64 commented on 2018-02-08 22:13

New package release! Changes include:

  • libcurl should now work out-of-the-box, without having to use LD_PRELOAD.
  • Header includes work.
  • Version warnings won't be printed. This means that Swift commands that assume any output is erroneous will succeed, and any compiled programs also won't print version information warnings. This ALSO means that any binaries you compile will use a custom dynamic linker (stored in /usr/lib/swift/arch/ld.so), and that an incredibly ugly hack was necessary in order to make this work.

Note that the signing key comment by @FredBezies still applies, so make sure you enter:

gpg --recv-keys --keyserver hkp://pgp.mit.edu EF5430F071E1B235

Enjoy!

FredBezies commented on 2018-02-08 08:01

Orphaning it. Refi.64, here you go. Good luck :)

refi.64 commented on 2018-02-07 21:40

@FredBezies Ok, that would be great!

FredBezies commented on 2018-02-07 10:38

@refi.64 : if you want it, I can orphan it in order to give it to you. Just ask.

refi.64 commented on 2018-02-05 18:50

@FredBezies: I guess so? I mean, I'm working on some Swift projects (I used Ubuntu before, and haven't been able to work on them since switching to Arch, because of obvious reasons), so I guess I have some incentive. ;)

FredBezies commented on 2018-02-05 18:30

@refi.64: if you want to adopt swift-bin package, I'll give it to you. I'm not using anymore this package. So...

refi.64 commented on 2018-02-05 18:28

After a long time of experimenting with various things, I FINALLY have a fully, 100% working version of the Swift binaries. No more libcurl errors, no more version warnings, no more include header issues.

Of course, the con is that this is a hot mess. It creates a custom ld.so without version warnings (to ensure that building works), patches the proper libcurl.so (same thing), and - worst of all - uses bubblewrap to add a custom clang++ that patches ld.so on all built files. It's a hot mess, but it works perfectly. I've successfully built several sample applications with it.

Here's the patch:

diff --git a/PKGBUILD b/PKGBUILD
index [`852e3ec`](https://aur.archlinux.org/cgit/aur.git/commit/?h=swift-bin&id=852e3ec)..3fbd753 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -9,13 +9,14 @@ pkgdesc="Official binary builds of the Swift programming language."
 arch=('x86_64')
 url="<https://swift.org>"
 license=('apache')
-depends=('icu55' 'ncurses5-compat-libs' 'libedit' 'python2' 'libutil-linux' 'libbsd' 'clang' 'python2-six' 'libxml2')
+depends=('icu55' 'ncurses5-compat-libs' 'libedit' 'python2' 'libutil-linux' 'libbsd' 'clang' 'python2-six' 'libxml2' 'libcurl-compat' 'patchelf' 'bubblewrap')
+makedepends=('qldv-git')
 conflicts=('lldb' 'swift-language-git')
 options=('!strip')
 validpgpkeys=('5E4DF843FB065D7F7E24FBA2EF5430F071E1B235')
 provides=('swift-language')
 replaces=('swift-language-bin')
-source=(  
+source=(
 "<https://swift.org/builds/swift>-${_version}-release/ubuntu1604/swift-${_version}-RELEASE/swift-${_version}-RELEASE-ubuntu16.04.tar.gz"
 "<https://swift.org/builds/swift>-${_version}-release/ubuntu1604/swift-${_version}-RELEASE/swift-${_version}-RELEASE-ubuntu16.04.tar.gz.sig"
 )
@@ -24,6 +25,7 @@ sha256sums=('9adf64cabc7c02ea2d08f150b449b05e46bd42d6e542bf742b3674f5c37f0dbf'

 package() {
     tar -C "$pkgdir" -xf "swift-${_version}-RELEASE"*.tar.gz --strip 1
+    mkdir -p "${pkgdir}/usr/lib/swift/arch"

     # Permission fix
     find "${pkgdir}" -type d -exec chmod 755 {} +
@@ -31,23 +33,41 @@ package() {
     # Remove all unnecessary stuff
     rm -rf "${pkgdir}/usr/local"

-    # Yuck! patching libedit SONAME
+    # Yuck! patching libedit and libcurl SONAMEs
     find "${pkgdir}/usr/bin" -type f -exec sed -i 's/libedit\.so\.2/libedit\.so\.0/g' {} \;
     find "${pkgdir}/usr/lib" -type f -exec sed -i 's/libedit\.so\.2/libedit\.so\.0/g' {} \;
+    sed -i 's/libcurl\.so\.4/libcurl\.so\.3/g' "${pkgdir}/usr/lib/swift/linux/libFoundation.so"

-    # remove the six.py dumped in python's site packages
+    # Patch the ld interpreter to avoid version warnings
+    qldv "`qldv -find`" "${pkgdir}/usr/lib/swift/arch/ld.so"
+    find "${pkgdir}/usr/bin" -type f -exec patchelf --set-interpreter '/usr/lib/swift/arch/ld.so' {} \;
+
+    # Hack to ensure Swift runs patchelf on output files to fix the libcurl version warnings
+    ln -sf "../../../bin/swift" "${pkgdir}/usr/lib/swift/arch/swiftc"
+    rm "${pkgdir}/usr/bin/swiftc"
+    echo '#!/bin/bash' > "${pkgdir}/usr/bin/swiftc"
+    # bwrap is used to alias the original Clang as cc, then replace Clang with a wrapper script.
+    echo 'bwrap --dev-bind / / --bind /usr/bin/clang /usr/bin/cc --bind /usr/lib/swift/arch/clang++ /usr/bin/clang++ /usr/lib/swift/arch/swiftc "$@"'
+
+    echo '#!/bin/bash' > "${pkgdir}/usr/lib/swift/arch/clang++"
+    echo '( exec -a clang++ cc "$@" ) && patchelf --set-interpreter /usr/lib/swift/arch/ld.so "${@: -1}"' >> "${pkgdir}/usr/lib/swift/arch/clang++"
+
+    chmod +x "${pkgdir}/usr/bin/swiftc" "${pkgdir}/usr/lib/swift/arch/clang++"
+
+    # Patch the module files
+    sed -i 's|x86_64-linux-gnu/||' "${pkgdir}/usr/lib/swift/linux/x86_64/glibc.modulemap"
+    sed -i 's|x86_64-linux-gnu/||' "${pkgdir}/usr/lib/swift_static/linux/static-stdlib-args.lnk"
+
+    # Remove the six.py dumped in python's site packages
     rm "${pkgdir}/usr/lib/python2.7/site-packages/six.py"
     rm "${pkgdir}/usr/lib/python2.7/site-packages/six.pyc"

     # Ensure the items have the right permissions..
     # some tarballs from upstream seem to have the wrong ones
     find "${pkgdir}/usr/bin" -type f -exec chmod a+rx {} \;
-    find "${pkgdir}/usr/lib" -type f -exec chmod a+r {} \;     
+    find "${pkgdir}/usr/lib" -type f -exec chmod a+r {} \;

     # Move license
     install -dm755 ${pkgdir}/usr/share/licenses/${pkgname}
     mv ${pkgdir}/usr/share/swift/LICENSE.txt ${pkgdir}/usr/share/licenses/${pkgname}
 }
-
-
-

marcusramberg commented on 2017-11-06 08:25

4.0.2-1 won't install for me:

==> ERROR: Integrity checks (sha256) differ in size from the source array.

*update* fixed in -2

All comments