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

Building wasi-sdk on Linux #800

Open
rcarmo opened this issue Jul 19, 2024 · 3 comments
Open

Building wasi-sdk on Linux #800

rcarmo opened this issue Jul 19, 2024 · 3 comments

Comments

@rcarmo
Copy link

rcarmo commented Jul 19, 2024

If you are on OSX, I now provide a ready-so-use SDK here: https://github.com/holzschu/wasi-sdk/releases/download/wasi-sdk-aShell-19/wasi-sdk.tar.gz
It contains the binaries (clang, ar, wasm-ld...) and the sysroot, with a bunch of auxiliary libraries.
Originally posted by @holzschu in #666 (comment)

I've been trying to get the wasi-sdk to build and work on Linux, simply because that way I can do automated builds and use my existing sandboxes. However, I can't really figure out the right steps to get it to build and support setjmp.

So far, I have this Dockerfile:

FROM debian:bookworm 

RUN apt-get update \
 && apt-get install -y --no-install-recommends \
        curl \
        ca-certificates \
        build-essential \
        clang \
        python3 \
        git \
        ninja-build \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

RUN curl -sSLO https://github.com/Kitware/CMake/releases/download/v3.20.1/cmake-3.20.1-linux-x86_64.tar.gz \
  && tar xf cmake-3.20.1-linux-x86_64.tar.gz \
  && rm cmake-3.20.1-linux-x86_64.tar.gz \
  && mkdir -p /opt \
  && mv cmake-3.20.1-linux-x86_64 /opt/cmake
ENV PATH=/opt/cmake/bin:$PATH

RUN mkdir /build \
 && cd /build \
 && git clone --recurse-submodules https://github.com/holzschu/wasi-sdk.git \
 && cd wasi-sdk \
 && git fetch --all --tags \
 && git checkout tags/wasi-sdk-aShell-19

ENV PREFIX=/opt/
RUN cd /build/wasi-sdk \
 && sed '296,316{s/^/#/}' src/llvm-project/clang/CMakeLists.txt > /tmp/clean \
 && mv /tmp/clean src/llvm-project/clang/CMakeLists.txt \
 && make

This builds and seems to work, but lacks a lot of the extra libraries and headers in the OSX tarball above.

What else do I need to do? I'd like to have a reproducible SDK build...

@holzschu
Copy link
Owner

I cannot test, but I think you also need to download the SDK from https://github.com/holzschu/wasi-sdk/releases/download/wasi-sdk-aShell-19/wasi-sdk.tar.gz , extract it, and copy .../share/wasi-sysroot/ over the wasi-sysroot that you have built with the previous steps (or, at least, copy the extra libraries and headers).

@rcarmo
Copy link
Author

rcarmo commented Jul 20, 2024

Thanks. I'd really like to have a working recipe for building everything from scratch, since (for instance) the Dockerfile above generates things with clang-14, and I see clang-19 in your tarball. Since when I travel with my iPad I take one of these ARM devices as a "sidecar" for development and not a Mac, I'd like to have a toolchain I can run there...

Do you have any notes on the build steps for your tarball?

@holzschu
Copy link
Owner

There must be something wrong with the release. I'll commit and push again from wasi-sdk.

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

No branches or pull requests

2 participants