roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
4.41k stars 309 forks source link

Docker hub Alpine image #6058

Open khalyomede opened 11 months ago

khalyomede commented 11 months ago

This issue follows https://github.com/roc-lang/roc/issues/6045, which was supposed to add an Alpine Linux Docker image.

The attempt has failed in https://github.com/roc-lang/roc/pull/6047 and a complete breakdown of the reason is available https://github.com/roc-lang/roc/pull/6047#issuecomment-1821853206.

The main issue is about Roc being currently built using dynamic libraries that are not available on Alpine (it seems):

$ ldd roc 
        /lib64/ld-linux-x86-64.so.2 (0x7fe37268f000)
        librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7fe37268f000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fe37268f000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fe37268f000)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fe37268f000)
        libz.so.1 => /lib/libz.so.1 (0x7fe36e264000)
Error loading shared library libtinfo.so.6: No such file or directory (needed by roc)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7fe36e016000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fe36dff8000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fe37268f000)
        ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x7fe36dff2000)
Error relocating roc: mallinfo: symbol not found
Error relocating roc: del_curterm: symbol not found
Error relocating roc: setupterm: symbol not found
Error relocating roc: __memcpy_chk: symbol not found
Error relocating roc: set_curterm: symbol not found
Error relocating roc: __register_atfork: symbol not found
Error relocating roc: tigetnum: symbol not found
Error relocating roc: __snprintf_chk: symbol not found
Error relocating roc: gnu_get_libc_version: symbol not found
Error relocating roc: __res_init: symbol not found

If anybody having knowledge on low level C-compilation could help unfold this it would be great!

aminnairi commented 11 months ago

It looks like the roc executable is relying on a shared library called libtinfo which does not seem to exist (yet) in the Alpine packages, but does exist under the libtinfo-dev package in Ubuntu.

It's safe to say that using Roc on Alpine is not trivial at all and will require some work to support this operating system for containers.

Notice that using Roc in Ubuntu (and Debian, and pretty much any non-libmusl-based distribution), whether it is on a bare-metal or a container does work as expected.

Anton-4 commented 11 months ago

I've been working on building roc with llvm built with musl, but it's a difficult process. Once that's done the problems with alpine should be gone.