Mismatched types cross compiling asio-sys with x86_64-pc-windows-gnu
Hello, trying to cross-compile CPAL with the asio feature from a Linux box to Windows (x86_64-pc-windows-gnu) gives me this compile error
$ cargo build --target x86_64-pc-windows-gnu --features asio
Compiling asio-sys v0.2.2 (.../Developer/cpal/asio-sys)
error[E0308]: mismatched types
--> asio-sys/src/bindings/mod.rs:1029:36
|
1029 | time.time_info.flags = (ai::AsioTimeInfoFlags::kSystemTimeValid
| _____________--------------------___^
| | |
| | expected due to the type of this binding
1030 | | | ai::AsioTimeInfoFlags::kSamplePositionValid)
1031 | | // Context about the cast:
1032 | | //
... |
1049 | | // } AsioTimeInfoFlags;
1050 | | .0;
| |__________________^ expected `i32`, found `u32`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `asio-sys` (lib) due to 1 previous error
It could be I'm missing something? I'm not sure, cross-compiling can be a bit of a heck. I tried using both cross and without cross to build, with the same error both times - gonna put both ways I've reproduced it below, though they are very similar.
Reproing with cross
- Clone CPAL -
git clone https://github.com/RustAudio/cpal.git - Edit
Cross.tomlto add the following lines
[target.x86_64-pc-windows-gnu]
# Needed for unzipping the ASIO SDK
pre-build = [
"apt-get update && apt-get --assume-yes install unzip",
]
[target.x86_64-pc-windows-gnu.env]
# TODO: Not make assumptions about what version of LLVM the cross image uses
# This is needed so we don't get errors about a missing x86intrin.h header
# I end up getting the same errors using `CPLUS_INCLUDE_PATH` as well instead of `BINDGEN_CLANG_EXTRA_ARGS`
# And trying to use the MinGW include paths instead of the LLVM one here (/usr/lib/gcc/x86_64-w64-mingw32/7.3-{posix,win32}/include) gives me undefined symbol errors
passthrough = [
"BINDGEN_CLANG_EXTRA_ARGS=-I/usr/lib/llvm-6.0/lib/clang/6.0.0/include",
]
- Run
cross build --target x86_64-pc-windows-gnu --features asio - Observe the mismatched types error
Reproing without cross
- Clone CPAL -
git clone https://github.com/RustAudio/cpal.git - Grab MinGW w64 headers (
pacman -S mingw-w64-headersfor me on Arch) export CPLUS_INCLUDE_PATH="/usr/x86_64-w64-mingw32/include"- Run
cargo build --target x86_64-pc-windows-gnu --features asio - Observe the mismatched types error
This is using CPAL commit ac6cbb2ba55e61665a35ab88ae136a83380d1354
I just made a workaround for this. https://github.com/RustAudio/cpal/pull/880
https://github.com/RustAudio/cpal/pull/880
Yup that seems to have done it, thanks! (or, at least it compiles now heh)