LoginSignup
2
3

More than 3 years have passed since last update.

opencv-rustでビルドに失敗したときの話

Last updated at Posted at 2020-05-21

失敗したときの環境

item desc
OS MacOS 10.14.6
OpenCV 4 directory /usr/local/Cellar/opencv/4.3.0
opencv-rust features buildtime-bindgen,contrib
How to install Opencv brew install opencv
llvm 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を行うことにした。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3