Skip to content

Build for aarch64 #1

@georglauterbach

Description

@georglauterbach

Would it be possible to cross-compile to x86_64 and aarch64?

This is what I have so far:

VERSION 0.6

FROM docker.io/alpine:3.23

RUN apk add --no-cache \
    curl autoconf gcc flex bison make bash cmake libtool musl-dev g++ \
    zlib-dev zlib-static \
    tcl tk \
    tcl-dev gettext

ARG GIT_VERSION=2.52.0

build-all-platforms:
    BUILD --platform=linux/amd64 +build # --platform=linux/arm64

build:
    ARG TARGETARCH

    RUN curl -ssfL -o "git_v${GIT_VERSION}.tar.gz" \
        "https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz"
    RUN tar xf "git_v${GIT_VERSION}.tar.gz"
    WORKDIR "/git-${GIT_VERSION}"

    RUN make configure && sed -i 's/qversion/-version/g' configure
    RUN ./configure prefix=/dist/git-${GIT_VERSION} LDFLAGS="--static" CFLAGS="${CFLAGS} -O3 -static"
    RUN make -j"$(nproc)" && make install

    SAVE ARTIFACT /dist/git-${GIT_VERSION}/bin/git AS LOCAL ./out/${TARGETARCH}/

I did not get --platform=linux/arm64 to work, though, supposedly because of a bug in gcc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions