Cross-compiling and the gen* native build tools

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Mon Feb 3 14:13:23 UTC 2014


I just noticed this when replying to a mail to Volker, but I think this 
is worth a thread on it's own.

There are three very similar build helpers that are compiler with 
BUILD_CC, i.e. the compiler for the build (not target) platform. They are:

jdk/src/solaris/native/sun/nio/fs/genUnixConstants.c
jdk/src/solaris/native/sun/nio/fs/genSolarisConstants.c
jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c

They are very similar in that they pick up (build) platform constants 
and turn them into Java constants.

This does not work for cross-compilation, so we have closed sources 
hard-coded versions for these platform we internally cross-compile to.

This does not strike me as a neat solution. You can't add a new target 
to cross compile to without mimicking our internal closed code 
structure. You are always needed to provide a build platform compiler, 
even though the results are not supposed to change for the platform 
you're building for. (If it were, then the resulting code would not be 
possible to run on any other platform then your own, i.e. it wouldn't be 
constants).

I think we should do something similar to with the X11 wrappers, and 
hard-code the values, with a possible, optional, verification step.

/Magnus



More information about the build-dev mailing list