Error Running Swift 5.0 REPL on Ubuntu 18.04.2

I've just updated my swift binary to version 5.0 (downloaded from Swift.org - Download Swift).

I ran swift (REPL) and this error pops up:

error: ld-2.27.so 0xffffffff0005c564: adding range [0x1464a-0x146ba) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c564: adding range [0x146d0-0x146d6) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c5c5: adding range [0x1464a-0x146ba) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c5c5: adding range [0x146d0-0x146d6) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
Welcome to Swift version 5.0 (swift-5.0-RELEASE).

The REPL continues just find otherwise.
Any idea what could have happened?

1 Like

There's a similar case for 4.2 as well
([SR-8690] swift REPL error: adding range [0x1464a-0x146ba) which has a base that is less than the function's low PC · Issue #4488 · apple/llvm-project · GitHub).

I'm getting the same error on ubuntu 18.04

sudo apt remove libc6-dbg
1 Like

Moderator note: I'm not sure whether this is a reasonable suggestion for fixing this problem, and I'm antsy about letting potentially dangerous advice stand; if somebody who's more of an expert could weigh in, I'd appreciate it.

3 Likes

Installing libc6-dbg (in a fresh docker container with just swift and dependencies installed) reproduces the issue in the OP, and removing it again resolves it. The package contains libc debug symbols (or versions of libc containing debug symbols? I'm note quite sure: Ubuntu – File list of package libc6-dbg/bionic/amd64), and has some dependant packages, among them valgrind (apt rdepends libc6-dbg), so I wouldn't blanket recommend just removing it without doing some checking (you can pass --installed to apt rdepends to only show installed dependant packages).

3 Likes

This solves this error but I have to re-export the path each time I open the terminal to use the REPL. I there a way to solve this too?

1 Like

Just installed 5.1.3 today and run into the exact same problem.

For what it worth, the libc-6-dbg are a list of libc symbol files. This allows you to step into libc's functions when you run gdb (lldb also - but I'm not sure).

For detail information, you can see the following discussion in stackoverflow:
https://stackoverflow.com/questions/15306090/cant-step-into-string-h-function-with-gdb/15306144#15306144

I will leave my libc-6-dbg package as is for now (just in case I need it later). I'll let you know when I find out more.

I dont think this is a swift bug.

The errors are from LLDB parsing the DWARF debugging information in the debug version of ld.so located at /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.27.so. It has a DWARF entry that is either incorrectly generated by the compiler or not understood by LLDB.

The debug version of ld.so is provided by libc6-dev. Uninstalling the package removes the error since there is no DWARF information in the non-debug version at /lib/x86_64-linux-gnu/ld-2.27.so

Update: I built the master branch on Ubuntu19.10 which uses ld version 2.30 and this issue no longer occurs.

1 Like

No entiendo mucho el inglés, así que te lo contestaré en español. abre una terminal distinta y escribe > "nano .bashrc" sin comillas
ve al final y escribe otra vez el comando para exportar el path "export PATH=/..." lo guardas y en otra terminal distinta escribes "source .bashrc" eso refrescará el bashrc

y ya puedes usarlo sin meterle el PATH cuando abras la terminal cada vez