crystal-lang / distribution-scripts

40 stars 23 forks source link

Build fails on latest Crystal nightly image #157

Closed Blacksmoke16 closed 2 years ago

Blacksmoke16 commented 2 years ago

docker run --rm crystallang/crystal:nightly-alpine crystal eval 'puts "foo"'

Produces:

/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/bin/../lib/crystal/libgc.a(pthread_support.o): in function `GC_thr_init':
pthread_support.c:(.text+0xe39): undefined reference to `gnu_get_libc_version'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/bin/../lib/crystal/libgc.a(mach_dep.o): in function `GC_with_callee_saves_pushed':
mach_dep.c:(.text+0x3b): undefined reference to `getcontext'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/bin/../lib/crystal/libgc.a(pthread_start.o): in function `GC_inner_start_routine':
pthread_start.c:(.text+0x44): undefined reference to `__pthread_register_cancel'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: pthread_start.c:(.text+0x6b): undefined reference to `__pthread_unregister_cancel'
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o /root/.cache/crystal/crystal-run-eval.tmp  -rdynamic -L/usr/bin/../lib/crystal -lpcre -lm -lgc -lpthread -levent -lrt`

First noticed via https://github.com/Blacksmoke16/oq/runs/3875659755?check_suite_focus=true.

straight-shoota commented 2 years ago

Ah, that's caused by the new folder structure of make install. The new lib directory is not excluded in the dockerfile and thus the libgc from the tarball gets into the image. It has a higher precedence than the one specifically built for musl libc. Removing the libgc.a mentioned in the error should be sufficient to fix this.