Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building in Docker fails for 0.36.0 Alpine image #10313

Closed
marghidanu opened this issue Jan 27, 2021 · 3 comments · Fixed by crystal-lang/distribution-scripts#79
Closed

Building in Docker fails for 0.36.0 Alpine image #10313

marghidanu opened this issue Jan 27, 2021 · 3 comments · Fixed by crystal-lang/distribution-scripts#79

Comments

@marghidanu
Copy link

marghidanu commented Jan 27, 2021

Trying to perform a static build using the crystallang/crystal:0.36.0-alpine docker image. The compilation fails with the following message:

> shards build --release --no-debug --static
Dependencies are satisfied
Building: werk
Error target werk failed to compile:
/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lyaml (this usually means you need to install the development package for libyaml)
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o /opt/app/bin/werk  -rdynamic -static -L/usr/bin/../lib/crystal/lib -lyaml  -lpcre -lm -lgc -lpthread /usr/share/crystal/src/ext/libcrystal.a -levent -lrt`

The yaml and yaml-dev packages are both installed, and the $HOME/.cache directory was also removed. One thing to mention is that this path "-L/usr/bin/../lib/crystal/lib" which should resolve to /usr/lib/crystal/lib does not exist.

Relevant info:
Docker image: crystallang/crystal:0.36.0-alpine
Crystal 0.36.0 [1e6f96a] (2021-01-26)
LLVM: 10.0.0
Default target: x86_64-unknown-linux-musl

@straight-shoota
Copy link
Member

straight-shoota commented Jan 27, 2021

Works for me: Nevermind, it's not --static

$ docker run --rm -it crystallang/crystal:0.36.0-alpine crystal eval 'require "yaml"; puts YAML.parse %("foo")'
foo

@straight-shoota
Copy link
Member

It seems the static libs were extracted to yaml-static in alpine 3.12. So we should add that as a dependency in the Dockerfile.

@bcardiff
Copy link
Member

FYI, All alpine docker images of 0.36.0 have just been republished with 3.13 and yaml-static.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants