You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.
Cross compiling from a linux host to a windows target is broken.
The problem is, that libpng's configure script expects a proper --host argument. In my case it was --host=x86_64-w64-mingw32.
In the current build system I have no idea how to fix this properly, as Rust uses LLVM target triplets: x86_64-pc-windows-gnu for Rust vs x86_64-w64-mingw32 for the gcc toolchain in my case. As CC and co already has to be set for it to work, maybe you could try extracting the triplet from it in the build.rs or configure.
The text was updated successfully, but these errors were encountered:
Yes, png-sys/build.rs does not have any cross compilation support except for android target.
For now we may add some more flags like:
- if is_android {- cmd.arg("--host=arm-linux-gnueabi");++ if target != env::var("HOST").unwrap() {+ if is_android {+ cmd.arg("--host=arm-linux-gnueabi");+ } else if target.find("windows").is_some() {+ cmd.arg("--host=x86_64-w64-mingw32"); // or "i686-w64-mingw32" for 32-bit.+ }
so the build could proceed a bit:
$ cargo build -v --target=x86_64-pc-windows-gnu
...
running: "/media/data/src/servo-modules/rust-png/png-sys/libpng-1.6.16/configure"
"--with-libpng-prefix=RUST_" "--host=x86_64-w64-mingw32"
...
checking for zlibVersion in -lz... no
checking for z_zlibVersion in -lz... no
...
configure: error: zlib not installed
I don't have zlib right now so I just paused here.
The build succeeded for me after adding the flag manually, although I just made it unconditional as there's no clear way of doing it right. Adding separate hacks for every cross-compilation triplet is not a good idea.
A slightly better solution might be replacing the libpng build system with something sane.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Cross compiling from a linux host to a windows target is broken.
The problem is, that libpng's configure script expects a proper
--host
argument. In my case it was--host=x86_64-w64-mingw32
.In the current build system I have no idea how to fix this properly, as Rust uses LLVM target triplets: x86_64-pc-windows-gnu for Rust vs x86_64-w64-mingw32 for the gcc toolchain in my case. As CC and co already has to be set for it to work, maybe you could try extracting the triplet from it in the build.rs or configure.
The text was updated successfully, but these errors were encountered: