You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm trying to statically embed Ruby within a Rust project using magnus, and it seems like I cannot get it to build using an alpine image.
I'm using Docker on M1, using the following Dockerfile:
FROM rust:alpine AS builder
RUN apk add musl-dev ruby clang17-static llvm17-static clang17-libclang
WORKDIR /usr/src/myapp
COPY . .
RUN cargo install --path .
FROM scratch
COPY --from=builder /usr/local/cargo/bin/myapp .
CMD ["myapp"]
My Cargo.toml looks like this:
[package]
name = "ruby-embed-test"version = "0.1.0"edition = "2021"
[dependencies]
magnus = { version = "0.7.1", features = ["embed"] }
rb-sys = { version = "*", default-features = false, features = ["ruby-static"] }
and the error I get is:
Unable to find libclang: "the `libclang` shared library at /usr/lib/llvm17/lib/libclang.so.17.0.6 could not be opened: Dynamic loading not supported"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: failed to compile `ruby-embed-test v0.1.0 (/usr/src/myapp)`, intermediate artifacts can be found at `/usr/src/myapp/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.`
I also tried to mess with the bindgen settings, but it seems like `rb-sys-build` uses the `runtime` feature, which is mutually exclusive with the `static` feature.
Is it possible to embed Ruby like this? Ideally, I would like to have just one self-contained binary (that can be used without glibc).
The text was updated successfully, but these errors were encountered:
Hi,
I'm trying to statically embed Ruby within a Rust project using magnus, and it seems like I cannot get it to build using an alpine image.
I'm using Docker on M1, using the following Dockerfile:
My Cargo.toml looks like this:
and the error I get is:
The text was updated successfully, but these errors were encountered: