I'm trying to build the Roc CLI & an application from source in a Debian-based Docker container, and I'm having some glibc-related issues. In my attempts to either use the nightly build or compile the Roc CLI from source, I've inevitably ended up with some variation of not having a recent-enough version of glibc installed. Now I'm trying a simpler setup with a clean debian image, and I'm getting something close but different. Any ideas?
My steps:
docker pull debian:bullseye
docker run -it debian:bullseye
apt-get update
apt-get install -y build-essential curl git wasi-libc
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH="/root/.cargo/bin:${PATH}"
git clone https://github.com/roc-lang/roc
cd roc
cargo build --release
Output of retrying the last step:
root@10f2de4f2937:/code/roc# cargo build --release
Compiling phf_shared v0.11.1
Compiling parking_lot_core v0.8.5
Compiling wasi_libc_sys v0.0.1 (/code/roc/crates/wasi-libc-sys)
Compiling radium v0.6.2
Compiling rayon-core v1.9.3
Compiling codespan-reporting v0.11.1
Compiling fxhash v0.2.1
error: failed to run custom build command for `wasi_libc_sys v0.0.1 (/code/roc/crates/wasi-libc-sys)`
Caused by:
process didn't exit successfully: `/code/roc/target/release/build/wasi_libc_sys-2aa588872a64b732/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:rerun-if-changed=src/dummy.c
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', crates/wasi-libc-sys/build.rs:30:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `wasi_libc_sys v0.0.1 (/code/roc/crates/wasi-libc-sys)`
Caused by:
process didn't exit successfully: `/code/roc/target/release/build/wasi_libc_sys-2aa588872a64b732/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:rerun-if-changed=src/dummy.c
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', crates/wasi-libc-sys/build.rs:30:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
root@10f2de4f2937:/code/roc#
Oh, Zig is a requirement for building the Roc CLI, isn't it?
yeah, it's required for building the Roc standard library, so definitely required for building the CLI! :big_smile:
Alright! Anything else I forgot? Various common linux utilities, Rust, Zig...
You can always look at the earth file or the nix flake file
Both should give a list
The earth file would read like a docker file with install commands
Ooh! Good point, thanks
Well, darn, that worked too well. Copying the Earthfile steps into my Dockerfile made the next build work exactly as intended, so instead of playing music or browsing the web or responding to my mouse movements my laptop is now JUST compiling the Roc CLI inside of Docker :laughing:
The CLI built! However, the app didn't, and this is interesting: version 'GLIBC_2.34' not found (required by /app/roc/examples/interactive/cli-platform/target/debug/build/host-ada94793d07cf987/build-script-build)
Context:
...
Compiling roc_docs v0.0.1 (/app/roc/crates/docs)
Compiling roc_docs_cli v0.0.1 (/app/roc/crates/docs_cli)
Finished release [optimized] target(s) in 10m 26s
Removing intermediate container 184e94385d81
---> 4f063a355894
Step 21/31 : COPY invoke.go ./
---> 641416f3688a
Step 22/31 : COPY *.roc ./
---> a195dcd354ad
Step 23/31 : RUN go build -mod=readonly -v -o server
---> Running in bdb89a178e9f
...
Removing intermediate container bdb89a178e9f
---> 9e33fd47183c
Step 24/31 : RUN ./roc/target/release/roc build
---> Running in 48a811dda7d3
🔨 Rebuilding platform...
thread '<unnamed>' panicked at 'Failed to rebuild src/main.rs - stderr of the `cargo build` command was:
Downloading crates ...
Downloaded tinyvec_macros v0.1.0
Downloaded base64 v0.13.0
Downloaded tinyvec v1.6.0
...
Compiling form_urlencoded v1.0.1
Compiling rustls-pemfile v1.0.0
Compiling host v0.0.1 (/app/roc/examples/interactive/cli-platform)
error: failed to run custom build command for `host v0.0.1 (/app/roc/examples/interactive/cli-platform)`
Caused by:
process didn't exit successfully: `/app/roc/examples/interactive/cli-platform/target/debug/build/host-ada94793d07cf987/build-script-build` (exit status: 1)
--- stderr
/app/roc/examples/interactive/cli-platform/target/debug/build/host-ada94793d07cf987/build-script-build: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /app/roc/examples/interactive/cli-platform/target/debug/build/host-ada94793d07cf987/build-script-build)
/app/roc/examples/interactive/cli-platform/target/debug/build/host-ada94793d07cf987/build-script-build: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /app/roc/examples/interactive/cli-platform/target/debug/build/host-ada94793d07cf987/build-script-build)
/app/roc/examples/interactive/cli-platform/target/debug/build/host-ada94793d07cf987/build-script-build: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /app/roc/examples/interactive/cli-platform/target/debug/build/host-ada94793d07cf987/build-script-build)
warning: build failed, waiting for other jobs to finish...
', crates/compiler/build/src/link.rs:1333:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', crates/cli/src/build.rs:322:46
The command '/bin/sh -c ./roc/target/release/roc build' returned a non-zero code: 101
Debian bullseye comes with glibc v2.31 installed, and I can't find how to upgrade that (since compiling examples/interactive/cli-platform
needs v2.34, apparently). How can someone compile Roc apps (for example, using examples/interactive/cli-platform/
as the platform) on a stable release of Debian?
I'm trying debian:testing
now, as it has glibc v2.34 ...
I know that Debian's long release cycle might conflict with Roc's pre-alpha nature, but stable OS distributions make for very good servers.
debian:testing
built the app! :D
Roc never dictates the glibc version. Do the question is how is the platform or linker pulling in that version of glibc?
Rust libc dependency in the build.rs
- should that change?
Maybe? I thought that just grabbed the system libc. But it is likely grabbing the wrong thing and causing your issue?
I believe so
Though that doesn't totally make sense to me
Though libc in general doesn't totally make sense to me :sweat_smile:
Last updated: Jul 05 2025 at 12:14 UTC