-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clang Windows issue #19
Comments
Hi @adminSxs, I'll try building on Windows 10 tonight. Have you already installed Microsoft's vcpkg https://github.com/houqp/leptess/blob/master/README.md#windows |
|
Ok, I'll try in Windows 10 tonight and see what needs to be done |
Ok,thanks. |
Sorry if I'm not very useful at this issue. I don't use Windows much. There seem to be 2 errors.
It can't find llvm-config and it can't find clang. These are usually installed together. Can I get you to try installing LLVM? If this works, I'll update the Readme to include this step. |
I have installed llvm ,but still same error |
I use centos:7 to build
|
How are you using Windows 10 and CentOS 7 at the same time to build leptess? |
On windows, LLVM doesn't provide llvm-config. You must set LIBCLANG_PATH environment variable to \bin folder "tasks": [
{
"type": "cargo",
"command": "build",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"env": {
"LIBCLANG_PATH": "e:\\llvm\\bin",
"VCPKGRS_DYNAMIC": "1",
"VCPKG_ROOT": "e:\\vcpkg"
}
},
"label": "rust: cargo build"
}
]
|
@ccouzens Hello, I don't mind if you forward windows build related issues to me in the future. I'm not monitoring this repo constantly so just mention my name in the message so I'll get a notification |
Hi @rucoder - thank you- I'll do that in future 😄 |
@rucoder are you by any chance able to shed some light on this one? Caused by: --- stderr error: build failed I did try adding these env variables manually after getting this error the first time, but despite doing that (and restarting of course) I'm still unable to get a windows build going. TY in advance. |
I may have resolved this -- or hit an error in the process of 'fixing' it -- will move that error to the leptonica-sys repo as that's the source.. |
@ccouzens I have solved the clang problem by installing llvm via the winget tool. it will then find the dll automatically. However, I am now a step further but I get linking errors. Both dynamically and statically. Do you have any idea how to fix this? I am on windows 11. For example, I used: # To install the LLVM (clang)
winget install LLVM
# the vcpkg dependencies
.\vcpkg.exe install tesseract:x64-windows-static
.\vcpkg.exe install leptonica:x64-windows-static
# the linker initially fails, so updated this to be windows msvc
rustup default stable-x86_64-pc-windows-msvc cargo config
The only dependency I have is leptess
This is the error I get when building:
|
There's a weird workaround in windows. Add openssl as your dependencies and on top of your main.rs add so this is my program. It compiles on windows: main.rs const IMAGE_PATH:&str = "test1.png";
mod ocr_wrapper;
use ocr_wrapper::ocr;
fn main() {
let text = ocr(IMAGE_PATH).unwrap();
println!("{}",text);
} ocr_wrapper.rs use leptess::LepTess;
pub use openssl; //this is necessary
pub fn ocr(image:&str)->Result<String, std::str::Utf8Error>{
let mut ocr = LepTess::new(None, "eng").expect("Load OCR Fail");
ocr.set_image(image).expect("Error Reading Image");
ocr.get_utf8_text()
} Cargo.toml [dependencies]
leptess = "0.14.0"
openssl = "0.10.57" |
i'm a novice on compile, maybe this crate can add openssl when use static link. i see the error is about openssl. |
i'm win10 os
Cargo.toml
occur problem
The text was updated successfully, but these errors were encountered: