Hi Antoni,
This discussion belongs in build-dev mailing list.
--
Regards,
Alexey
On 2025-12-17 11:22, Antoni Jankowski wrote:
Hi,
I've recently studied the jdk21u build system and noticed that at its
core it is not meant to handle BUILDJDK and TARGETJDK being made for
two very different systems.
Many of the FLAGS are shared between the two and in many cases that
may be problematic. A good example is the GENDEPS_FLAGS variable,
which is only present in one version, just in the
/make/autoconf/spec.gmk.in <http://spec.gmk.in>/, meaning that the
BUILDJDK gets the same GENDEPS_FLAGS as the TARGETJDK. Shouldn't this
variable be split into GENDEPS_FLAGS_TARGET and GENDEPS_FLAGS_BUILD to
ensure a correct generation of dependency files in all sorts of
cross-compilation scenarios?
Same story is with the variables defined in
/make/autoconf/flags-cflags.m4, make/autoconf/flags-ldflags.m4 and
make/autoconf/flags-other.m4, /like
* $2CFLAGS_JDKEXE
* $2CXXFLAGS_JDKEXE
* $2CFLAGS_JDKLIB
as they all depend on the OPENJDK_TARGET_OS variable, which is the
same for both TARGETJDK and BUILDJDK. I suppose the root of the
problem is right there, where in /build-spec.gmk.in
<http://build-spec.gmk.in>/ the OPENJDK_TARGET_OS variable is not
overwritten with the value of OPENJDK_BUILD_OS, like it's done with
other OPENJDK_TARGET_* variables. I suppose no problems occur when the
compiler is shared between the target and the build platforms, even
less problems in case of linux or macOS in both cases being the
operating system, however in case of the target system differing
greatly from the build, the cross-compilation is close to impossible
with the current build system.
I wonder if that is a design choice, or perhaps a limitation that was
not planned.
Would you be open for changes that make it a bit easier to introduce a
new platform target to openjdk? I'd gladly post a pull request solving
the issues mentioned.
Best regards,
Antoni Jankowski