mun-lang / mun

Source code for the Mun language and runtime.
https://mun-lang.org
Other
1.87k stars 73 forks source link

Missing library `libtinfo.so.5` on Arch Linux #191

Open Aloso opened 4 years ago

Aloso commented 4 years ago

I downloaded the pre-built binary, followed the tutorial and executed mun build hello_fibonacci.mun. I got this error:

mun: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

It seems like I don't have the file libtinfo.so.5:

❯ ls -l /usr/lib | grep libtinfo
-rw-r--r--   1 root root        24 13. Feb 09:08 libtinfo.so
lrwxrwxrwx   1 root root        16 13. Feb 09:08 libtinfo.so.6 -> libncursesw.so.6
Click here to see my system information ```sh ❯ screenfetch ██████████████████ ████████ ludwig@ludwig-pc ██████████████████ ████████ OS: Manjaro 20.0.1 Lysia ██████████████████ ████████ Kernel: x86_64 Linux 5.6.11-1-MANJARO ██████████████████ ████████ Uptime: 2h 29m ████████ ████████ Packages: 1689 ████████ ████████ ████████ Shell: nu ████████ ████████ ████████ Resolution: 3200x900 ████████ ████████ ████████ DE: KDE 5.69.0 / Plasma 5.18.5 ████████ ████████ ████████ WM: KWin ████████ ████████ ████████ GTK Theme: Material-Black-Blueberry [GTK2/3] ████████ ████████ ████████ Icon Theme: breeze-dark ████████ ████████ ████████ Disk: 525G / 1,1T (54%) ████████ ████████ ████████ CPU: AMD A8-7600 Radeon R7, 10 Compute Cores 4C+6G @ 4x 3.1GHz ████████ ████████ ████████ GPU: AMD KAVERI (DRM 2.50.0, 5.6.11-1-MANJARO, LLVM 10.0.0) RAM: 4871MiB / 14925MiB ```

P.S. To see if there are other libraries missing, I copied libtinfo.so.6 to libtinfo.so.5. This produces another error:

mun: error while loading shared libraries: libffi.so.6: cannot open shared object file: No such file or directory

I have libffi.so.7.1.0 installed, but not libffi.so.6.


P.P.S I solved the problem by installing the following AUR packages:

Wodann commented 4 years ago

Thank you for reporting this. I'll have a look to see whether this can somehow be circumvented. Otherwise, we'll need to add some additional install instructions for affected distros.

tillarnold commented 4 years ago

For reference for other that might encounter this issue on fedora: I had a similar issue on fedora 32. Trying to compile a mun file with mun build file.mun results in an error. This can be fixed by installing ncurses-compat-libs. This fixes the problem and mun build appears to create working munlib files however the message mun: /lib64/libtinfo.so.5: no version information available (required by mun) is shown every time mun build is ran.

baszalmstra commented 3 years ago

Some updates on this issue. In the last couple of months, we have been trying to build a completely standalone version of the Mun binary. We've gotten quite far but unfortunately not far enough. To do this I created a Dockerfile that from an alpine environment creates an image with a custom build version of LLVM that contains some flag that force it not to link to some dynamic libraries that we don't need. The pre-build packages for several distributions all do NOT include these flags so they all by default link to several dynamic libraries.

In the cmake invocation we pass the flags:

-DLLVM_ENABLE_LIBXML2=OFF
-DLLVM_ENABLE_TERMINFO=OFF

This disables linking to ncurses and some more libraries. We also don't pass any flags related to libffi which disables the LLVM interpreter to call external functions, but we don't use that anyway and it removes the dependency on libffi.

This almost solves our issue except that Inkwell requires linking to libffi. I created a PR that allows us to bypass this but we still need a new release of Inkwell so that we can actually use that.

Once all of that is done, we need to create and upload the docker image to build Mun with and use that in our CI pipeline.