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

Linux arm 64 support #417

Open
johnzuk opened this issue Feb 10, 2025 · 4 comments
Open

Linux arm 64 support #417

johnzuk opened this issue Feb 10, 2025 · 4 comments
Assignees

Comments

@johnzuk
Copy link

johnzuk commented Feb 10, 2025

Is there any plan to introduce support for the linux arm64 platform?

@krichprollsch krichprollsch self-assigned this Feb 11, 2025
@krichprollsch
Copy link
Member

Hello @johnzuk,

Normally building for Linux amr64 is possible.
Did you encounter a problem?

We plan to build the nightly for ARM64, the corresponding issue is #326

@johnzuk
Copy link
Author

johnzuk commented Feb 15, 2025

Sorry I wasn't precise in the description. I tried to build docker the image but it is very tightly bound to the X86_64 architect.
There is ARG https://github.com/lightpanda-io/browser/blob/main/Dockerfile#L6 but x86_64 value is hardcoded in several places.
Also there is no prebuild linux arm64 binary there: https://github.com/lightpanda-io/zig-v8-fork so this line will fail:
https://github.com/lightpanda-io/browser/blob/main/Dockerfile#L63
So i tried first to build image in zig-v8-fork repo but its also bond to x86_64

So as a working solution i combined build both repositories in one dockerfile like so:

FROM debian:bookworm-slim AS builder
RUN apt-get update -yq && \
    apt-get install -yq build-essential ca-certificates clang-16 cmake curl git gperf llvm-16 lld libssl-dev zlib1g-dev libbz2-dev \
        libreadline-dev libsqlite3-dev wget libncurses5-dev libncursesw5-dev \
        xz-utils tk-dev libglib2.0-dev libexpat1-dev libffi-dev liblzma-dev pkg-config python3-openssl wget

RUN wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz
RUN tar -xf Python-3.12.0.tgz && \
    cd Python-3.12.0 && \
    ./configure --enable-optimizations && \
    make -j 8 && \
    make altinstall && \
    ln -s /usr/local/bin/python3.12 /usr/local/bin/python3

WORKDIR /build

ARG OS=linux
ARG ZIG_ARCH=aarch64
ARG ZIG=0.13.0
ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U

RUN curl -L -O https://github.com/jedisct1/minisign/releases/download/0.11/minisign-0.11-linux.tar.gz && \
    tar xvzf minisign-0.11-linux.tar.gz

RUN curl -O https://ziglang.org/download/${ZIG}/zig-linux-${ZIG_ARCH}-${ZIG}.tar.xz && \
    curl -O https://ziglang.org/download/${ZIG}/zig-linux-${ZIG_ARCH}-${ZIG}.tar.xz.minisig

RUN minisign-linux/${ZIG_ARCH}/minisign -Vm zig-linux-${ZIG_ARCH}-${ZIG}.tar.xz -P ${ZIG_MINISIG}

RUN rm -fr minisign-0.11-linux.tar.gz minisign-linux

RUN tar xvf zig-linux-${ZIG_ARCH}-${ZIG}.tar.xz && \
    mv zig-linux-${ZIG_ARCH}-${ZIG} /usr/local/lib && \
    ln -s /usr/local/lib/zig-linux-${ZIG_ARCH}-${ZIG}/zig /usr/local/bin/zig

RUN rm -fr zig-linux-${ZIG_ARCH}-${ZIG}.tar.xz zig-linux-${ZIG_ARCH}-${ZIG}.tar.xz.minisig

# clone zig-v8-fork
RUN git clone https://github.com/lightpanda-io/zig-v8-fork
RUN cd zig-v8-fork && zig build get-tools && zig build get-v8 && zig build -Doptimize=ReleaseSafe

## force use of http instead of ssh with github
RUN cat <<EOF > /root/.gitconfig
[url "https://github.com/"]
    insteadOf="[email protected]:"
EOF

# clone lightpanda
RUN git clone https://github.com/lightpanda-io/browser.git
#
WORKDIR /build/browser

# install deps
RUN git submodule init && \
    git submodule update --recursive

RUN cd vendor/zig-js-runtime && \
    git submodule init && \
    git submodule update --recursive

RUN make install-libiconv && \
    make install-netsurf && \
    make install-mimalloc


RUN mkdir -p vendor/zig-js-runtime/vendor/v8/${ZIG_ARCH}-${OS}/release && \
    mv /build/zig-v8-fork/v8-build/$ZIG_ARCH-$OS/release/ninja/obj/zig/libc_v8.a vendor/zig-js-runtime/vendor/v8/${ZIG_ARCH}-${OS}/release/libc_v8.a
## build release
RUN make build
#
FROM debian:bookworm-slim

# copy ca certificates
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

COPY --from=builder /build/browser/zig-out/bin/lightpanda /bin/lightpanda

EXPOSE 9222/tcp

CMD ["/bin/lightpanda", "--host", "0.0.0.0", "--port", "9222"]

@krichprollsch
Copy link
Member

Also there is no prebuild linux arm64 binary there: https://github.com/lightpanda-io/zig-v8-fork so this line will fail:
https://github.com/lightpanda-io/browser/blob/main/Dockerfile#L63

yes, this is the main blocker to have a fast docker build for linux arm.
Unfortunatly, AFAIK Github doesn't provide natively linux ARM instances.

see #326

@krichprollsch
Copy link
Member

I just noticed GH offers arm64 support for linux now 😓
I'm trying to update the builds. first with v8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants