Cross compilation discussion

erik.joelsson at oracle.com erik.joelsson at oracle.com
Wed Nov 29 14:31:14 UTC 2023


(moving this to a new thread)

On 11/29/23 02:23, Magnus Ihse Bursie wrote:
>> I'm not objecting to this patch, which is fine as it goes, but I think that the real test for cross compiling isn't a different build and target platform, but a different build and target sysroot. You're often building for EL 9 on an EL 8 machine, and that really does need to be treated as cross compilation.
> @theRealAph This is probably a discussion we should continue separately on the mailing list, since it is not really related to this patch.
>
> Are you suggesting that we should basically consider the build a "cross-compile" if we supply a sysroot? What do you expect to happen if the build think we're doing a cross compilation? One of the most basic things is that we need to compile build helpers for the build platform, not the target platform. It this something you'd like to see in your scenario?
>
> Maybe the concept of cross-compilation is too coarse, and we need to separate it into cross-cpu, cross-os, or something like that.

I think Andrew has a point. If there is a need for performing a cross 
compile for EL 9 from EL 8, then we should consider this.

Oracle distributions of OpenJDK are typically built for a target 
platform of the lowest version we want to support as this (usually) 
guarantees compatibility with all the versions that we want to support 
of that particular OS. This is technically a cross compilation 
(targeting EL 6 from EL 8), but we pretend it's not, because the target 
bits are compatible with the host system. RedHat being a Linux vendor 
typically builds OpenJDK specifically for each of their OS versions, 
which really is the true native build.

Perhaps what we need to do is separate the notion of needing a separate 
BUILD_JDK from the notion of cross compiling. In some cross compilation 
scenarios, the target is compatible with the host, so we don't need a 
separate BUILD_JDK, but in others it's not compatible, so we do need 
one. The non-compatibility is obvious if cross compiling for a different 
CPU, but not so obvious, and probably pretty hard to guess correctly 
when the full target triple matches. A first step would be to introduce 
a configure option for telling the build if the target binaries can be 
used for build tools or not. This may already be partly possible by 
supplying an external --with-build-jdk, not sure.

/Erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/build-dev/attachments/20231129/7e0530b3/attachment-0001.htm>


More information about the build-dev mailing list