opencv-rust icon indicating copy to clipboard operation
opencv-rust copied to clipboard

Dynamic loading not supported

Open ci-yuan opened this issue 4 years ago • 6 comments

  1. Operating system: Alpine 3.14
  2. The way you installed OpenCV: package,
  3. OpenCV version: opencv4
  4. 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?

ci-yuan avatar Jan 15 '22 05:01 ci-yuan

Well, first please provide the full build log as printed by cargo build -vv. Please make sure to do the cargo clean before that.

twistedfall avatar Jan 15 '22 06:01 twistedfall

my log, log.txt

Well, first please provide the full build log as printed by cargo build -vv. Please make sure to do the cargo clean before that.

ci-yuan avatar Jan 15 '22 14:01 ci-yuan

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)

twistedfall avatar Jan 18 '22 07:01 twistedfall

log.txt This buid failed

ci-yuan avatar Jan 18 '22 08:01 ci-yuan

Have you tried disabling the clang-runtime feature?

twistedfall avatar Jan 18 '22 09:01 twistedfall

I create a new project only with opencv. Here is log. log_noruntime.txt Does it hint me to compile statical opencv ?

ci-yuan avatar Jan 18 '22 12:01 ci-yuan

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.

twistedfall avatar Oct 01 '22 07:10 twistedfall