antimatter15 / tesseract-rs

Rust bindings for Tesseract
MIT License
144 stars 31 forks source link

Can't compile. `stdatomic.h` not found in Window 10 #37

Open Multirious opened 1 year ago

Multirious commented 1 year ago

I'm not sure what went wrong with the installation process. I did exactly what tesseract-sys/leptonica-sys told me to do. I also installed leptonica:x64-windows-static-md because one of the build errors is about missing that installation. Before actually being able to install with vcpkg: I also got an error trying to vcpkg integrate install; from searching and screwing around, I seem to kinda fix it by adding more components to Visual Studio.

Error:

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

Caused by:
  process didn't exit successfully: `C:\Users\Windows10\Projects\Rust\cargo_target\debug\build\leptonica-sys-b0ac22be7bbc120f\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=LEPTONICA_INCLUDE_PATH
  cargo:rerun-if-env-changed=LEPTONICA_LINK_PATHS
  cargo:rerun-if-env-changed=LEPTONICA_LINK_LIBS
  cargo:rustc-link-search=native=C:\Users\Windows10\Desktop\vcpkg\installed\x64-windows-static-md\lib
  cargo:rustc-link-lib=leptonica-1.83.1
  cargo:rustc-link-lib=zlib
  cargo:rustc-link-lib=tiff
  cargo:rustc-link-lib=lzma
  cargo:rustc-link-lib=jpeg
  cargo:rustc-link-lib=turbojpeg
  cargo:rustc-link-lib=openjp2
  cargo:rustc-link-lib=libwebpdecoder
  cargo:rustc-link-lib=libwebpdemux
  cargo:rustc-link-lib=libwebpmux
  cargo:rustc-link-lib=libwebp
  cargo:rustc-link-lib=libsharpyuv
  cargo:rustc-link-lib=libpng16
  cargo:rustc-link-lib=gif

  --- stderr
  C:\Users\Windows10\Desktop\vcpkg\installed\x64-windows-static-md\include\leptonica/environ.h:69:10: fatal error: 'stdatomic.h' file not found
  thread 'main' panicked at 'Unable to generate bindings: ClangDiagnostic("C:\\Users\\Windows10\\Desktop\\vcpkg\\installed\\x64-windows-static-md\\include\\leptonica/environ.h:69:10: fatal error: 'stdatomic.h' file not found\n")', C:\Users\Windows10\.cargo\registry\src\github.com-1ecc6299db9ec823\leptonica-sys-0.4.4\build.rs:87:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ccouzens commented 1 year ago

Hi,

I'm sorry you're having this build issue.

I'm going to transfer this issue to https://github.com/ccouzens/leptonica-sys/

I don't know much about vcpk and can't easily replicate Windows build issues.

It looks like this line is causing you issues: https://github.com/DanBloomberg/leptonica/blob/1.83/src/environ.h#L69

stdatomic.h looks like it's usually provided by the c compiler. https://en.wikibooks.org/wiki/C_Programming/stdatomic.h

I don't suppose you can easily see if vcpk installed stdatomic.h for you? Possibly it's there, but not being picked up. Or maybe it wasn't installed by vcpk.

ccouzens commented 1 year ago

I'm going to transfer this issue to https://github.com/ccouzens/leptonica-sys/

I can't do this, because the projects are different users.

Multirious commented 1 year ago

I'm going to transfer this issue to https://github.com/ccouzens/leptonica-sys/

I can't do this, because the projects are different users.

Should I recreate this issue into that repository?

ccouzens commented 1 year ago

Yes please, that would be helpful