Closed magom001 closed 3 years ago
Hi @magom001
On my Mac Laptop (also Catalina 10.15.7), I see the same error. It used to work.
I think the version of clang
might have been updated recently on Mac to Apple clang version 12.0.0 (clang-1200.0.32.28)
.
I'm using the brew package manager. I can install clang 11
using it.
brew install llvm tesseract leptonica
Then, I can build tesseract-sys using a couple extra environment variables:
PATH="/usr/local/opt/llvm/bin:$PATH" BINDGEN_EXTRA_CLANG_ARGS='-I"/usr/local/Cellar/tesseract/4.1.1/include" -I"/usr/local/Cellar/leptonica/1.80.0/include"' cargo test
Does that work for you?
But how come it does not understand constexpr?
I think this may be an issue with how the bindgen
crate interacts with clang
. Maybe clang 12 is too new, and it will be fixed in an update of bindgen
.
Thanks for your feedback! Indeed it does work with clang 11
TOML
[package]
name = "tess-build"
[dependencies]
tesseract = "0.6.2"
main.rs
fn main() {
let text = tesseract::ocr("<PATH_TO_DIR>/tess-build/img.png", "eng").unwrap();
println!("{}", text);
}
running with
PATH="/usr/local/opt/llvm/bin:$PATH" BINDGEN_EXTRA_CLANG_ARGS='-I"/usr/local/Cellar/tesseract/4.1.1/include" -I"/usr/local/Cellar/leptonica/1.80.0/include"' cargo run
Good that it worked :+1:
I'll try an issue about it clang 12 and constexpr on the bindgen project.
As I've mentioned in the related issue https://github.com/rust-lang/rust-bindgen/issues/1948 this is still failing in the same way on clang 13.
During compilation
I am not an expert on rust. But how come it does not understand
constexpr
?