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
Build scripts, such as your build.rs, since they are built for execution on the compiling machine, don't receive the --target i686-β¦ memo. As a result, their cfg!(target_arch) always matches the architecture of the rustc which compiles them - usually x86_64.
Because build.rs always sees x86_64, cross-compilation of your library from x86_64 hosts always fails, except for the scenario where a Windows user installs the whole 32-bit Rust toolchain (which 64-bit Windows happens to be able to execute thanks to WOW64) and uses it to compile the 32-bit plugin - I believe this is what you did.
When I removed build.rs in my fork, cross-compilation from x86_64 Windows (using the default stable-x86_64-pc-windows-msvc toolchain) to the i686-unknown-linux-gnu target worked perfectly! π There is no need to install a linux toolchain (which wouldn't even execute on Windows if you tried) nor the 32-bit windows toolchain. All that's needed to compile for Linux is:
You don't have to run the 32-bit version of rustc to compile for 32-bit targets. You're only supposed to change the target. The library, because of the build.rs quirk, needlessly restricts cross-compilation. π
The text was updated successfully, but these errors were encountered:
Hi! Thanks to you for the notice!
I'll think about it. There is HOST and TARGET environment variables in compile time which may replace cfg!(target_arch).
I guess it's also a reason why https://docs.rs couldn't build documentation for samp-sdk
For sure.
Please mind rust-lang/cargo#4423.
The issue also bit me because WSL only supports 64-bit binaries, so I wasn't able to run the 32-bit toolchain on it. I had to remove build.rs to compile my Linux binaries from WSL.
Build scripts, such as your
build.rs
, since they are built for execution on the compiling machine, don't receive the--target i686-β¦
memo. As a result, theircfg!(target_arch)
always matches the architecture of therustc
which compiles them - usuallyx86_64
.Because
build.rs
always seesx86_64
, cross-compilation of your library from x86_64 hosts always fails, except for the scenario where a Windows user installs the whole 32-bit Rust toolchain (which 64-bit Windows happens to be able to execute thanks to WOW64) and uses it to compile the 32-bit plugin - I believe this is what you did.When I removed build.rs in my fork, cross-compilation from x86_64 Windows (using the default
stable-x86_64-pc-windows-msvc
toolchain) to thei686-unknown-linux-gnu
target worked perfectly! π There is no need to install a linux toolchain (which wouldn't even execute on Windows if you tried) nor the 32-bit windows toolchain. All that's needed to compile for Linux is:And likewise, for 32-bit Windows:
You don't have to run the 32-bit version of
rustc
to compile for 32-bit targets. You're only supposed to change the target. The library, because of thebuild.rs
quirk, needlessly restricts cross-compilation. πThe text was updated successfully, but these errors were encountered: