Trying to build KumoMTA on Alpine Edge, with libclang 17 but fails miserably, cannot find relevant info on the internet so far.
1 - “standard” cargo build gives the following error message:
$ cargo build --release
(…)
error: failed to run custom build command for librocksdb-sys v0.16.0+8.10.0
Caused by:
process didn’t exit successfully: /target/release/build/librocksdb-sys-2c073cfaf9e9d9d9/build-script-build (exit status: 101)
— stderr
thread ‘main’ panicked at /.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.69.4/lib.rs:622:31:
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
2- Alpine is notoriously difficult with dynamic loading, however when options are passed to force a static build, another error message encountered when compiling mod-redis:
$ cargo clean && RUSTFLAGS=“-C target-feature=-crt-static” cargo build --release
(…)
error[E0433]: failed to resolve: could not find Builder in task
→ crates/mod-redis/src/lib.rs:39:22
|
39 | tokio::task::Builder::new()
| ^^^^^^^ could not find Builder in task
|
help: consider importing one of these items
|
1 + use tokio::runtime::Builder;
|
help: if you import Builder, refer to it directly
|
39 - tokio::task::Builder::new()
39 + Builder::new()
|
The same error message appears for the 3 mentions to tokio::task::Builder::new() in crates/mod-redis/src/lib.rs.
I tried to tinker with crates/mod-redis/src/lib.rs and recommended by rust, adding “use tokio::runtime::Builder;” and replacing each occurence of tokio::task::Builder::new() with Builder::new(), but it triggers other error messages which are way above my skillset.
Hey there @rational-cougar, thanks for posting. Please read the “Troubleshooting” and “How to Ask for Help” buttons below. If you would like a 1:1 support session from the KumoMTA team, details are at the “Book a Support Session” button below.
it’s going to be difficult because rocksdb and openssl are both required dependencies.
The tokio error you shared sounds like the .cargo/config.toml file that specifies rustflags is either missing or being overridden in your build environment.
Are you trying to cross compile? That will be even more difficult.
Thanks for the feedback. No cross compilation involved, just trying to run KumoMTA on Alpine.
I did not modify cargo config file, just pushed a specific environment variable RUSTFLAGS=“-C target-feature=-crt-static” to force static build.
it’s difficult to get this sort of thing going when openssl is involved. I had to jump through a lot of hoops in building the image for my govee2mqtt project, burning a couple of days, and in the end I gave up on alpine and went with distroless debian12
rocksdb’s build is the tallest pole. There are a lot of C++ deps there and I speak from experience (I used to shepherd all the OSS builds at FB) that it is extremely challenging to get static builds working right across so many deps. The next tallest pole is openssl for similar reasons.
FWIW, earlier in kumomta’s history, we used to use alpine as the base for our docker image. The build was successful back then, but it would crash on startup
I hadn’t heard of Incus until you mentioned it. I see no reason why you couldn’t run our debian build in a debian distro running under something like that