Ubuntu required dependencies for Swift

On Ubuntu 16.04, the required dependencies listed on this page, i.e.

$ sudo apt-get install clang libicu-dev

don't seem to be enough.

E.g.

vagrant@ubuntu-xenial:~$ swift-4.1-RELEASE-ubuntu16.04/usr/bin/swift
/home/vagrant/swift-4.1-RELEASE-ubuntu16.04/usr/bin/lldb: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

vagrant@ubuntu-xenial:~$ swift-4.1-RELEASE-ubuntu16.04/usr/bin/swift test
/home/vagrant/swift-4.1-RELEASE-ubuntu16.04/usr/bin/swift-test: error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory

Tested with this vagrant box.

Can the list of required dependencies be updated with whatever is necessary? These kinds of issues are major stumbling blocks for people wanting to use Swift on Linux.

3 Likes

The extra packages you need are libcurl4-openssl-dev and libpython2.7.

Libcurl is needed by Foundation. It seems that the REPL needs Libpython, I don't know why.

1 Like

Thanks! It would be useful to add that to the documentation.

Also: Foundation can't be imported in the REPL by default. For that to work, it has to be called with

swift -I path/to/swift/usr/lib/swift/clang/include/

This is also probably worth mentioning, until it is fixed.

@tkremenek posted recently about opening up the website to contributions so hopefully we'll be able to fix things like this soon!

1 Like

To confirm, change the instructions to this:

$ sudo apt-get install clang libicu-dev libcurl4-openssl-dev libpython2.7
1 Like

I have installed Swift according to Swift.org - Download Swift including libpython2.7.
When I run the command swift I get the error message:
/usr/share/swift/usr/bin/lldb: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

How do I fix this?

You need Python 3.7, not 2.7, according to the lldb message.

Thanks, I installed python3.7 and python3.7-dev and now it works!

Terms of Service

Privacy Policy

Cookie Policy