psychonautwiki / rust-ul-sys

Low Level Bindings to Ultralight Framework (Ultralight, AppCore)
18 stars 10 forks source link

Fails to build on Windows #1

Closed AlphaModder closed 3 years ago

AlphaModder commented 4 years ago

Trying to build this crate on Windows (x86_64-pc-windows-msvc) gave the following error message:

error: failed to run custom build command for `ul-sys v1.1.2`

Caused by:
  process didn't exit successfully: `C:\...\target\debug\build\ul-sys-514ea3d5a7d6b03f\build-script-build` (exit code: 101)
  --- stdout
  cargo:rustc-flags=-L /usr/local/lib/
  cargo:rustc-link-search=/usr/local/lib/
  cargo:rustc-link-lib=Ultralight
  cargo:rustc-link-lib=WebCore
  cargo:rustc-link-lib=AppCore

  --- stderr
  wrapper/UltralightCAPI.h:694:45: error: unknown type name 'uintptr_t'
  wrapper/UltralightCAPI.h:694:63: error: unknown type name 'intptr_t'
  wrapper/UltralightCAPI.h:694:45: error: unknown type name 'uintptr_t', err: true
  wrapper/UltralightCAPI.h:694:63: error: unknown type name 'intptr_t', err: true
  thread 'main' panicked at 'Unable to generate bindings: ()', C:\...\.cargo\registry\src\github.com-1ecc6299db9ec823\ul-sys-1.1.2\build.rs:30:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

I assume this has something to do with the presence of uintptr_t and intptr_t without importing a header differing across compilers/platforms. I was able to solve the problem by simply adding #include <stdint.h> to the top of wrapper.h, but my experience using bindgen is limited, so there may be a better way.

19h commented 4 years ago

@AlphaModder I'm not entirely sure how to replicate this. Can you create a PR adding the include to the wrapper so that I can test it on mulitple other platforms?

AlphaModder commented 4 years ago

Yeah, sure. Here you go: #2