crystal-lang / distribution-scripts

40 stars 24 forks source link

Alpine Docker image can't build with preview_mt, missing GC patch #58

Closed lbguilherme closed 3 years ago

lbguilherme commented 4 years ago
$ docker run --rm -ti crystallang/crystal:0.33.0-alpine
/ # echo 'puts "hello"' > a.cr
/ # crystal build -Dpreview_mt a.cr
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: G-C-.o: in function `set_stackbottom':
/usr/share/crystal/src/gc/boehm.cr:245: undefined reference to `GC_set_stackbottom'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: G-C-.o: in function `current_thread_stack_bottom':
/usr/share/crystal/src/gc/boehm.cr:236: undefined reference to `GC_get_my_stackbottom'
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o '/a'  -rdynamic  -lpcre -lm /usr/lib/libgc.a -lpthread /usr/share/crystal/src/ext/libcrystal.a -levent_pthreads -levent -lrt -L/usr/bin/../lib/crystal/lib -L/usr/lib -L/usr/local/lib`

The alpine version uses libgc 8.0.4 (latest release), but it doesn't include de needed patch.

See #42 and #47.

straight-shoota commented 4 years ago

I'm aware of this limitation. Relying on the library provided by the package manager is usually the best solution. libgc is expected to get a new release soon and aports packages are usually updated with little delay. preview_mt is still only a preview feature, so it's not necessary to go the extra length to enable it right now when in time we'll have it for free.

However, if somebody wants to add a custom build step to fix this for alpine 3.11 based image, it's probably going to be accepted.

caspiano commented 3 years ago

Closed by #63