Swift Installation Problem on Ubuntu 64-bit 20.04.4

Hello, I followed the instructions to install swift 5.6.1. on Ubuntu 20.04.4. However, when I launch swift, I get these error messages below.

Any idea how to fix this problem?
Thanks in advance
—Max
Welcome to Swift!
Subcommands:
swift build ...
warning: (x86_64) /usr/lib/x86_64-linux-gnu/ld-2.31.so Unable to initialize decompressor for section '.debug_abbrev': zlib is not available
warning: (x86_64) /usr/lib/x86_64-linux-gnu/ld-2.31.so Unable to initialize decompressor for section '.debug_info': zlib is not available
warning: (x86_64) /usr/lib/x86_64-linux-gnu/ld-2.31.so Unable to initialize decompressor for section '.debug_aranges': zlib is not available
warning: (x86_64) /lib64/ld-linux-x86-64.so.2 Unable to initialize decompressor for section '.debug_abbrev': zlib is not available
warning: (x86_64) /lib64/ld-linux-x86-64.so.2 Unable to initialize decompressor for section '.debug_info': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libdl.so.2 Unable to initialize decompressor for section '.debug_abbrev': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libdl.so.2 Unable to initialize decompressor for section '.debug_info': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libc.so.6 Unable to initialize decompressor for section '.debug_abbrev': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libc.so.6 Unable to initialize decompressor for section '.debug_info': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libc.so.6 Unable to initialize decompressor for section '.debug_aranges': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libm.so.6 Unable to initialize decompressor for section '.debug_abbrev': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libm.so.6 Unable to initialize decompressor for section '.debug_info': zlib is not available
Welcome to Swift version 5.6.1 (swift-5.6.1-RELEASE).
Type :help for assistance.

Have you installed all the dependencies required by Swift, specifically zlib1g-dev?

Thanks Tim, yes I thought I had, but I had obviously screwed up somewhere...
I have restarted again from the beginning (reinstall VMWare - then Ubuntu 20 - then apt-get - then swift) (4th time!) and now I don't get these errors. Sorry for the inconvenience.

Glad it's working! Simplifying the installation steps is something that's actively being worked on, so it should become a single command that does everything for you

Sorry I wrote too fast. I tried again to reinstall Ubuntu 20.04 / swift on my macbook and I keep getting the same error messages (... zlib is not available)

Note that when installing Ubuntu 20.04, it upgrades to 20.04.4

I did install all the dependencies copied/pasted from the "Getting Started', including zlib1g-dev

sudo apt-get install
binutils
git
gnupg2
libc6-dev
libcurl4
libedit2
libgcc-9-dev
libpython2.7
libsqlite3-0
libstdc++-9-dev
libxml2
libz3-dev
pkg-config
tzdata
uuid-dev
zlib1g-dev

the swift directory is stored in /usr/share; My path is:

/usr/share/swift/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Maybe there is a problem with Ubuntu 20.04.4 (vs. 20.04) ?
Maybe an incompatibility with the keyboard-configuration utility I had to install first thing to be able to use my French Apple keyboard?
Maybe there is a directory somewhere that has not all the rights for simple users (I used "sudo su" before installing everything) ?

Any other idea?
Thanks in advance

@silberz , another option is to use the Swift Community Apt Repository.
It is really easy to setup and fully supports Ubuntu 20.04.4.

Thanks for your patience! I recreated a VMWare virtual machine with ubuntu-20.04.4-desktop-amd64.iso

I followed the three easy steps mentioned at https://www.swiftlang.xyz/ :
sudo apt install -y curl
curl -s https://archive.swiftlang.xyz/install.sh | sudo bash
sudo apt install swiftlang

Everything went smoothly (no error message), I chose option 1 (install latest swift stable version), but then, when I ran swift, I got the same exact warning messages, see screenshot attached. I rebooted a couple times, and I tried to run swift as a regular user, and also as root (see screenshot), but this does not change anything. It looks like zlib is not available, however I can see that zlib1g-dev and zlib1g are indeed installed, see:

apt list --installed | fgrep zlib

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
zlib1g-dev/focal-updates,focal-security,now 1:1.2.11.dfsg-2ubuntu1.3 amd64 [installed,automatic]
zlib1g/focal-updates,focal-security,now 1:1.2.11.dfsg-2ubuntu1.3 amd64 [installed,automatic]

Can you list in detail everything you install during setup of the VM before you install Swift? Also have you tried a different Ubuntu version?
Thanks.

I run VMWare Fusion on my macbook pro:

File > New... then I drag in ubuntu-20.04.4-desktop-amd64.iso
Virtual Machine > Settings: I set Hard disk = 100GB, RAM = 32GB, 16 Core

After the installation is complete, I run a terminal, then I run each of the three lines, one after another one (no error message):

sudo apt install -y curl
curl -s https://archive.swiftlang.xyz/install.sh | sudo bash
sudo apt install swiftlang

then I enter: swift and I get:

Swift version 5.6.1 (swift-5.6.1-RELEASE)
Target: x86_64-unknown-linux-gnu

Welcome to Swift!

Subcommands:

swift build Build Swift packages
swift package Create and work on packages
swift run Run a program from a package
swift test Run package tests
swift repl Experiment with Swift code interactively (default)

Use swift --help for descriptions of available options and flags.

Use swift help <subcommand> for more information about a subcommand.

warning: (x86_64) /usr/lib/x86_64-linux-gnu/ld-2.31.so Unable to initialize decompressor for section '.debug_abbrev': zlib is not available
warning: (x86_64) /usr/lib/x86_64-linux-gnu/ld-2.31.so Unable to initialize decompressor for section '.debug_info': zlib is not available
warning: (x86_64) /usr/lib/x86_64-linux-gnu/ld-2.31.so Unable to initialize decompressor for section '.debug_aranges': zlib is not available
warning: (x86_64) /lib64/ld-linux-x86-64.so.2 Unable to initialize decompressor for section '.debug_abbrev': zlib is not available
warning: (x86_64) /lib64/ld-linux-x86-64.so.2 Unable to initialize decompressor for section '.debug_info': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libdl.so.2 Unable to initialize decompressor for section '.debug_abbrev': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libdl.so.2 Unable to initialize decompressor for section '.debug_info': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libc.so.6 Unable to initialize decompressor for section '.debug_abbrev': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libc.so.6 Unable to initialize decompressor for section '.debug_info': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libc.so.6 Unable to initialize decompressor for section '.debug_aranges': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libm.so.6 Unable to initialize decompressor for section '.debug_abbrev': zlib is not available
warning: (x86_64) /lib/x86_64-linux-gnu/libm.so.6 Unable to initialize decompressor for section '.debug_info': zlib is not available
Welcome to Swift version 5.6.1 (swift-5.6.1-RELEASE).
Type :help for assistance.
1>

@silberz I have duplicated your setup with VMware and after installing Swift I get the same zlib is not available warnings. I haven't seen this error before and it only seems to occur in the desktop version when using VMware.
I installed the server image ubuntu-20.04.4-live-server-amd64.iso in VMware and there where no problems. I will do some more testing tomorrow.

1 Like

Thanks Neil,
indeed swift runs fine on ubuntu server.
—Max

@silberz @futurejones
The problem can be solved by uninstalling the libc6-dbg package:
sudo apt remove libc6-dbg
The same problem exist in swift 5.7.

1 Like

Thanks!
that solved it for me under Ubuntu 20.04.05 desktop and Swift 5.6-dev

Likewise, removing libc6-dbg solved it for me
(after much unnecessary hair-removal).