失敗したときの環境

itemdescOSMacOS 10.14.6OpenCV 4 directory/usr/local/Cellar/opencv/4.3.0opencv-rust featuresbuildtime-bindgen,contribHow to install Opencvbrew install opencvllvm directory/usr/local/Cellar/llvm/7.0.1/
[package]
name = "***"
version = "0.1.0"
authors = ["***"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
opencv = { version = "0.36.0", features = ["buildtime-bindgen"]}
--- あと他にbindgenを利用するcrate ---

解決策 (追記 2020/05/26)

[package]
name = "***"
version = "0.1.0"
authors = ["***"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
opencv = { version = "0.37.0", features = ["buildtime-bindgen", "clang-runtime"]}
--- あと他にbindgenを利用するcrate ---

現時点(2020/05/21)での解決策

[package]
name = "***"
version = "0.1.0"
authors = ["***"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
opencv = { git = "https://github.com/twistedfall/opencv-rust.git", features = ["buildtime-bindgen", "clang-runtime"]}
--- あと他にbindgenを利用するcrate ---

解決までの道筋

失敗した原因

opencv-rustを利用している、Cargo.toml内でbindgenを利用していた。そのbindgenがclang-runtimeベースで動いていた。
opencv-rustを始めとしてbind generationを並列でやるときにclang-runtimeベースだとうまく動かないらしい。

解決方法

featureとしてclang-runtimeというものを用意して clang-runtimeがついてるときは(ビルド速度を犠牲にして)非並列でbind generationを行うことにした。

广告
将在 10 秒后关闭
bannerAds