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

Fix building mimalloc on armv6 #2397

Merged
merged 1 commit into from
Mar 27, 2022
Merged
Show file tree
Hide file tree
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
9 changes: 4 additions & 5 deletions docker/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,9 @@ RUN {{ mount_rust_cache -}} mkdir -pv "${CARGO_HOME}" \
&& rustup set profile minimal

{% if "alpine" in target_file %}
ENV RUSTFLAGS='-C link-arg=-s'
{% if "armv7" in target_file %}
{#- https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html -#}
ENV CFLAGS_armv7_unknown_linux_musleabihf="-mfpu=vfpv3-d16"
{% if "armv6" in target_file %}
# To be able to build the armv6 image with mimalloc we need to specifically specify the libatomic.a file location
ENV RUSTFLAGS='-Clink-arg=/usr/local/musl/{{ package_arch_target }}/lib/libatomic.a'
{% endif %}
{% elif "arm" in target_file %}
#
Expand Down Expand Up @@ -163,7 +162,7 @@ RUN {{ mount_rust_cache -}} rustup target add {{ package_arch_target }}
{% endif %}

# Configure the DB ARG as late as possible to not invalidate the cached layers above
{% if "alpine" in target_file and "amd64" in target_file %}
{% if "alpine" in target_file %}
# Enable MiMalloc to improve performance on Alpine builds
ARG DB=sqlite,mysql,postgresql,enable_mimalloc
{% else %}
Expand Down
1 change: 0 additions & 1 deletion docker/amd64/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ ENV DEBIAN_FRONTEND=noninteractive \
RUN mkdir -pv "${CARGO_HOME}" \
&& rustup set profile minimal

ENV RUSTFLAGS='-C link-arg=-s'

# Creates a dummy project used to grab dependencies
RUN USER=root cargo new --bin /app
Expand Down
1 change: 0 additions & 1 deletion docker/amd64/Dockerfile.buildx.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ ENV DEBIAN_FRONTEND=noninteractive \
RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry mkdir -pv "${CARGO_HOME}" \
&& rustup set profile minimal

ENV RUSTFLAGS='-C link-arg=-s'

# Creates a dummy project used to grab dependencies
RUN USER=root cargo new --bin /app
Expand Down
4 changes: 2 additions & 2 deletions docker/arm64/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ ENV DEBIAN_FRONTEND=noninteractive \
RUN mkdir -pv "${CARGO_HOME}" \
&& rustup set profile minimal

ENV RUSTFLAGS='-C link-arg=-s'

# Creates a dummy project used to grab dependencies
RUN USER=root cargo new --bin /app
Expand All @@ -58,7 +57,8 @@ COPY ./build.rs ./build.rs
RUN rustup target add aarch64-unknown-linux-musl

# Configure the DB ARG as late as possible to not invalidate the cached layers above
ARG DB=sqlite,mysql,postgresql
# Enable MiMalloc to improve performance on Alpine builds
ARG DB=sqlite,mysql,postgresql,enable_mimalloc

# Builds your dependencies and removes the
# dummy project, except the target folder
Expand Down
4 changes: 2 additions & 2 deletions docker/arm64/Dockerfile.buildx.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ ENV DEBIAN_FRONTEND=noninteractive \
RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry mkdir -pv "${CARGO_HOME}" \
&& rustup set profile minimal

ENV RUSTFLAGS='-C link-arg=-s'

# Creates a dummy project used to grab dependencies
RUN USER=root cargo new --bin /app
Expand All @@ -58,7 +57,8 @@ COPY ./build.rs ./build.rs
RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry rustup target add aarch64-unknown-linux-musl

# Configure the DB ARG as late as possible to not invalidate the cached layers above
ARG DB=sqlite,mysql,postgresql
# Enable MiMalloc to improve performance on Alpine builds
ARG DB=sqlite,mysql,postgresql,enable_mimalloc

# Builds your dependencies and removes the
# dummy project, except the target folder
Expand Down
6 changes: 4 additions & 2 deletions docker/armv6/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ ENV DEBIAN_FRONTEND=noninteractive \
RUN mkdir -pv "${CARGO_HOME}" \
&& rustup set profile minimal

ENV RUSTFLAGS='-C link-arg=-s'
# To be able to build the armv6 image with mimalloc we need to specifically specify the libatomic.a file location
ENV RUSTFLAGS='-Clink-arg=/usr/local/musl/arm-unknown-linux-musleabi/lib/libatomic.a'

# Creates a dummy project used to grab dependencies
RUN USER=root cargo new --bin /app
Expand All @@ -58,7 +59,8 @@ COPY ./build.rs ./build.rs
RUN rustup target add arm-unknown-linux-musleabi

# Configure the DB ARG as late as possible to not invalidate the cached layers above
ARG DB=sqlite,mysql,postgresql
# Enable MiMalloc to improve performance on Alpine builds
ARG DB=sqlite,mysql,postgresql,enable_mimalloc

# Builds your dependencies and removes the
# dummy project, except the target folder
Expand Down
6 changes: 4 additions & 2 deletions docker/armv6/Dockerfile.buildx.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ ENV DEBIAN_FRONTEND=noninteractive \
RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry mkdir -pv "${CARGO_HOME}" \
&& rustup set profile minimal

ENV RUSTFLAGS='-C link-arg=-s'
# To be able to build the armv6 image with mimalloc we need to specifically specify the libatomic.a file location
ENV RUSTFLAGS='-Clink-arg=/usr/local/musl/arm-unknown-linux-musleabi/lib/libatomic.a'

# Creates a dummy project used to grab dependencies
RUN USER=root cargo new --bin /app
Expand All @@ -58,7 +59,8 @@ COPY ./build.rs ./build.rs
RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry rustup target add arm-unknown-linux-musleabi

# Configure the DB ARG as late as possible to not invalidate the cached layers above
ARG DB=sqlite,mysql,postgresql
# Enable MiMalloc to improve performance on Alpine builds
ARG DB=sqlite,mysql,postgresql,enable_mimalloc

# Builds your dependencies and removes the
# dummy project, except the target folder
Expand Down
5 changes: 2 additions & 3 deletions docker/armv7/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ ENV DEBIAN_FRONTEND=noninteractive \
RUN mkdir -pv "${CARGO_HOME}" \
&& rustup set profile minimal

ENV RUSTFLAGS='-C link-arg=-s'
ENV CFLAGS_armv7_unknown_linux_musleabihf="-mfpu=vfpv3-d16"

# Creates a dummy project used to grab dependencies
RUN USER=root cargo new --bin /app
Expand All @@ -59,7 +57,8 @@ COPY ./build.rs ./build.rs
RUN rustup target add armv7-unknown-linux-musleabihf

# Configure the DB ARG as late as possible to not invalidate the cached layers above
ARG DB=sqlite,mysql,postgresql
# Enable MiMalloc to improve performance on Alpine builds
ARG DB=sqlite,mysql,postgresql,enable_mimalloc

# Builds your dependencies and removes the
# dummy project, except the target folder
Expand Down
5 changes: 2 additions & 3 deletions docker/armv7/Dockerfile.buildx.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ ENV DEBIAN_FRONTEND=noninteractive \
RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry mkdir -pv "${CARGO_HOME}" \
&& rustup set profile minimal

ENV RUSTFLAGS='-C link-arg=-s'
ENV CFLAGS_armv7_unknown_linux_musleabihf="-mfpu=vfpv3-d16"

# Creates a dummy project used to grab dependencies
RUN USER=root cargo new --bin /app
Expand All @@ -59,7 +57,8 @@ COPY ./build.rs ./build.rs
RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry rustup target add armv7-unknown-linux-musleabihf

# Configure the DB ARG as late as possible to not invalidate the cached layers above
ARG DB=sqlite,mysql,postgresql
# Enable MiMalloc to improve performance on Alpine builds
ARG DB=sqlite,mysql,postgresql,enable_mimalloc

# Builds your dependencies and removes the
# dummy project, except the target folder
Expand Down