Coder Social home page Coder Social logo

Comments (5)

cpswan avatar cpswan commented on May 30, 2024

It looks like debian:bullseye-slim doesn't yet have OS/ARCH support for linux/riscv64 so there's an upstream dependency issue to be dealt with (and although Debian can be run on RISC-V boards/emulators the architecture isn't yet listed as one of their official images).

from dart-docker.

cpswan avatar cpswan commented on May 30, 2024

It also turns out that RISC-V shouldn't have appeared in the beta channel - dart-lang/sdk#50548 (comment)

For my own efforts I think I'm going to hold off until it does make it to beta.

from dart-docker.

cpswan avatar cpswan commented on May 30, 2024

Dart on RISC-V is back in the beta channel (since 15 Mar 2023). I'm also seeing Debian images for linux/riscv (at least in the unstable tags). So the pieces are sliding into place...

from dart-docker.

cpswan avatar cpswan commented on May 30, 2024

Here's a Dockerfile that I used to make a build image with RISC-V support (based on the existing beta/bullseye Dockerfile):

FROM debian:unstable-slim

RUN set -eux; \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ca-certificates \
        curl \
        dnsutils \
        git \
        openssh-client \
        unzip \
    ; \
    rm -rf /var/lib/apt/lists/*

# Create a minimal runtime environment for executing AOT-compiled Dart code
# with the smallest possible image size.
# usage: COPY --from=dart:xxx /runtime/ /
# uses hard links here to save space
RUN set -eux; \
    case "$(dpkg --print-architecture)" in \
        amd64) \
            TRIPLET="x86_64-linux-gnu" ; \
            FILES="/lib64/ld-linux-x86-64.so.2" ;; \
        armhf) \
            TRIPLET="arm-linux-gnueabihf" ; \
            FILES="/lib/ld-linux-armhf.so.3 \
                /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3";; \
        arm64) \
            TRIPLET="aarch64-linux-gnu" ; \
            FILES="/lib/ld-linux-aarch64.so.1 \
                /lib/aarch64-linux-gnu/ld-linux-aarch64.so.1" ;; \
        riscv64) \
            TRIPLET="riscv64-linux-gnu" ; \
            FILES="/lib/ld-linux-riscv64-lp64d.so.1 \
                /lib/riscv64-linux-gnu/ld-linux-riscv64-lp64d.so.1" ;; \
        *) \
            echo "Unsupported architecture" ; \
            exit 5;; \
    esac; \
    FILES="$FILES \
        /etc/nsswitch.conf \
        /etc/ssl/certs \
        /usr/share/ca-certificates \
        /lib/$TRIPLET/libc.so.6 \
        /lib/$TRIPLET/libdl.so.2 \
        /lib/$TRIPLET/libm.so.6 \
        /lib/$TRIPLET/libnss_dns.so.2 \
        /lib/$TRIPLET/libpthread.so.0 \
        /lib/$TRIPLET/libresolv.so.2 \
        /lib/$TRIPLET/librt.so.1"; \
    for f in $FILES; do \
        dir=$(dirname "$f"); \
        mkdir -p "/runtime$dir"; \
        cp --archive --link --dereference --no-target-directory "$f" "/runtime$f"; \
    done

ENV DART_SDK /usr/lib/dart
ENV PATH $DART_SDK/bin:$PATH

WORKDIR /root
RUN set -eux; \
    case "$(dpkg --print-architecture)" in \
        amd64) \
            DART_SHA256=eaaeee6be87a140a08ae0b6cc76e23ff4e5cb0ef7bbfa8ffa08b90e26b826e6e; \
            SDK_ARCH="x64";; \
        armhf) \
            DART_SHA256=7636eb23c9053bceebf326ae46c8e7be57c5c3cbaedabe2a5a0d6c8717dcc5e9; \
            SDK_ARCH="arm";; \
        arm64) \
            DART_SHA256=b8f3d1f6c65657296757455ac99fab5772dcdb333cc83d15d626717779f2224a; \
            SDK_ARCH="arm64";; \
        riscv64) \
            DART_SHA256=013000bebf117608e9572336f227bffa1839d119753d084009331fc6e1747c9e; \
            SDK_ARCH="riscv64";; \
    esac; \
    SDK="dartsdk-linux-${SDK_ARCH}-release.zip"; \
    BASEURL="https://storage.googleapis.com/dart-archive/channels"; \
    URL="$BASEURL/beta/release/3.0.0-290.3.beta/sdk/$SDK"; \
    echo "SDK: $URL" >> dart_setup.log ; \
    curl -fLO "$URL"; \
    echo "$DART_SHA256 *$SDK" \
        | sha256sum --check --status --strict -; \
    unzip "$SDK" && mv dart-sdk "$DART_SDK" && rm "$SDK" \
        && chmod 755 "$DART_SDK" && chmod 755 "$DART_SDK/bin";

from dart-docker.

cpswan avatar cpswan commented on May 30, 2024

The main obstacle to getting this done is Debian support for RISC-V.

As I noted above it's been in 'sid' (unstable) for a little while now, but the Dockerfiles for stable and beta start FROM debian:bullseye-slim, which is the (now old) stable release (Debian 11).

Debian have announced riscv64 is now an official architecture, but that came after the release of Debian 12 "Bookworm" as the latest stable.

If things run their normal course this means that we'll be waiting until Debian 14 "Forky" for RISC-V to make it into a stable release as a supported architecture, and that will be years away (~summer of 2027). I'm hopeful though that we won't have to wait that long, and that we'll start seeing RISC-V show up in Debian 13 "Trixie" and maybe even Debian 12.

As a point of comparison, Ubuntu already have a bunch of 23.04 "Lunar Lobster" releases available for the popular RISC-V dev boards (and QEMU) - Download Ubuntu for RISC-V Platforms, which hints at Ubuntu on RISC-V being ready for the 24.04 LTS release next year. Though there aren't yet any linux/riscv64 official Ubuntu images on Docker Hub.

SPECULATION what I think will happen here is that Ubuntu will fully support RISC-V from 24.04 LTS (including Docker images). Debian will likely then catch up with a 12 stable release (and 13 testing release) that also supports RISC-V. So we have about a year to wait./SPECULATION The reason for optimism is that substantial resource is being poured into RISC-V dependencies from companies (including Google) through the RISC-V Software Ecosystem (RISE) project. Keep an eye on the RISE Debian wiki for updates.

Meanwhile the images here need to catch up to Debian 12...

from dart-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.