NilFoundation / zkllvm-rust-template

Template repository for zkLLVM-based Rust projects
2 stars 2 forks source link

Issue installing the toolchain #1

Open anupsv opened 4 months ago

anupsv commented 4 months ago

Hi all,

I tried installing this mac m2 with the --platform linux/amd64 arg for building and running a dockerfile which installs the things required.

This is the Dockerfile:

FROM ghcr.io/nilfoundation/build-base:1.76.0

RUN echo 'deb [trusted=yes]  http://deb.nil.foundation/ubuntu/ all main' >> /etc/apt/sources.list \
    && apt-get update \
    && apt-get -y --no-install-recommends --no-install-suggests install \
      build-essential \
      cmake \
      git \
      zkllvm \
      python3 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

RUN apt update
RUN apt install -y curl python3 ca-certificates

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

RUN . $HOME/.cargo/env && curl --proto '=https' --tlsv1.2 -sSf https://cdn.jsdelivr.net/gh/NilFoundation/zkllvm@master/rslang-installer.py | python3 - --channel nightly

Running this works correctly, but running the test command gives me the error:

root@3b9ac9bf2455:/# rustc +zkllvm --version
Illegal instruction

This is the env config:

rustc 1.76.0 (07dca489a 2024-02-04) Linux 3b9ac9bf2455 6.6.12-linuxkit #1 SMP Fri Jan 19 08:53:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

root@1ed9420d9991:/# curl --proto '=https' --tlsv1.2 -sSf https://cdn.jsdelivr.net/gh/NilFoundation/zkllvm@master/rslang-installer.py | python3 - --channel nightly
rslang-installer > [INFO] Rslang installer
rslang-installer > [INFO]
rslang-installer > [INFO] Host platform: x86_64-unknown-linux-gnu
rslang-installer > [INFO] Rustup home: /root/.rustup
rslang-installer > [INFO] Installation prefix: /root/.rustup/toolchains/zkllvm
rslang-installer > [INFO] Querying for latest release
rslang-installer > [INFO] Found v0.1.16 release
rslang-installer > [INFO] Using nightly channel
rslang-installer > [INFO] Downloading rust-nightly-x86_64-unknown-linux-gnu.tar.gz
rslang-installer > [INFO] Unpacking rust-nightly-x86_64-unknown-linux-gnu.tar.gz
rslang-installer > [INFO] Installing rust-nightly-x86_64-unknown-linux-gnu
rslang-installer > [INFO] Host toolchain installed
rslang-installer > [INFO] Downloading rust-std-nightly-assigner-unknown-unknown.tar.gz
rslang-installer > [INFO] Unpacking rust-std-nightly-assigner-unknown-unknown.tar.gz
rslang-installer > [INFO] Installing rust-std-nightly-assigner-unknown-unknown
rslang-installer > [INFO] Assigner target installed
rslang-installer > [INFO]
rslang-installer > [INFO] Installation completed
rslang-installer > [INFO]
rslang-installer > [INFO] You can check your installation:
rslang-installer > [INFO]     rustc +zkllvm -V

Any thoughts around this would be helpful. I will try running this on bare machine as well.

aleasims commented 1 month ago

It's pretty hard to fix this type of problem. We've never checked how our pre-built binaries will behave in emulation scenario. We provide pre-builts for native x86-64 GNU/Linux, so running them on any other setup is considered as "your own risk". I'd recommend building from sources on any platform except this one.

I've seen a case when using our pre-builts with QEMU worked fine (I believe it was Mac M1), but I consider it as "unstabe magic".