(solved, I think) Re: openjdk build failures on "nm"

Ronald Klop <[email protected]>
Newsgroups gmane.os.freebsd.devel.java
Message-ID <387357483.2815.1757924099539@localhost>
Van: Harald Eilertsen <[email protected]>
Datum: donderdag, 11 september 2025 10:15
Aan: Ronald Klop <[email protected]>
CC: [email protected]
Onderwerp: Re: openjdk build failures on "nm"
> 
> On Thu, Sep 11, 2025 at 09:32:08AM +0200, Ronald Klop wrote:
> > As it seems hard to debug, what do the java@ maintainers think of this experiment?
> >
> > diff --git a/java/openjdk17/Makefile b/java/openjdk17/Makefile
> > index 5cb25e6aee72..ba7001ff2bd0 100644
> > --- a/java/openjdk17/Makefile
> > +++ b/java/openjdk17/Makefile
> > @@ -38,7 +38,7 @@ GH_PROJECT=   jdk17u
> >
> > NO_CCACHE=     yes
> >
> > -_MAKE_JOBS=    #
> > +MAKE_JOBS_UNSAFE=      yes
> > MAKE_ENV=      LANG="C" \
> >                LC_ALL="C" \
> >                CLASSPATH="" \
> 
> That's well spotted! I think this is definitely worth trying. I'm no
> expert on the ports Makefiles myself, but was told to use
> MAKE_JOBS_UNSAFE instead in the review for openjdk24. Haven't gone
> through all the ancient version yet, as my focus is mainly on mainline,
> and these days on openjdk25.
> 
> > I can commit this today to openjdk17 and if builds start to succeed to other openjdk* ports.
> 
> I'm in favour!
> 
> H!
> 
> 
> 

Hi Harald,

I found out what happens in openjdk23 and openjdk24 around _MAKE_JOBS.

_MAKE_JOBS is an internal variable in Mk/bsd.port.mk used to add "-j<MAKE_JOBS_NUMBER>" to the make command in do-build. It was set empty to suppress passing -j, because the port otherwise gives this error:
===>  Building for openjdk17-17.0.16+8.1_2
Error: 'make -jN' is not supported, use 'make JOBS=N'

NB: this error comes from work/jdk17u-jdk-17.0.16-8-1/make/InitSupport.gmk:119
In /usr/ports/Mk/bsd.port.mk we have these lines of code:
.    if defined(DISABLE_MAKE_JOBS) || defined(MAKE_JOBS_UNSAFE)
_MAKE_JOBS?=        #
MAKE_JOBS_NUMBER=   1
.    else
So setting _MAKE_JOBS is a side effect of MAKE_JOBS_UNSAFE. The suggestion of using MAKE_JOBS_UNSAFE was just another way of setting _MAKE_JOBS and MAKE_JOBS_NUMBER.
But the MAKE_JOBS_NUMBER is never passed to the (implicit) do-build target of the ports Makefile.

If you look in https://pkg-status.freebsd.org/beefy17/data/15stable-amd64-default/56c5cbbc8d99/logs/openjdk23-23.0.2+7.1_2.log and search for "jobs" you will find this:
checking for number of cores... 48
checking for memory size... 130685 MB
checking for appropriate number of jobs to run in parallel... 48
...
Build performance summary:
* Build jobs:     48
So, in summary
* MAKE_JOBS_UNSAFE sets _MAKE_JOBS empty and gives the suggestion of running without parallel jobs. But the port further ignores MAKE_JOBS_NUMBER and ...
* The port decides to run with 48 parallel jobs as it looks at the number of CPUs.
* A bit more documentation/comments around overriding the _MAKE_JOBS variable in the Makefile could have saved us quite some research. 😉

The current construction in openjdk17 handles MAKE_JOBS_NUMBER properly. And with that also the MAKE_JOBS_UNSAFE variable. After more testing we can use this blueprint in other openjdk ports.
Also in openjdk23 and -24. They don't have flapping builds but can improve handling of MAKE_JOBS_NUMBER.

Regards,
Ronald.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.