Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN apk add --no-cache \
# Statically-compiled llvm
llvm15-dev llvm15-static \
# Static stdlib dependencies
zlib-static yaml-static libxml2-static pcre2-dev libevent-static \
gc-dev zlib-static yaml-static libxml2-static pcre2-dev libevent-static \
# Static compiler dependencies
libffi-dev \
# Build tools
Expand All @@ -34,20 +34,12 @@ RUN apk add --no-cache \
ARG release
ENV CFLAGS="-fPIC -pipe ${release:+-O2}"

# Build libgc (again, this time for musl)
ARG gc_version
RUN git clone https://github.com/ivmai/bdwgc \
&& cd bdwgc \
&& git checkout ${gc_version} \
\
&& ./autogen.sh \
&& ./configure --disable-debug --disable-shared --enable-large-config \
&& make -j$(nproc) CFLAGS=-DNO_GETCONTEXT

# This overrides default CRYSTAL_LIBRARY_PATH baked into the binary (starting with 1.2.0)
# or configured via wrapper script (before 1.2.0) because we want to link against
# the newly-built libraries, not the ones shipped with the bootstrap compiler.
ENV CRYSTAL_LIBRARY_PATH=/bdwgc/.libs/
# the regularly installed libraries, not the ones shipped with the bootstrap compiler.
# This particularly affects libgc which was bundled upto Crystal 1.12
ENV CRYSTAL_LIBRARY_PATH=""

Comment on lines 37 to +42
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make more sense to simply remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using a bootstrap compiler which ships a bundled libgc.a in its CRYSTAL_LIBRARY_PATH. It's necessary to explicitly override the path to use the system library instead.
Otherwise the build would fail because the bundled library is built against glibc but we're linking musl.

RUN llvm-config --version

ARG previous_crystal_release
Expand Down