Dynamic loading not supported
- Operating system: Alpine 3.14
- The way you installed OpenCV: package,
- OpenCV version: opencv4
- rustc version (
rustc --version): rustc 1.58.0
I trying to compile statically. And I change Cargo.toml on opencv.
[build-dependencies.clang]
version = "1.0"
features = ["clang_6_0","static"]
Also add clang-static package.
cargo build --release --target=x86_64-unknown-linux-musl
--- stderr
thread 'main' panicked at 'Unable to find libclang: "the `libclang` shared library at /usr/lib/libclang.so.11.1 could not be opened: Dynamic loading not supported"', /root/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/bindgen-0.56.0/src/lib.rs:1922:31
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
It seems not working, so what should I do?
Well, first please provide the full build log as printed by cargo build -vv. Please make sure to do the cargo clean before that.
my log, log.txt
Well, first please provide the full build log as printed by
cargo build -vv. Please make sure to do thecargo cleanbefore that.
The build log you attached doesn't produce any error, can you please do the command with the required --target: cargo build -vv --release --target=x86_64-unknown-linux-musl (please don't forget cargo clean before that)
log.txt This buid failed
Have you tried disabling the clang-runtime feature?
I create a new project only with opencv. Here is log. log_noruntime.txt Does it hint me to compile statical opencv ?
Can you please try that with the latest opencv crate version? Other than that please refer to this issue about static building: https://github.com/twistedfall/opencv-rust/issues/104 At the moment static building is not really supported, but there were some reports of the success.