-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-crossArea: Cross compilationArea: Cross compilationC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.O-linuxOperating system: LinuxOperating system: LinuxO-windows-gnuToolchain: GNU, Operating system: WindowsToolchain: GNU, Operating system: Windows
Description
I'm currently trying to somehow build a 32-bit Windows cdylib on Linux (although this should apply to any crate type, not just cdylibs), and after hours of intense rabbitholing through multiple years-old GitHub issues, I wanna compile what I've gathered.
i686-pc-windows-gnu:
- requires an externally-installed mingw compiler toolchain.
- will only work if said toolchain uses dw2 exception handling, since that's what Rust expects
- with few exceptions, most distributions only provide mingw packages which use sjlj exceptions.
- there were multiple attempts to resolve this, all of them more or less fruitless
- if you can't easily obtain a dw2 toolchain, you have the following options:
5.1 use xargo (and thus nightly) to compilestd
and your code withpanic=abort
5.2 use cross, which has a docker image that will build a dw2 toolchain for you, incurring significant build time overhead.
x86_64-pc-windows-gnu:
- still requires an externally-installed mingw toolchain.
- sort of just works? most distros provide packages that use SEH, rust expects SEH, all is well in the world[citation extremely needed]
(unfortunately, this does not help me, as I don't think 32-bit programs can load 64-bit libraries.)
questions I couldn't answer:
- is there any (current) work happening to improve the situation around
i686-pc-windows-gnu
, or is it officially 'abandon all hope, ye who enter here' territory? - what is the situation regarding threads? mingw comes in posix and win32-threads flavours, and this has in the past been an additional source of problems, I'm not sure if this has been fixed? ([windows] Add testscase for self-contained executables and fix pthread linking #71023)
update 21:43 2020-11-30: The docker image cross provides seems to have worked. I could build the cdylib, load it, and call a function in it. this is still far from ideal, as the docker image took significant amounts of time to prepare, and consumes significant amounts of disk space..
Metadata
Metadata
Assignees
Labels
A-crossArea: Cross compilationArea: Cross compilationC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.O-linuxOperating system: LinuxOperating system: LinuxO-windows-gnuToolchain: GNU, Operating system: WindowsToolchain: GNU, Operating system: Windows