houqp / leptess

Productive and safe Rust binding for leptonica and tesseract
https://houqp.github.io/leptess/leptess/index.html
MIT License
258 stars 28 forks source link

Clang Windows issue #19

Open adminSxs opened 4 years ago

adminSxs commented 4 years ago

i'm win10 os

Cargo.toml

leptess="*"

occur problem

warning: couldn't execute `llvm-config --prefix` (error: 系统找不到指定的文件。 (os error 2))
warning: set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable

error: failed to run custom build command for `leptonica-sys v0.3.1`

Caused by:
  process didn't exit successfully: `D:\rust\ocr_demo\target\debug\build\leptonica-sys-1b488999bb961182\build-script-build` (exit code: 101)
--- stdout
vcpkg build helper copied D:\software\vcpkg\installed\x64-windows\bin\leptonica-1.78.0.dll to D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out\leptonica-1.78.0.dll
vcpkg build helper copied D:\software\vcpkg\installed\x64-windows\bin\webp.dll to D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out\webp.dll
vcpkg build helper copied D:\software\vcpkg\installed\x64-windows\bin\webpdecoder.dll to D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out\webpdecoder.dll
vcpkg build helper copied D:\software\vcpkg\installed\x64-windows\bin\webpdemux.dll to D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out\webpdemux.dll
vcpkg build helper copied D:\software\vcpkg\installed\x64-windows\bin\tiff.dll to D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out\tiff.dll
vcpkg build helper copied D:\software\vcpkg\installed\x64-windows\bin\lzma.dll to D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out\lzma.dll
vcpkg build helper copied D:\software\vcpkg\installed\x64-windows\bin\jpeg62.dll to D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out\jpeg62.dll
vcpkg build helper copied D:\software\vcpkg\installed\x64-windows\bin\turbojpeg.dll to D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out\turbojpeg.dll
vcpkg build helper copied D:\software\vcpkg\installed\x64-windows\bin\zlib1.dll to D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out\zlib1.dll
vcpkg build helper copied D:\software\vcpkg\installed\x64-windows\bin\libpng16.dll to D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out\libpng16.dll
cargo:rustc-link-search=native=D:\software\vcpkg\installed\x64-windows\lib
cargo:rustc-link-search=native=D:\software\vcpkg\installed\x64-windows\bin
cargo:rustc-link-lib=leptonica-1.78.0
cargo:rustc-link-lib=webp
cargo:rustc-link-lib=webpdecoder
cargo:rustc-link-lib=webpdemux
cargo:rustc-link-lib=gif
cargo:rustc-link-lib=tiff
cargo:rustc-link-lib=tiffxx
cargo:rustc-link-lib=lzma
cargo:rustc-link-lib=jpeg
cargo:rustc-link-lib=turbojpeg
cargo:rustc-link-lib=zlib
cargo:rustc-link-lib=libpng16
cargo:rustc-link-search=native=D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out
cargo:rustc-link-search=D:\rust\ocr_demo\target\debug\build\leptonica-sys-58d4064f8974f8fc\out
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
stack backtrace:
   0: backtrace::backtrace::trace_unsynchronized
             at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.46\src\backtrace\mod.rs:66
   1: std::sys_common::backtrace::_print_fmt
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\sys_common\backtrace.rs:78
   2: std::sys_common::backtrace::_print::{{impl}}::fmt
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\sys_common\backtrace.rs:59
   3: core::fmt::write
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libcore\fmt\mod.rs:1076
   4: std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\io\mod.rs:1537
   5: std::sys_common::backtrace::_print
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\sys_common\backtrace.rs:62
   6: std::sys_common::backtrace::print
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\sys_common\backtrace.rs:49
   7: std::panicking::default_hook::{{closure}}
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\panicking.rs:198
   8: std::panicking::default_hook
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\panicking.rs:218
   9: std::panicking::rust_panic_with_hook
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\panicking.rs:486
  10: std::panicking::begin_panic_handler
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\panicking.rs:388
  11: core::panicking::panic_fmt
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libcore\panicking.rs:101
  12: core::option::expect_none_failed
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libcore\option.rs:1272
  13: core::result::Result<(), alloc::string::String>::expect<(),alloc::string::String>
             at D:\software\rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libcore\result.rs:963
  14: core::ops::function::FnOnce::call_once<fn() -> alloc::sync::Arc<clang_sys::SharedLibrary>,()>
             at D:\software\rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libcore\ops\function.rs:232
  15: lazy_static::lazy::{{impl}}::get::{{closure}}<alloc::sync::Arc<clang_sys::SharedLibrary>,fn() -> alloc::sync::Arc<clang_sys::SharedLibrary>>
             at D:\software\cargo\registry\src\github.com-1ecc6299db9ec823\lazy_static-1.4.0\src\inline_lazy.rs:31
  16: std::sync::once::{{impl}}::call_once::{{closure}}<closure-0>
             at D:\software\rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libstd\sync\once.rs:264
  17: std::sync::once::Once::call_inner
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\sync\once.rs:416
  18: std::sync::once::Once::call_once<closure-0>
             at D:\software\rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libstd\sync\once.rs:264
  19: bindgen::ensure_libclang_is_loaded::{{impl}}::deref::__stability
             at D:\software\cargo\registry\src\github.com-1ecc6299db9ec823\lazy_static-1.4.0\src\lib.rs:142
  20: bindgen::ensure_libclang_is_loaded::{{impl}}::deref
             at D:\software\cargo\registry\src\github.com-1ecc6299db9ec823\lazy_static-1.4.0\src\lib.rs:144
  21: bindgen::ensure_libclang_is_loaded
             at D:\software\cargo\registry\src\github.com-1ecc6299db9ec823\bindgen-0.52.0\src\lib.rs:1903
  22: bindgen::Bindings::generate
             at D:\software\cargo\registry\src\github.com-1ecc6299db9ec823\bindgen-0.52.0\src\lib.rs:1921
  23: bindgen::Builder::generate
             at D:\software\cargo\registry\src\github.com-1ecc6299db9ec823\bindgen-0.52.0\src\lib.rs:1375
  24: build_script_build::main
             at .\build.rs:35
  25: std::rt::lang_start::{{closure}}<()>
             at D:\software\rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libstd\rt.rs:67
  26: std::rt::lang_start_internal::{{closure}}
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\rt.rs:52
  27: std::panicking::try::do_call
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\panicking.rs:297
  28: std::panicking::try
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\panicking.rs:274
  29: std::panic::catch_unwind
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\panic.rs:394
  30: std::rt::lang_start_internal
             at /rustc/5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2\/src\libstd\rt.rs:51
  31: std::rt::lang_start<()>
             at D:\software\rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libstd\rt.rs:67
  32: main
  33: invoke_main
             at d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  34: __scrt_common_main_seh
             at d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  35: BaseThreadInitThunk
  36: RtlUserThreadStart
ccouzens commented 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

adminSxs commented 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

yes image

ccouzens commented 4 years ago

Ok, I'll try in Windows 10 tonight and see what needs to be done

adminSxs commented 4 years ago

Ok, I'll try in Windows 10 tonight and see what needs to be done

Ok,thanks.

ccouzens commented 4 years ago

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.

adminSxs commented 4 years ago

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

adminSxs commented 4 years ago

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.
ccouzens commented 4 years ago

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?

rucoder commented 3 years ago

On windows, LLVM doesn't provide llvm-config. You must set LIBCLANG_PATH environment variable to \bin folder For example, I'm using this In my launch.json

    "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"
        }
    ]
rucoder commented 3 years ago

@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

ccouzens commented 3 years ago

Hi @rucoder - thank you- I'll do that in future :smile:

alphastrata commented 2 years ago

@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 fortesseract-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.

alphastrata commented 2 years ago

@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 fortesseract-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.

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..

metalglove commented 1 year ago

@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 
newholder commented 12 months ago

@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"
haohanyuzmx commented 11 months ago

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.