Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Swift programming language on Gentoo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
stanblesk
n00b
n00b


Joined: 06 Apr 2017
Posts: 12
Location: Barnaul, Russia

PostPosted: Thu Apr 06, 2017 8:36 am    Post subject: Swift programming language on Gentoo Reply with quote

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
View user's profile Send private message
xaviermiller
Administrator
Administrator


Joined: 23 Jul 2004
Posts: 7961
Location: ~Brussels - Belgique

PostPosted: Thu Apr 06, 2017 8:54 am    Post subject: Reply with quote

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
View user's profile Send private message
stanblesk
n00b
n00b


Joined: 06 Apr 2017
Posts: 12
Location: Barnaul, Russia

PostPosted: Thu Apr 06, 2017 8:58 am    Post subject: Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43009
Location: 56N 3W

PostPosted: Thu Apr 06, 2017 10:15 am    Post subject: Reply with quote

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
View user's profile Send private message
188562
Apprentice
Apprentice


Joined: 22 Jun 2008
Posts: 186

PostPosted: Thu Apr 06, 2017 1:51 pm    Post subject: Reply with quote

dev-lang/* =dev-lang/swift-3.0.2 for my build fine. But can not be used. Waiting for any feedback.
Back to top
View user's profile Send private message
stanblesk
n00b
n00b


Joined: 06 Apr 2017
Posts: 12
Location: Barnaul, Russia

PostPosted: Fri Apr 07, 2017 1:52 am    Post subject: Reply with quote

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
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 21675
Location: here

PostPosted: Fri Apr 07, 2017 5:42 am    Post subject: Reply with quote

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
View user's profile Send private message
stanblesk
n00b
n00b


Joined: 06 Apr 2017
Posts: 12
Location: Barnaul, Russia

PostPosted: Fri Apr 07, 2017 9:06 am    Post subject: Reply with quote

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
View user's profile Send private message
188562
Apprentice
Apprentice


Joined: 22 Jun 2008
Posts: 186

PostPosted: Fri Apr 07, 2017 9:27 am    Post subject: Reply with quote

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
View user's profile Send private message
188562
Apprentice
Apprentice


Joined: 22 Jun 2008
Posts: 186

PostPosted: Fri Apr 07, 2017 9:37 am    Post subject: Reply with quote

Restore =dev-lang/swift-3.0.2 and =dev-lang/swift-bin-3.0.2.

The first one does not work. See the error in the message above.
The second one requires some library from ubuntu.
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 21675
Location: here

PostPosted: Fri Apr 07, 2017 11:50 am    Post subject: Reply with quote

@stanblesk: I found this maybe can help
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
188562
Apprentice
Apprentice


Joined: 22 Jun 2008
Posts: 186

PostPosted: Fri Apr 07, 2017 11:55 am    Post subject: Reply with quote

And btw there is a bug #567514
Back to top
View user's profile Send private message
stanblesk
n00b
n00b


Joined: 06 Apr 2017
Posts: 12
Location: Barnaul, Russia

PostPosted: Fri Apr 07, 2017 12:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
188562
Apprentice
Apprentice


Joined: 22 Jun 2008
Posts: 186

PostPosted: Fri Apr 07, 2017 12:40 pm    Post subject: Reply with quote

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 :lol:
Back to top
View user's profile Send private message
188562
Apprentice
Apprentice


Joined: 22 Jun 2008
Posts: 186

PostPosted: Wed Jul 26, 2017 10:59 am    Post subject: Reply with quote

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
View user's profile Send private message
stanblesk
n00b
n00b


Joined: 06 Apr 2017
Posts: 12
Location: Barnaul, Russia

PostPosted: Sun Dec 17, 2017 8:56 am    Post subject: Reply with quote

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
View user's profile Send private message
C5ace
Apprentice
Apprentice


Joined: 23 Dec 2013
Posts: 276
Location: Brisbane, Australia

PostPosted: Sun Dec 17, 2017 9:37 am    Post subject: Reply with quote

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
View user's profile Send private message
stanblesk
n00b
n00b


Joined: 06 Apr 2017
Posts: 12
Location: Barnaul, Russia

PostPosted: Tue Feb 06, 2018 4:49 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum