odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.17k stars 550 forks source link

Ubuntu nightly binary has dynamic dependency on `libedit.so.2`, no install instructions for it #2271

Open GavinRay97 opened 1 year ago

GavinRay97 commented 1 year ago

I downloaded the nightly distribution of the Ubuntu binary and tried to run it, and got a missing library issue:

[user@MSI ~]$ odin -v
odin: error while loading shared libraries: libedit.so.2: cannot open shared object file: No such file or directory

Running ldd shows:

[user@MSI odin-ubuntu-amd64-nightly+2022-12-20]$ ldd odin
./odin: /lib64/libtinfo.so.6: no version information available (required by /home/user/odin/odin-ubuntu-amd64-nightly+2022-12-20/./libLLVM-11.so.1)
        linux-vdso.so.1 (0x00007ffe6c910000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f904a520000)
        libstdc++.so.6 => /usr/local/gcc-13.0.0-dev/lib64/libstdc++.so.6 (0x00007f904a200000)
        libLLVM-11.so.1 => /home/user/odin/odin-ubuntu-amd64-nightly+2022-12-20/./libLLVM-11.so.1 (0x00007f9045000000)
        libgcc_s.so.1 => /usr/local/gcc-13.0.0-dev/lib64/libgcc_s.so.1 (0x00007f904a90b000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f904a021000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f904a93c000)
        libffi.so.8 => /lib64/libffi.so.8 (0x00007f904a8fd000)
        libedit.so.2 => not found                                     <--------------
        libz.so.1 => /lib64/libz.so.1 (0x00007f904a8e3000)
        libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f904a4ed000)
        libxml2.so.2 => /lib64/libxml2.so.2 (0x00007f9044e94000)
        liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f904a8b6000)

Unfortunately, it seems like on the latest Fedora distros, only V3 of this libedit package is present:

[user@MSI odin-ubuntu-amd64-nightly+2022-12-20]$ yum whatprovides libedit

libedit-3.1-43.20221009cvs.fc38.x86_64 : The NetBSD Editline library
Repo        : @System
Provide    : libedit = 3.1-43.20221009cvs.fc38

libedit-3.1-43.20221009cvs.fc38.x86_64 : The NetBSD Editline library
Repo        : rawhide
Provide    : libedit = 3.1-43.20221009cvs.fc38
[user@MSI odin-ubuntu-amd64-nightly+2022-12-20]$ dnf repoquery -l libedit
<SNIPPED>
/usr/lib64/libedit.so.0
/usr/lib64/libedit.so.0.0.70
....
/usr/lib/libedit.so.0
/usr/lib/libedit.so.0.0.70
...
/usr/share/man/man5/editrc.5.gz

Adding a symlink seems to fix it, but that feels shaky:

[user@MSI odin-ubuntu-amd64-nightly+2022-12-20]$ sudo ln -s /lib64/libedit.so.0 /lib64/libedit.so.2
[user@MSI odin-ubuntu-amd64-nightly+2022-12-20]$ odin
odin: /lib64/libtinfo.so.6: no version information available (required by /home/user/odin/odin-ubuntu-amd64-nightly+2022-12-20/libLLVM-11.so.1)
odin is a tool for managing Odin source code
Usage:
        odin command [arguments]
Commands:
        build             compile directory of .odin files, as an executable.
                          one must contain the program's entry point, all must be in the same package.
        run               same as 'build', but also then runs the newly compiled executable.
        check             parse, and type check a directory of .odin files
        query             parse, type check, and output a .json file containing information about the program
        strip-semicolon   parse, type check, and remove unneeded semicolons from the entire program
        test              build and runs procedures with the attribute @(test) in the initial package
        doc               generate documentation on a directory of .odin files
        version           print version
        report            print information useful to reporting a bug
Yawning commented 8 months ago

For posterity, this is a Debian + derivatives issue stemming from this patch: https://salsa.debian.org/debian/libedit/-/blob/master/debian/patches/update-soname.diff

Yawning commented 4 months ago
$ patchelf --replace-needed libedit.so.2 libedit.so.0 libLLVM-14.so.1

Alters the copy of LLVM shipped along side releases to look for the correctly named libedit, instead of the Debian stupidity.