opencv-rust: Advice needed: opencv-rust won't build on linux with vcpkg and newer versions of opencv

Hey there first of all thanks for these bindings they are really helpful 😃. I am trying to use newer OpenCV versions and using vcpkg to install it on Linux, but there is a linking problem when putting the final binary together, could you take a look and see if you think I did something wrong? I tried to follow the CI stuff you have here but mixing Linux and vcpkg. I will also try to compile the instructions in a doc to put here for future reference. To make it easier to reproduce, I put it all in the following Dockerfile:

FROM rust:1.46

WORKDIR /app

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get -y install libclang-dev clang curl git zip unzip pkg-config

ENV VCPKG_ROOT /usr/src/vcpkg
ENV VCPKGRS_DYNAMIC=1
ENV PATH "/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin:/root/.cargo/bin:/usr/local/cargo/bin"

RUN bash -exc 'cd /usr/src && git clone https://github.com/microsoft/vcpkg && cd vcpkg && ./bootstrap-vcpkg.sh && ./vcpkg install opencv4[contrib,nonfree] && ./vcpkg list'

RUN USER=test cargo new test-app && cd test-app && \
    echo 'opencv = { version = "0.46", default-features = false, features = ["contrib", "buildtime-bindgen", "opencv-4", "clang-runtime"] }' >> Cargo.toml && \
    echo 'use opencv::videoio;fn main() {let _cam = videoio::VideoCapture::new(0, videoio::CAP_ANY).unwrap();}' > src/main.rs && \
    cargo build -vvv

Here you can see the build log https://gist.github.com/jaysonsantos/6f0042734ea754045e28ad57d01409ba

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

The fix is now released in v0.46.1