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

crystal:0.36.1-alpine missing yaml-static #84

Closed
kimburgess opened this issue Mar 16, 2021 · 7 comments
Closed

crystal:0.36.1-alpine missing yaml-static #84

kimburgess opened this issue Mar 16, 2021 · 7 comments
Assignees

Comments

@kimburgess
Copy link

kimburgess commented Mar 16, 2021

A new Alpine image for 0.36.1 made it's way to docker hub last night. This is unable to statically compile crystal programs that use YAML.

Reduced example: https://gist.github.com/kimburgess/2a740af0f2c8bc5b217a9fa47638df0e.

Cause appears to be bdff883

Build output:

Sending build context to Docker daemon  3.072kB
Step 1/3 : FROM crystallang/crystal@sha256:ee97e1ef8b609cd80a8d504fdf8c5c09f7ac2fc520d360a7b10c8d50aa21f4b2
 ---> 32474966bd9f
Step 2/3 : COPY . .
 ---> 7e65d2efd8e7
Step 3/3 : RUN crystal build --static --error-trace yaml.cr
 ---> Running in cffb373d5aed
/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 /yaml  -rdynamic -static -L/usr/bin/../lib/crystal/lib -lyaml  -lpcre -lm -lgc -lpthread /usr/share/crystal/src/ext/libcrystal.a -levent -lrt`
The command '/bin/sh -c crystal build --static --error-trace yaml.cr' returned a non-zero code: 1
@straight-shoota
Copy link
Member

Hm, the new images should be based on alpine 3.12 and not include that commit.

ref crystal-lang/crystal#10366 (comment)

@Blacksmoke16
Copy link
Member

Related?: #63 (comment).

@bcardiff
Copy link
Member

libyaml it's not missing. In that docker image you can see that

# pkg-config yaml-0.1 --libs
-lyaml 

But the static libyaml is not there which seems to be what you want.

# apk add --update yaml-static

After that your program will link with --static.

The 3.13 image does have yaml-static, but that was a new addition.

@maiha
Copy link

maiha commented Mar 16, 2021

In the current image, it seems the repository is still 3.12. Is this the cause?

$ docker run --rm -it crystallang/crystal:0.36.1-alpine cat /etc/apk/repositories
http://dl-cdn.alpinelinux.org/alpine/v3.12/main
http://dl-cdn.alpinelinux.org/alpine/v3.12/community

$ docker images | grep 0.36.1-alpine
crystallang/crystal            0.36.1-alpine         32474966bd9f   3 days ago      314MB

@bcardiff
Copy link
Member

@maiha the images were reverted to 3.12 for the CI as explained in crystal-lang/crystal#10366 (comment) . The issue on that image the lack of yaml-static which I think is optional and as any library can be tweaked by the user.

@kimburgess kimburgess changed the title crystal:0.36.1-alpine missing libyaml crystal:0.36.1-alpine missing yaml-static Mar 16, 2021
@kimburgess
Copy link
Author

Easy enough to workaround downstream for now. Given it was available previously and is needed running a static build using only std lib components, is it worth reintroducing it to the 3.12 based image?

@straight-shoota
Copy link
Member

Closing. The latest docker images all contain 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
Development

No branches or pull requests

5 participants