Cross-building Windows binaries using the mingw toolchain
Volker Simonis
volker.simonis at gmail.com
Wed Apr 30 16:16:48 UTC 2014
Hi Florian,
there are two different points to consider here.
The first one is to make the OpenJDK compile on Windows with the MinGW
toolchain (instead of Cygwin). This currently doesn't work out of the
box but is relatively easy to achieve (see for example "8022177:
Windows/MSYS builds broken"
https://bugs.openjdk.java.net/browse/JDK-8022177). Magnus and I are
working on this (and actually I have an internal build which works
with MinGW). Hopefully we can fix this in the OpenJDK soon.
The second one is to cross compile the whole OpenJDK on Linux using
gcc and MingGW. If I understood you right that's what you actually
wanted. I personally think that would be nice to have but at the same
time I also think it would be quite hard to get there and probably not
worth doing it because even if you'd succeed nobody will probably
maintain it and it would break quite soon (see for example the
GCC/Solaris build or the Clang/Linux build).
If you want to try it nevertheless, some of the problems you will face
will be at least the following ones:
- convert the HotSpot nmake makefiles to GNU syntax (notice that this
project is currently underway under the umbrella of the new build
system anyway, so you'd probably want to wait to avoid doing double
work)
- convert Visual Studio intrinsics, inline assembler and compiler
idiosyncrasies to GCC syntax
- you'll probably also need to cross compile dependencies like
libfreetype with GCC/MinGW
- I'm actually not an expert, but the OpenJDK is linked against some
native Window libraries like DirectX and runtime libraries from the
Microsoft SDKs. I'm not an expert here and I don't know how that would
work for a cross-compile.
I personally think we should rather focus on further improving the
current Windows build. It's already a huge improvement compared to the
old JDK7 Windows build. From what I see, the main remaining problems
are to somehow make it possible to get a stable, defined and free
version of the Microsoft development tools which are "known to work".
But of course this is a problem which may need cooperation from
Microsoft. Another improvement would be to make the build more
agnostic against various Cygwin/MingGW version and to improve the
build speed. Again, this issue partially depends on improving
Cygwin/MingGW themselves (which would be at least theoretically
possible).
Regards,
Volker
On Wed, Apr 30, 2014 at 4:36 PM, Florian Weimer <fweimer at redhat.com> wrote:
> I noticed that cross-building Windows binaries is currently not supported.
> It seems that Hotspot in particular assumes that the host and target
> operating systems are the same (for examples, Linux-to-Linux cross builds
> are support). Assuming I can get it to work within the current build
> system, would you be interested in integrating patches and carry them
> forward?
>
> Cross-build support would make it easier for GNU/Linux developers to work on
> features that should have parity on Windows, but lack shared native sources
> (e.g. networking-related features).
>
> --
> Florian Weimer / Red Hat Product Security Team
More information about the build-dev
mailing list