Skip to content

Commit d36133a

Browse files
bushidocodesclaude
andcommitted
fix: repair Docker dev-environment build and clarify native setup
The documented setup was failing. The native path assumes a Debian host with LLVM 13, but aWsm's llvm-alt bindings call LLVM C-API functions (LLVMBuildCall, LLVMBuildLoad) removed in LLVM 15+, so the build fails to link against newer system LLVM (e.g. LLVM 21 on Ubuntu 24.04). The Docker route exists for exactly this reason but had bit-rotted in several places. Dockerfile.x86_64: - Install `hey` from focal's universe repo instead of downloading the prebuilt binary, whose hey-release S3/GCS URLs now return 403. - Add `git config --system --add safe.directory '*'` so the root-run `make install` doesn't abort with "dubious ownership" on the host-owned, bind-mounted /sledge. - Set RUSTUP_HOME/CARGO_HOME to the dev user's install so the root-run build can resolve the default Rust toolchain instead of failing with "no default is configured". Makefile: - Make the wasm_apps symlink rule idempotent (ln -srfn). The symlink is committed to the repo, so it already exists on a fresh clone and the old `ln -sr` failed with "File exists", breaking `make install`. README.md: - Recommend the Docker route and add an explicit caveat to the native section documenting the LLVM-13/Debian requirement and why Ubuntu 24.04 (and other non-LLVM-13 hosts) cannot use it. Verified end-to-end via `./devenv.sh setup`: aWsm, the runtime, and all benchmark apps build, and the runtime serves fibonacci, gocr, and resize_image requests with correct responses. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6037e62 commit d36133a

3 files changed

Lines changed: 36 additions & 18 deletions

File tree

Dockerfile.x86_64

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ENV LLVM_VERSION=13
55
ENV WASI_SDK_VERSION=12
66

77
ARG DEBIAN_FRONTEND=noninteractive
8-
ARG HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64
98
ARG WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk_$WASI_SDK_VERSION.0_amd64.deb
109
ARG SHFMT_URL=https://github.com/mvdan/sh/releases/download/v3.2.4/shfmt_v3.2.4_linux_amd64
1110
ARG SHELLCHECK_URL=https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz
@@ -32,6 +31,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3231
libtool \
3332
pkg-config
3433

34+
# The repo is bind-mounted from the host, so its files are owned by the host user
35+
# while the build runs as root (docker exec -u 0). Modern git rejects this as
36+
# "dubious ownership", so whitelist any directory for all users in the image.
37+
RUN git config --system --add safe.directory '*'
38+
3539
# Needed to install from http endpoints via curl or wget
3640
RUN apt-get update && apt-get install -y --no-install-recommends \
3741
curl \
@@ -43,12 +47,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
4347
wget
4448

4549
# Test Script Stuff
50+
# hey is a load generator used by the test workloads (focal ships it in universe;
51+
# the previously-used hey-release S3/GCS binaries now return 403)
4652
RUN apt-get update && apt-get install -y --no-install-recommends \
4753
bc \
4854
fonts-dejavu \
4955
fonts-cascadia-code \
5056
fonts-roboto \
5157
gnuplot \
58+
hey \
5259
httpie \
5360
imagemagick \
5461
jq \
@@ -57,11 +64,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
5764
pango1.0-tools \
5865
wamerican
5966

