On Wed, 29 Nov 2023 08:33:33 GMT, Andrew Haley <a...@openjdk.org> wrote:

>> When building linux-aarch64 at Oracle using jib, 
>> --openjdk-target=aarch64-linux-gnu is always specified regardless of if 
>> building natively or cross compiling (on linux-x64). Among other things this 
>> has the (harmless) effect of tricking configure into thinking that it's 
>> cross compiling even for native builds:
>> 
>> checking whether we are cross compiling... yes
>> 
>> The reason is that the target value (aarch64-linux-gnu) doesn't match what 
>> config.guess returns (aarch64-unknown-linux-gnu). An explicit target is only 
>> needed when cross compiling and should not be specified for native builds.
>
> 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?

Well, it sort-of is cross compilation. We get away with it, mostly, because we 
tend to link against in-tree libraries, and the few system libraries we link 
against are very stable. But the JDK we're building won't run on the host if 
any of the system libraries the JDK links against have changed ABI version. Or 
in extremis, sometimes the system ABI might change; that doesn't happen very 
often, but I've seen it.

> Maybe the concept of cross-compilation is too coarse, and we need to separate 
> it into cross-cpu, cross-os, or something like that.

We need some way to be able to tell the build system "This is a cross 
compiler." `--openjdk-target=` is not a bad way to do that.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16873#issuecomment-1832029958

Reply via email to