j8r
November 29, 2019, 5:31pm
1
Alpine has added xz as a dependency of libxml2.
I added xz-dev to the dependencies (in fact it is installed automatically), but there is still a linking issue: https://github.com/the-benchmarker/web-frameworks/issues/2018
Minimal example to reproduce on Alpine Edge (you can use the jrei/crystal-alpine:edge Docker image):
echo 'require "xml"' > a.cr
crystal build --static a.cr
I think it may be an issue with pkg-config (on the Crystal side or Alpine), because I don’t see any lzma in the cc linking command.
pkg-config libxml-2.0 --libs --static returns -lxml2 -L/lib -lz -llzma -lm
j8r
December 3, 2019, 7:30pm
2
Manually passing --link-flags '-lzma -lxml2' do the trick.
2 Likes
I guess we can add that to the @[Link(...)] thing on our side then, for alpine?
j8r
December 4, 2019, 9:13am
4
There is no way to use pkg-config for this? How do we know we are on Alpine, at Edge, using the official package?
j8r
December 16, 2019, 6:39pm
5
Real future-proof fix to use: crystal build --static --link-flags "$(pkg-config libxml-2.0 --libs --static)" app.cr.
The solution in Crystal would be to use pkg-config too, because dependencies can change.
I don’t suppose this is something that is fixable? Something similar to https://github.com/crystal-lang/crystal/pull/9426 ?
\cc @jhass
I went ahead and did it. Seemed to have fixed the problem.
crystal-lang:master ← Blacksmoke16:pkgconfig-xml2
opened 04:45AM - 06 Jun 20 UTC
3 Likes