60-
# Hey is a load generator we have to recklessly download from the 'net, as it is only published to brew
61-
# Binaries are only provided for AMD64 though, so ARM will have to build from source
62-
# See https://github.com/rakyll/hey
63-
RUN wget $HEY_URL -O hey && chmod +x hey && mv hey /usr/bin/hey
64-
6567
# shfmt is a formatter for shell scripts
6668
RUN wget $SHFMT_URL -O shfmt && chmod +x shfmt && mv shfmt /usr/local/bin/shfmt
6769
RUN wget $SHELLCHECK_URL -O shellcheck && chmod +x shellcheck && mv shellcheck /usr/local/bin/shellcheck
@@ -110,6 +112,11 @@ RUN cd sledge && ./fix_root.sh
110112
# Rustup does not cleanly support system installs, so install as non-root user
111113
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --component rustfmt --target wasm32-wasi -y
112114
ENV PATH=/home/dev/.cargo/bin:$PATH
115+
# `make install` runs as root (docker exec -u 0), but Rust is installed for the
116+
# dev user. Point rustup/cargo at dev's install so root resolves the default
117+
# toolchain instead of failing with "no default is configured".
118+
ENV RUSTUP_HOME=/home/dev/.rustup
119+
ENV CARGO_HOME=/home/dev/.cargo
113120
RUN cargo install --debug cargo-audit cargo-watch rsign2
114121

115122
# We need to set the locale for pango-view

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ applications:
5050
applications.clean:
5151
make -C applications clean
5252

53-
# Instead of having two copies of wasm_apps, just link to the awsm repo's copy
53+
# Instead of having two copies of wasm_apps, just link to the awsm repo's copy.
54+
# -f -n make this idempotent: the symlink is committed to the repo, so it already
55+
# exists on a fresh clone and on rebuilds; without these flags ln fails with
56+
# "File exists" and breaks `make install`.
5457
wasm_apps:
55-
ln -sr awsm/applications/wasm_apps/ applications/
58+
ln -srfn awsm/applications/wasm_apps/ applications/wasm_apps
5659

5760
# Tests
5861
.PHONY: test

README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,11 @@
44

55
## Setting up a development environment
66

7-
### Native on Debian Host
7+
SLEdge's `aWsm` compiler is built against a **specific LLVM version (LLVM 13)** via the `llvm-alt` Rust bindings. Those bindings use LLVM C-API functions (e.g. `LLVMBuildCall`, `LLVMBuildLoad`) that were **removed in LLVM 15+**, so the build will fail to link against newer LLVM toolchains.
88

9-
```sh
10-
git clone https://github.com/gwsystems/sledge-serverless-framework.git
11-
cd sledge-serverless-framework
12-
./install_deb.sh
13-
source ~/.bashrc
14-
make install
15-
make test
16-
```
9+
**For this reason, the Docker environment below is the recommended way to build SLEdge.** It pins the exact Debian + LLVM 13 + WASI SDK toolchain that the compiler needs, and works on any host with Docker (macOS, Windows/WSL2, or a Linux distro other than the one targeted by `install_deb.sh`).
1710

18-
### Docker
11+
### Docker (recommended)
1912

2013
**Note: These steps require Docker. Make sure you've got it installed!**
2114

@@ -75,6 +68,21 @@ If you are finished working with the SLEdge runtime and wish to remove it, run t
7568

7669
And then simply delete this repository.
7770

71+
### Native build (Debian + LLVM 13 only)
72+
73+
**Caveat:** `install_deb.sh` only works on a host whose package repositories provide **LLVM 13** and `libtinfo5` — in practice a Debian release (or older Ubuntu such as 20.04/22.04) that `apt.llvm.org` still serves LLVM 13 for. It will **not** work on Ubuntu 24.04 (noble) or other distros where LLVM 13 is unavailable: `libtinfo5` has no install candidate, `apt.llvm.org/llvm.sh 13` provides no packages, and the `aWsm` build will fail to link against the newer system LLVM (`undefined symbol: LLVMBuildCall`). Use the Docker route above on those systems.
74+
75+
On a supported host:
76+
77+
```sh
78+
git clone https://github.com/gwsystems/sledge-serverless-framework.git
79+
cd sledge-serverless-framework
80+
./install_deb.sh
81+
source ~/.bashrc
82+
make install
83+
make test
84+
```
85+
7886
## Running your first serverless function
7987

8088
An SLEdge serverless function consists of a shared library (\*.so) and a JSON configuration file that determines how the runtime should execute the serverless function. As an example, here is the configuration file for our sample fibonacci function:

0 commit comments

Comments
 (0)