View previous topic :: View next topic |
Author |
Message |
stanblesk n00b
Joined: 06 Apr 2017 Posts: 12 Location: Barnaul, Russia
|
Posted: Thu Apr 06, 2017 8:36 am Post subject: Swift programming language on Gentoo |
|
|
Hello, fellow Gentooers!
Has anyone ever tried to successfully install and run Swift?
Are there any plans on adding dev-lang/swift ebuild to Gentoo repository?
Apple released Swift to Open Source community, and this programming language seems to be very promising.
I would like to be able to launch Swift/Vapor backend for mobile applications and websites on Gentoo server. |
|
Back to top |
|
|
xaviermiller Bodhisattva
Joined: 23 Jul 2004 Posts: 8708 Location: ~Brussels - Belgique
|
Posted: Thu Apr 06, 2017 8:54 am Post subject: |
|
|
Hi!,
Swift can only build for Apple targets, and Vapor seems really young.
They are not yet available on Gentoo.
Even if Swift is open source, it is aimed to run on Apple ecosystem. I don't see the added value to run it on Linux. _________________ Kind regards,
Xavier Miller |
|
Back to top |
|
|
stanblesk n00b
Joined: 06 Apr 2017 Posts: 12 Location: Barnaul, Russia
|
Posted: Thu Apr 06, 2017 8:58 am Post subject: |
|
|
xaviermiller wrote: | I don't see the added value to run it on Linux. |
They have made Linux support. Although it is limited to Ubuntu only... Here's their official website
They say
Quote: | Note that nothing prevents Swift from being ported to other Linux distributions beyond the ones mentioned below. These are only the distributions where these binaries have been built and tested. |
|
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54236 Location: 56N 3W
|
Posted: Thu Apr 06, 2017 10:15 am Post subject: |
|
|
There are some contradictory aims there. e.g. Speed and checking.
I'm old and cynical.
I want it fast.
I want it good.
I want it cheap.
Choose any two from three. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
188562 Apprentice
Joined: 22 Jun 2008 Posts: 186
|
|
Back to top |
|
|
stanblesk n00b
Joined: 06 Apr 2017 Posts: 12 Location: Barnaul, Russia
|
Posted: Fri Apr 07, 2017 1:52 am Post subject: |
|
|
Code: | [ebuild N ~] dev-lang/swift-3.0.2::x-portage PYTHON_TARGETS="python3_4" 35 282 KiB
Total: 1 package (1 new), Size of downloads: 35 282 KiB
Would you like to merge these packages? [Yes/No] y
>>> Verifying ebuild manifests
!!! A file is not listed in the Manifest: '/usr/local/portage/dev-lang/swift/files/xar-1.6.patch'
>>> Emerging (1 of 1) dev-lang/swift-3.0.2::x-portage
>>> Jobs: 0 of 1 complete, 1 running Load avg: 0.33, 0.21, 0.25!!! A file is not listed in the Manifest: '/usr/local/portage/dev-lang/swift/files/xar-1.6.patch'
>>> Failed to emerge dev-lang/swift-3.0.2
>>> Jobs: 0 of 1 complete, 1 failed Load avg: 0.33, 0.21, 0.25
*
* The following package has failed to build, install, or execute postinst:
*
* (dev-lang/swift-3.0.2:0/0::x-portage, ebuild scheduled for merge)
*
|
|
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 30911 Location: here
|
Posted: Fri Apr 07, 2017 5:42 am Post subject: |
|
|
Code: | !!! A file is not listed in the Manifest: '/usr/local/portage/dev-lang/swift/files/xar-1.6.patch' |
Try to recreate manifest ebuild /path/to/your/ebuild/swift-3.0.2.ebuild digest _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
stanblesk n00b
Joined: 06 Apr 2017 Posts: 12 Location: Barnaul, Russia
|
Posted: Fri Apr 07, 2017 9:06 am Post subject: |
|
|
Thanks a lot, fedeliallalinea. It helped.
But dev-lang/swift fails to build... Here's a build.log's last lines dump
Although emerge says that everything is fine:
Code: | [ebuild N ~] dev-lang/swift-3.0.2::x-portage PYTHON_TARGETS="python3_4" 8 176 KiB
Total: 1 package (1 new), Size of downloads: 8 176 KiB
Would you like to merge these packages? [Yes/No] y
>>> Verifying ebuild manifests
>>> Emerging (1 of 1) dev-lang/swift-3.0.2::x-portage
>>> Installing (1 of 1) dev-lang/swift-3.0.2::x-portage
>>> Recording dev-lang/swift in "world" favorites file...
>>> Jobs: 1 of 1 complete Load avg: 7.76, 8.08, 7.39
>>> Auto-cleaning packages...
>>> No outdated packages were found on your system.
* GNU info directory index is up-to-date.
|
|
|
Back to top |
|
|
188562 Apprentice
Joined: 22 Jun 2008 Posts: 186
|
Posted: Fri Apr 07, 2017 9:27 am Post subject: |
|
|
My build error:
Code: | t /home/build/tmp/portage/dev-lang/swift-3.0.2/work/swift/stdlib/public/core/UnfoldSequence.swift /home/build/tmp/port
age/dev-lang/swift-3.0.2/work/swift/stdlib/public/core/VarArgs.swift /home/build/tmp/portage/dev-lang/swift-3.0.2/work/swift/stdlib/public/c
ore/Zip.swift
/home/build/tmp/portage/dev-lang/swift-3.0.2/work/swift/stdlib/public/core/ArrayBody.swift:18:8: error: opening import file for module 'Swif
tShims': No such file or directory
import SwiftShims
^
ninja: build stopped: subcommand failed.
utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
| ]
But:
Code: | > → pwd
/home/build/tmp/portage/dev-lang/swift-3.0.2/work/build/buildbot_linux/swift-linux-x86_64/bin
> → ls -1
lldb-moduleimport-test
sil-extract
sil-opt
swift
swift-api-digester
swift-api-dump.py
swift-autolink-extract
swiftc
swift-demangle
swift-ide-test
swift-llvm-opt
swift-reflection-dump
swift-remoteast-test
> → file swift
swift: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped
>→ ldd swift
linux-vdso.so.1 (0x00006f73d05b1000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00006f73d0172000)
libdl.so.2 => /lib64/libdl.so.2 (0x00006f73cff6e000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00006f73cfd69000)
libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00006f73cfb2d000)
libz.so.1 => /lib64/libz.so.1 (0x00006f73cf914000)
libm.so.6 => /lib64/libm.so.6 (0x00006f73cf60e000)
libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libstdc++.so.6 (0x00006f73cf1e3000)
libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libgcc_s.so.1 (0x00006f73cefcc000)
libc.so.6 => /lib64/libc.so.6 (0x00006f73cec28000)
/lib64/ld-linux-x86-64.so.2 (0x00006f73d038f000)
|
Main file:
Code: | > → ./swift
<unknown>:0: error: opening import file for module 'Swift': No such file or directory
LLVM ERROR: Compiler-internal integrated REPL unimplemented for this platform; use the LLDB-enhanced REPL instead.
|
How to fix thix ^ i don`t know. |
|
Back to top |
|
|
188562 Apprentice
Joined: 22 Jun 2008 Posts: 186
|
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 30911 Location: here
|
Posted: Fri Apr 07, 2017 11:50 am Post subject: |
|
|
@stanblesk: I found this maybe can help _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
188562 Apprentice
Joined: 22 Jun 2008 Posts: 186
|
Posted: Fri Apr 07, 2017 11:55 am Post subject: |
|
|
And btw there is a bug #567514 |
|
Back to top |
|
|
stanblesk n00b
Joined: 06 Apr 2017 Posts: 12 Location: Barnaul, Russia
|
Posted: Fri Apr 07, 2017 12:23 pm Post subject: |
|
|
Quote: | use the LLDB-enhanced REPL instead |
Looks like LLVM needs to be built with lldb use flag. I've tried to reemerge LLVM with LLDB (first I had to unmask this use flag), but it fails to build... |
|
Back to top |
|
|
188562 Apprentice
Joined: 22 Jun 2008 Posts: 186
|
Posted: Fri Apr 07, 2017 12:40 pm Post subject: |
|
|
Among other things, swift have swift-llvm And as I understand swift is build with its own llvm NOT system-llvm.
And I have old hardware and build takes at least ten hours. So for me this is a real test without much sense |
|
Back to top |
|
|
188562 Apprentice
Joined: 22 Jun 2008 Posts: 186
|
Posted: Wed Jul 26, 2017 10:59 am Post subject: |
|
|
Update dev-lang/dev-lang/swift{-bin}-3.1.1
No check install pfase! If anyone can build it let me know. |
|
Back to top |
|
|
stanblesk n00b
Joined: 06 Apr 2017 Posts: 12 Location: Barnaul, Russia
|
Posted: Sun Dec 17, 2017 8:56 am Post subject: |
|
|
I finally managed to install Swift 4.1 on Gentoo. With some issues of course...
1. emerged clang. Current version is 4.0.1
2. emerged libedit. Somewhere during the build there was a failure. editline/readline was required and couldn't be found. Well Apple's BSD legacy maybe =)
3. set python to 2.7 as default
4. utils/build-script --release-debuginfo --jobs 6 --install-prefix=/usr/local --lldb -T (ran as root, I don't know how's it going when ran as user)
5. During the lldb build there was a failure, so I had to manually find and replace 'python3.5m' with 'python2.7' in 'build/Ninja-RelWithDebInfoAssert/lldb-linux-x86_64/build.ninja'
6. then I ran command from 4th step again
I ran swift in command line, but it required lldb so I:
Code: | cd build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/bin/
ln -s ../../lldb-linux-x86_64/bin/lldb lldb |
--install-prefix doesn't work somehow so...
Code: | echo 'PATH=/home/stan/repo/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/bin:"{$PATH}"' >> ~/.bashrc
source ~/.bashrc |
Well swift works as an interpreter and a compiler.
Code: | stan@mygentoo ~ $ swift
Welcome to Swift version 4.1-dev (LLVM cd2d6e3b54, Clang f611516c9e, Swift 973448a942). Type :help for assistance.
1> |
Here's the test output:
********************
Testing Time: 396.70s
********************
Failing Tests (2):
Swift(linux-x86_64) :: Index/Store/output-failure.swift
Swift(linux-x86_64) :: Python/swift_build_support.swift
Expected Passes : 9355
Expected Failures : 89
Unsupported Tests : 1158
Unexpected Failures: 2
We are very close! I wish someday there will be the dev-lang/swift ebuild in official Gentoo repo... |
|
Back to top |
|
|
C5ace Guru
Joined: 23 Dec 2013 Posts: 472 Location: Brisbane, Australia
|
Posted: Sun Dec 17, 2017 9:37 am Post subject: |
|
|
NeddySeagoon wrote: | There are some contradictory aims there. e.g. Speed and checking.
I'm old and cynical.
I want it fast.
I want it good.
I want it cheap.
Choose any two from three. |
"C"! |
|
Back to top |
|
|
stanblesk n00b
Joined: 06 Apr 2017 Posts: 12 Location: Barnaul, Russia
|
Posted: Tue Feb 06, 2018 4:49 am Post subject: |
|
|
Final representation of how it works, and some problems:
Problems first: After couple of huge system updates swift started to cry about non-existent libraries, as it has linked to them during compilation. If there will be dev-lang/swift ebuild then portage probably has to call [....r...] key on in and rebuild. In dreams of course, when there will be ebuild))
And how it builds right now:
OPTIONAL:
Code: |
# echo 'app-doc/doxygen clang dot' >> /etc/portage/package.use/apple
# emerge -av swig doxygen
|
PREPARING:
Code: |
# emerge -av clang
# echo 'sys-devel/llvm libedit' >> /etc/portage/package.use/apple
# emerge -avuDN @world
# eselect python set python2.7
$ mkdir /home/stan/repo/swift-source
$ cd /home/stan/repo/swift-source/
$ git clone https://github.com/apple/swift.git
$ ./swift/utils/update-checkout --clone
$ cd swift
$ source /etc/profile
$ nano /home/stan/repo/swift-source/lldb/scripts/Python/python-swigsafecast.swig
|
Find
Code: |
return PyString_FromString(c_str);
|
and replace with:
Code: |
#if PY_MAJOR_VERSION > 2
return PyUnicode_FromString(c_str);
#else
return PyString_FromString(c_str);
#endif
|
COMPILING:
Code: |
$ utils/build-script --preset=buildbot_linux,no_test --jobs 8 install_destdir=/opt/swift installable_package=/tmp/swift.tar.gz
$ cd ../build/buildbot_linux/lldb-linux-x86_64/lib
$ ln -s ../lib64/python3.5 python3.5
$ cd /home/stan/repo/swift-source/swift
$ utils/build-script --preset=buildbot_linux,no_test --jobs 8 install_destdir=/opt/swift installable_package=/tmp/swift.tar.gz
|
RUNNING:
Code: |
$ nano ~/.bashrc
'''
export PATH="/opt/swift/usr/bin/:{$PATH}"
export C_INCLUDE_PATH=/opt/swift/usr/lib/swift/clang/include/
export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH
'''
$ source ~/.bashrc
$ swift
Welcome to Swift version 4.1-dev (LLVM b1f1b1f5b8, Clang d8b11579e8, Swift 6829ff688c). Type :help for assistance.
1>
|
As you can see it's getting easier, now it even builds with Foundation, but still problems exist. For example if I make .bashrc file for root with C_INCLUDE_PATH variable - my system is unable to compile packages after that
Could anybody help me out with creating ebuild out of that? |
|
Back to top |
|
|
rullie n00b
Joined: 30 Jan 2007 Posts: 2
|
Posted: Fri Jan 01, 2021 6:15 pm Post subject: Was able to get 9999 to build with Foundation and REPL |
|
|
Overlay here: https://github.com/luliu/swift-overlay
Tested on AMD64. Can import Foundation, REPL works.
Still lots of problems though, the whole thing is built monolithically, notably LLDB variant itself. Ideally I wanna add a swift USE flag on lldb and pull in apple's branch or make a slot or something. For now I just listed lldb as a blocker. You *might* also run into problems if you are on python 3.9, haven't tested. the thing takes awhile to build.
Here's emerge info:
Code: |
Portage 3.0.9 (python 3.8.6-final-0, default/linux/amd64/17.1/systemd, gcc-9.3.0, glibc-2.32-r3, 5.4.80-gentoo-r1-x86_64 x86_64)
=================================================================
System uname: Linux-5.4.80-gentoo-r1-x86_64-x86_64-AMD_Ryzen_9_3900X_12-Core_Processor-with-glibc2.2.5
KiB Mem: 26121388 total, 20516848 free
KiB Swap: 1048572 total, 1048572 free
Timestamp of repository gentoo: Fri, 01 Jan 2021 16:30:01 +0000
Head commit of repository gentoo: b86552d37320228854195e415005fe39a53e8c68
Head commit of repository swift-overlay: 13c66a3c3ed39e881111759dc0d391ceff7c6e16
sh bash 5.0_p18
ld GNU ld (Gentoo 2.34 p6) 2.34.0
app-shells/bash: 5.0_p18::gentoo
dev-lang/perl: 5.30.3::gentoo
dev-lang/python: 3.8.6::gentoo, 3.9.0::gentoo
dev-util/cmake: 3.17.4-r1::gentoo
sys-apps/baselayout: 2.7::gentoo
sys-apps/sandbox: 2.20::gentoo
sys-devel/autoconf: 2.69-r5::gentoo
sys-devel/automake: 1.16.2-r1::gentoo
sys-devel/binutils: 2.34-r2::gentoo
sys-devel/gcc: 9.3.0-r2::gentoo
sys-devel/gcc-config: 2.3.2-r1::gentoo
sys-devel/libtool: 2.4.6-r6::gentoo
sys-devel/make: 4.3::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc: 2.32-r3::gentoo
Repositories:
gentoo
location: /var/db/repos/gentoo
sync-type: rsync
sync-uri: rsync://rsync.gentoo.org/gentoo-portage
priority: -1000
sync-rsync-extra-opts:
sync-rsync-verify-jobs: 1
sync-rsync-verify-max-age: 24
sync-rsync-verify-metamanifest: yes
swift-overlay
location: /var/db/repos/swift-overlay
sync-type: git
sync-uri: https://github.com/luliu/swift-overlay
masters: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -mtune=generic"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -mtune=generic"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j25"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl amd64 berkdb bzip2 cli crypt dri fortran gdbm iconv ipv6 libglvnd libtirpc multilib ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl systemd tcpd udev unicode xattr zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python2_7 python3_8" RUBY_TARGETS="ruby25 ruby26" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset: CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
|
|
|
Back to top |
|
|
|