dom96 / choosenim

Tool for easily installing and managing multiple versions of the Nim programming language.
BSD 3-Clause "New" or "Revised" License
680 stars 64 forks source link

choosenim does not work on Linux with musl #216

Closed refacto closed 4 years ago

refacto commented 4 years ago

As in the title, trying to run curl https://nim-lang.org/choosenim/init.sh -sSf | sh on a musl based Linux distro results in:

choosenim-init: Downloading choosenim-0.6.0_linux_amd64
sh: /tmp/choosenim-0.6.0_linux_amd64: not found

This is because choosenim is linked against glibc:

thermi:~$ ldd /tmp/choosenim-0.6.0_linux_amd64 
        /lib64/ld-linux-x86-64.so.2 (0x7fc250e12000)
        librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7fc250e12000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fc250e12000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fc250e12000)
Error relocating /tmp/choosenim-0.6.0_linux_amd64: __fdelt_chk: symbol not found
Error relocating /tmp/choosenim-0.6.0_linux_amd64: __poll_chk: symbol not found
Error relocating /tmp/choosenim-0.6.0_linux_amd64: __strdup: symbol not found
Error relocating /tmp/choosenim-0.6.0_linux_amd64: __memcpy_chk: symbol not found
Error relocating /tmp/choosenim-0.6.0_linux_amd64: gnu_dev_major: symbol not found
Error relocating /tmp/choosenim-0.6.0_linux_amd64: __longjmp_chk: symbol not found
Error relocating /tmp/choosenim-0.6.0_linux_amd64: gnu_dev_minor: symbol not found
Error relocating /tmp/choosenim-0.6.0_linux_amd64: __fprintf_chk: symbol not found
Error relocating /tmp/choosenim-0.6.0_linux_amd64: gnu_dev_makedev: symbol not found
Error relocating /tmp/choosenim-0.6.0_linux_amd64: __sprintf_chk: symbol not found
refacto commented 4 years ago

Tested with Alpine Linux edge, updated on 2020-08-31.

dom96 commented 4 years ago

Ouch. Guess we need to statically link with glibc and/or musl.

dom96 commented 4 years ago

So, musl isn't working because libarchive cannot work with it:

/home/dom/.cache/nim/nimterop/nimarchive/libarchive/LibArchive/lib/libarchive.a(archive_entry.o): In function `archive_entry_devmajor':
        ... /workspace/srcdir/libarchive/libarchive/archive_entry.c:344: undefined reference to `gnu_dev_major'

It's the error I got when I tried to compile with musl-gcc which is the same error you are seeing.

refacto commented 4 years ago

That's good, choosenim now works, but it installs an incompatible nim:

thermi:~$ ldd ./.nimble/bin/nim
        /lib64/ld-linux-x86-64.so.2 (0x7fdf85ddc000)
        librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7fdf85ddc000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fdf85ddc000)
Error relocating ./.nimble/bin/nim: __memcpy_chk: symbol not found
Error relocating ./.nimble/bin/nim: __longjmp_chk: symbol not found
genotrance commented 4 years ago

Looks like I missed compiling the proxyexe files with musl.

inv2004 commented 3 years ago

The same problem like @refacto to up the problem