Open adminSxs opened 4 years ago
Hi @adminSxs,
I'll try building on Windows 10 tonight.
Have you already installed Microsoft's vcpkg
and run .\vcpkg install tesseract:x64-windows
?
https://github.com/houqp/leptess/blob/master/README.md#windows
Hi @adminSxs,
I'll try building on Windows 10 tonight.
Have you already installed Microsoft's vcpkg and run
.\vcpkg install tesseract:x64-windows
?https://github.com/houqp/leptess/blob/master/README.md#windows
yes
Ok, I'll try in Windows 10 tonight and see what needs to be done
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.
cargo:warning=couldn't execute `llvm-config --prefix` (error: 系统找不到指定的文件。 (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable
--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'clang.dll\', \'libclang.dll\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', D:\software\cargo\registry\src\github.com-1ecc6299db9ec823\bindgen-0.52.0\src/lib.rs:1895:13
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? https://releases.llvm.org/download.html https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe
If this works, I'll update the Readme to include this step.
Sorry if I'm not very useful at this issue. I don't use Windows much.
There seem to be 2 errors.
cargo:warning=couldn't execute `llvm-config --prefix` (error: 系统找不到指定的文件。 (os error 2)) cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable --- stderr thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'clang.dll\', \'libclang.dll\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', D:\software\cargo\registry\src\github.com-1ecc6299db9ec823\bindgen-0.52.0\src/lib.rs:1895:13
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? https://releases.llvm.org/download.html https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe
If this works, I'll update the Readme to include this step.
I have installed llvm ,but still same error
Sorry if I'm not very useful at this issue. I don't use Windows much.
There seem to be 2 errors.
cargo:warning=couldn't execute `llvm-config --prefix` (error: 系统找不到指定的文件。 (os error 2)) cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable --- stderr thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'clang.dll\', \'libclang.dll\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', D:\software\cargo\registry\src\github.com-1ecc6299db9ec823\bindgen-0.52.0\src/lib.rs:1895:13
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? https://releases.llvm.org/download.html https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe
If this works, I'll update the Readme to include this step.
I use centos:7 to build
Caused by:
process didn't exit successfully: `/home/whizhome/Desktop/rust/ocr_demo/target/debug/build/leptonica-sys-68fefed8a9170e23/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=lept
cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable
--- stderr
thread 'main' panicked at 'Unable to find libclang: "the `libclang` shared library at /usr/lib64/clang-private/libclang.so.6.0 could not be opened: libclangAST.so.6: cannot open shared object file: No such file or directory"', /home/whizhome/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.52.0/src/lib.rs:1895:13
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1076
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1537
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:218
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:486
11: rust_begin_unwind
at src/libstd/panicking.rs:388
12: core::panicking::panic_fmt
at src/libcore/panicking.rs:101
13: core::option::expect_none_failed
at src/libcore/option.rs:1272
14: core::result::Result<T,E>::expect
at /home/whizhome/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/result.rs:963
15: <bindgen::ensure_libclang_is_loaded::LIBCLANG as core::ops::deref::Deref>::deref::__static_ref_initialize
at /home/whizhome/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.52.0/src/lib.rs:1895
16: core::ops::function::FnOnce::call_once
at /home/whizhome/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:232
17: lazy_static::lazy::Lazy<T>::get::{{closure}}
at /home/whizhome/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs:31
18: std::sync::once::Once::call_once::{{closure}}
at /home/whizhome/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/sync/once.rs:264
19: std::sync::once::Once::call_inner
at src/libstd/sync/once.rs:416
20: std::sync::once::Once::call_once
at /home/whizhome/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/sync/once.rs:264
21: lazy_static::lazy::Lazy<T>::get
at /home/whizhome/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs:30
22: <bindgen::ensure_libclang_is_loaded::LIBCLANG as core::ops::deref::Deref>::deref::__stability
at /home/whizhome/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs:142
23: <bindgen::ensure_libclang_is_loaded::LIBCLANG as core::ops::deref::Deref>::deref
at /home/whizhome/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs:144
24: bindgen::ensure_libclang_is_loaded
at /home/whizhome/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.52.0/src/lib.rs:1903
25: bindgen::Bindings::generate
at /home/whizhome/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.52.0/src/lib.rs:1921
26: bindgen::Builder::generate
at /home/whizhome/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.52.0/src/lib.rs:1375
27: build_script_build::main
at ./build.rs:35
28: std::rt::lang_start::{{closure}}
at /home/whizhome/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:67
29: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:52
30: std::panicking::try::do_call
at src/libstd/panicking.rs:297
31: std::panicking::try
at src/libstd/panicking.rs:274
32: std::panic::catch_unwind
at src/libstd/panic.rs:394
33: std::rt::lang_start_internal
at src/libstd/rt.rs:51
34: std::rt::lang_start
at /home/whizhome/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:67
35: main
36: __libc_start_main
37: <unknown>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
i'm win10 os
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
"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 :smile:
@rucoder are you by any chance able to shed some light on this one?
PowerShell 7.3.0-preview.3 PS C:\Users\jer\Documents\GitHub\eldenswing> cd .\ocr\ PS C:\Users\jer\Documents\GitHub\eldenswing\ocr> cargo build Blocking waiting for file lock on package cache Compiling leptonica-sys v0.4.1 Compiling tesseract-sys v0.5.12 error: failed to run custom build command for
tesseract-sys v0.5.12`
Caused by:
process didn't exit successfully: C:\Users\jer\Documents\GitHub\eldenswing\ocr\target\debug\build\tesseract-sys-e068160e6754890c\build-script-build
(exit code: 101)
--- stdout
cargo:rerun-if-env-changed=TESSERACT_INCLUDE_PATHS
cargo:rerun-if-env-changed=TESSERACT_LINK_PATHS
cargo:rerun-if-env-changed=TESSERACT_LINK_LIBS
--- stderr
thread 'main' panicked at 'called Result::unwrap()
on an Err
value: LibNotFound("package tesseract is not installed for vcpkg triplet x64-windows-static-md")', C:\Users\jer.cargo\registry\src\github.com-1ecc6299db9ec823\tesseract-sys-0.5.12\build.rs:16:66
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: renaming of the library C
was specified, however this crate contains no #[link(...)]
attributes referencing this library
error: build failed ` I installed tesseract via vcpkg as per the instructions...
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.
@rucoder are you by any chance able to shed some light on this one?
PowerShell 7.3.0-preview.3 PS C:\Users\jer\Documents\GitHub\eldenswing> cd .\ocr\ PS C:\Users\jer\Documents\GitHub\eldenswing\ocr> cargo build Blocking waiting for file lock on package cache Compiling leptonica-sys v0.4.1 Compiling tesseract-sys v0.5.12 error: failed to run custom build command for
tesseract-sys v0.5.12`Caused by: process didn't exit successfully:
C:\Users\jer\Documents\GitHub\eldenswing\ocr\target\debug\build\tesseract-sys-e068160e6754890c\build-script-build
(exit code: 101) --- stdout cargo:rerun-if-env-changed=TESSERACT_INCLUDE_PATHS cargo:rerun-if-env-changed=TESSERACT_LINK_PATHS cargo:rerun-if-env-changed=TESSERACT_LINK_LIBS--- stderr thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: LibNotFound("package tesseract is not installed for vcpkg triplet x64-windows-static-md")', C:\Users\jer.cargo\registry\src\github.com-1ecc6299db9ec823\tesseract-sys-0.5.12\build.rs:16:66 note: run withRUST_BACKTRACE=1
environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... error: renaming of the libraryC
was specified, however this crate contains no#[link(...)]
attributes referencing this libraryerror: build failed ` I installed tesseract via vcpkg as per the instructions...
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
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
The only dependency I have is leptess cargo toml
[dependencies]
leptess = "0.14.0"
This is the error I get when building:
Compiling rstool v0.1.0 (C:\Users\mario\source\repos\rs-tool\rstool)
error: linking with `link.exe` failed: exit code: 1120
|
= note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\mario\\AppData\\Local\\Temp\\rustcyeSkcs\\symbols.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.1eojtbsqf0jv8uyc.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.1j2gsz8yo3d5m1vp.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.1mv2n3jnuo0ggyrz.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.26pte4g29lzwbuvg.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.2kwhjcdmf9y9w0xl.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.2xri25j6teol12a.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.32yc3tyi5p4gtuv0.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.4q31ko7x4m4xvc3k.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.70sjcfuy6xr4fpz.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.7i9pp5qw1zlirze.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.dza6eblk7jricq9.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.ykztod0j499tzyi.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.12qumreo4io30fv9.rcgu.o" "/LIBPATH:C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps" "/LIBPATH:C:\\src\\vcpkg\\vcpkg\\installed\\x64-windows-static\\lib" "/LIBPATH:C:\\src\\vcpkg\\vcpkg\\installed\\x64-windows-static\\lib" "/LIBPATH:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libleptess-7e29d9a770d2873b.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libtesseract_plumbing-55a74dc2171e9e29.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libleptonica_plumbing-f708cb5882f0ac65.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\liblibc-6dd16a07e849f54f.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libtesseract_sys-78ed2fa4e3fa84f5.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libleptonica_sys-6524771d274ac212.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libthiserror-8213cad2d06bbc0a.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-43ecf4bdbb5e1e31.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-03eee9fc7fe44114.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-f350829ea004292f.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-52475675c4d47720.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-d28662d15d021313.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libminiz_oxide-f5a9ba230b395602.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libadler-adcc534ee710b11e.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-75e91ab7163af4fe.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-6c926cb6aa5ed58c.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-b2a86741ec07ae31.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-ecdbc3c93c11f60c.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-39d88c9804b36d9f.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-2e112df156ffddae.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-bd7106b7f2a04ee0.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-d62a26418f17519a.rlib" "legacy_stdio_definitions.lib" "tesseract53.lib" "archive.lib" "zstd.lib" "lzma.lib" "lz4.lib" "libxml2.lib" "zlib.lib" "charset.lib" "iconv.lib" "libssl.lib" "libcrypto.lib" "bz2.lib" "leptonica-1.83.1.lib" "tiff.lib" "jpeg.lib" "turbojpeg.lib" "openjp2.lib" "libwebpdecoder.lib" "libwebpdemux.lib" "libwebpmux.lib" "libwebp.lib" "libsharpyuv.lib" "libpng16.lib" "gif.lib" "libcurl.lib" "leptonica-1.83.1.lib" "zlib.lib" "tiff.lib" "lzma.lib" "jpeg.lib" "turbojpeg.lib" "openjp2.lib" "libwebpdecoder.lib" "libwebpdemux.lib" "libwebpmux.lib" "libwebp.lib" "libsharpyuv.lib" "libpng16.lib" "gif.lib" "kernel32.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "ws2_32.lib" "bcrypt.lib" "libcmt.lib" "legacy_stdio_definitions.lib" "/NXCOMPAT" "/LIBPATH:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
= note: libcrypto.lib(libcrypto-lib-cryptlib.obj) : error LNK2019: unresolved external symbol __imp_GetProcessWindowStation referenced in function OPENSSL_isservice
libcrypto.lib(libcrypto-lib-cryptlib.obj) : error LNK2019: unresolved external symbol __imp_GetUserObjectInformationW referenced in function OPENSSL_isservice
libcrypto.lib(libcrypto-lib-cryptlib.obj) : error LNK2019: unresolved external symbol __imp_MessageBoxW referenced in function OPENSSL_showfatal
libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertOpenStore referenced in function capi_open_store
libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertOpenStore
libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertOpenStore
libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertCloseStore referenced in function capi_find_key
libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertCloseStore
libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertCloseStore
libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertEnumCertificatesInStore referenced in function capi_find_cert
libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertEnumCertificatesInStore
libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertFindCertificateInStore referenced in function capi_find_cert
libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertFindCertificateInStore
libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertDuplicateCertificateContext referenced in function capi_load_ssl_client_cert
libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateContext referenced in function capi_dsa_free
libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateContext
libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateContext
libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertGetCertificateContextProperty referenced in function capi_cert_get_fname
libcurl.lib(schannel.c.obj) : error LNK2019: unresolved external symbol __imp_CryptStringToBinaryW referenced in function schannel_acquire_credential_handle
libcurl.lib(schannel.c.obj) : error LNK2019: unresolved external symbol __imp_PFXImportCertStore referenced in function schannel_acquire_credential_handle
libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CryptDecodeObjectEx referenced in function Curl_verify_certificate
libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertAddCertificateContextToStore referenced in function add_certs_data_to_store
libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertFindExtension referenced in function Curl_verify_certificate
libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertGetNameStringW referenced in function Curl_verify_certificate
libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CryptQueryObject referenced in function add_certs_data_to_store
libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertCreateCertificateChainEngine referenced in function Curl_verify_certificate
libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateChainEngine referenced in function Curl_verify_certificate
libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertGetCertificateChain referenced in function Curl_verify_certificate
libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateChain referenced in function Curl_verify_certificate
C:\Users\mario\source\repos\rs-tool\rstool\target\debug\deps\rstool.exe : fatal error LNK1120: 21 unresolved externals
@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
[target.x86_64-pc-windows-msvc] rustflags = ["-C", "target-feature=+crt-static"]
The only dependency I have is leptess cargo toml
[dependencies] leptess = "0.14.0"
This is the error I get when building:
Compiling rstool v0.1.0 (C:\Users\mario\source\repos\rs-tool\rstool) error: linking with `link.exe` failed: exit code: 1120 | = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\mario\\AppData\\Local\\Temp\\rustcyeSkcs\\symbols.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.1eojtbsqf0jv8uyc.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.1j2gsz8yo3d5m1vp.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.1mv2n3jnuo0ggyrz.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.26pte4g29lzwbuvg.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.2kwhjcdmf9y9w0xl.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.2xri25j6teol12a.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.32yc3tyi5p4gtuv0.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.4q31ko7x4m4xvc3k.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.70sjcfuy6xr4fpz.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.7i9pp5qw1zlirze.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.dza6eblk7jricq9.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.ykztod0j499tzyi.rcgu.o" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.12qumreo4io30fv9.rcgu.o" "/LIBPATH:C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps" "/LIBPATH:C:\\src\\vcpkg\\vcpkg\\installed\\x64-windows-static\\lib" "/LIBPATH:C:\\src\\vcpkg\\vcpkg\\installed\\x64-windows-static\\lib" "/LIBPATH:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libleptess-7e29d9a770d2873b.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libtesseract_plumbing-55a74dc2171e9e29.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libleptonica_plumbing-f708cb5882f0ac65.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\liblibc-6dd16a07e849f54f.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libtesseract_sys-78ed2fa4e3fa84f5.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libleptonica_sys-6524771d274ac212.rlib" "C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\libthiserror-8213cad2d06bbc0a.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-43ecf4bdbb5e1e31.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-03eee9fc7fe44114.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-f350829ea004292f.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-52475675c4d47720.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-d28662d15d021313.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libminiz_oxide-f5a9ba230b395602.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libadler-adcc534ee710b11e.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-75e91ab7163af4fe.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-6c926cb6aa5ed58c.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-b2a86741ec07ae31.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-ecdbc3c93c11f60c.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-39d88c9804b36d9f.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-2e112df156ffddae.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-bd7106b7f2a04ee0.rlib" "C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-d62a26418f17519a.rlib" "legacy_stdio_definitions.lib" "tesseract53.lib" "archive.lib" "zstd.lib" "lzma.lib" "lz4.lib" "libxml2.lib" "zlib.lib" "charset.lib" "iconv.lib" "libssl.lib" "libcrypto.lib" "bz2.lib" "leptonica-1.83.1.lib" "tiff.lib" "jpeg.lib" "turbojpeg.lib" "openjp2.lib" "libwebpdecoder.lib" "libwebpdemux.lib" "libwebpmux.lib" "libwebp.lib" "libsharpyuv.lib" "libpng16.lib" "gif.lib" "libcurl.lib" "leptonica-1.83.1.lib" "zlib.lib" "tiff.lib" "lzma.lib" "jpeg.lib" "turbojpeg.lib" "openjp2.lib" "libwebpdecoder.lib" "libwebpdemux.lib" "libwebpmux.lib" "libwebp.lib" "libsharpyuv.lib" "libpng16.lib" "gif.lib" "kernel32.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "ws2_32.lib" "bcrypt.lib" "libcmt.lib" "legacy_stdio_definitions.lib" "/NXCOMPAT" "/LIBPATH:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:C:\\Users\\mario\\source\\repos\\rs-tool\\rstool\\target\\debug\\deps\\rstool.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\mario\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis" = note: libcrypto.lib(libcrypto-lib-cryptlib.obj) : error LNK2019: unresolved external symbol __imp_GetProcessWindowStation referenced in function OPENSSL_isservice libcrypto.lib(libcrypto-lib-cryptlib.obj) : error LNK2019: unresolved external symbol __imp_GetUserObjectInformationW referenced in function OPENSSL_isservice libcrypto.lib(libcrypto-lib-cryptlib.obj) : error LNK2019: unresolved external symbol __imp_MessageBoxW referenced in function OPENSSL_showfatal libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertOpenStore referenced in function capi_open_store libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertOpenStore libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertOpenStore libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertCloseStore referenced in function capi_find_key libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertCloseStore libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertCloseStore libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertEnumCertificatesInStore referenced in function capi_find_cert libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertEnumCertificatesInStore libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertFindCertificateInStore referenced in function capi_find_cert libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertFindCertificateInStore libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertDuplicateCertificateContext referenced in function capi_load_ssl_client_cert libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateContext referenced in function capi_dsa_free libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateContext libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateContext libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019: unresolved external symbol __imp_CertGetCertificateContextProperty referenced in function capi_cert_get_fname libcurl.lib(schannel.c.obj) : error LNK2019: unresolved external symbol __imp_CryptStringToBinaryW referenced in function schannel_acquire_credential_handle libcurl.lib(schannel.c.obj) : error LNK2019: unresolved external symbol __imp_PFXImportCertStore referenced in function schannel_acquire_credential_handle libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CryptDecodeObjectEx referenced in function Curl_verify_certificate libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertAddCertificateContextToStore referenced in function add_certs_data_to_store libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertFindExtension referenced in function Curl_verify_certificate libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertGetNameStringW referenced in function Curl_verify_certificate libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CryptQueryObject referenced in function add_certs_data_to_store libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertCreateCertificateChainEngine referenced in function Curl_verify_certificate libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateChainEngine referenced in function Curl_verify_certificate libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertGetCertificateChain referenced in function Curl_verify_certificate libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateChain referenced in function Curl_verify_certificate C:\Users\mario\source\repos\rs-tool\rstool\target\debug\deps\rstool.exe : fatal error LNK1120: 21 unresolved externals
There's a weird workaround in windows. Add openssl as your dependencies and on top of your main.rs add use openssl
. somehow this works for me or. But this way, Clippy will complain. To shut them up. Re-Export openssl.
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"
There's a weird workaround in windows. Add openssl as your dependencies and on top of your main.rs add use openssl. somehow this works for me or. But this way, Clippy will complain. To shut them up. Re-Export openssl.
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