Bug 279367 - java/openjdk11 -- respect compiler and linker flags, allow building with gcc
Summary: java/openjdk11 -- respect compiler and linker flags, allow building with gcc
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Ronald Klop
URL:
Keywords: easy, patch-ready
Depends on:
Blocks:
 
Reported: 2024-05-28 18:02 UTC by Mikhail Teterin
Modified: 2024-09-10 11:50 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (java)


Attachments
Patch the linking code, disable a troublesome compiler warning (1.77 KB, patch)
2024-05-28 18:02 UTC, Mikhail Teterin
no flags Details | Diff
Respect compiler and linker flags (1.23 KB, patch)
2024-09-01 20:45 UTC, Mikhail T.
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Teterin freebsd_committer freebsd_triage 2024-05-28 18:02:26 UTC
Created attachment 251038 [details]
Patch the linking code, disable a troublesome compiler warning

It is somewhat disheartening, how easily port-maintainers give up upon encountering problems with the base compiler -- and make a custom compiler a requirement instead...

openjdk11 currently requires an LLVM -- of version 12 -- and this PR seeks to fix that.

The proposal adds a patch, which was once part of the opendjk17 port back in (see Bug 274109). This fixes the problem with the linking.

Separately, the now-fatal compiler warning is explicitly disabled -- so the code compiles.

It also places the custom CFLAGS, CXXFLAGS, and LDFLAGS into the CONFIGURE_ARGS (as the JDK maintainers want).
Comment 1 Ronald Klop freebsd_committer freebsd_triage 2024-08-31 19:31:01 UTC
A patch which removed usage of llvm12 was committed in ports 08cc50220f1d71f12d13d7e2c957a5679b02914d.
The port is compiled by llvm from base for a while now.

Can this issue be closed?
Comment 2 Mikhail T. 2024-08-31 20:20:00 UTC
(In reply to Ronald Klop from comment #1)
> Can this issue be closed?

The commit does not reference this ticket, and the changes don't include all of the things I provided. In particular, the CFLAGS, CXXFLAGS, and LDFLAGS still aren't passed to configure...
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2024-09-01 11:45:19 UTC
(In reply to Mikhail T. from comment #2)
Update subject of the PR, update patch.
Maintainer timeout already reached - I'll commit it.
Comment 4 Mikhail T. 2024-09-01 20:45:59 UTC
Created attachment 253259 [details]
Respect compiler and linker flags

(In reply to Vladimir Druzenko from comment #3)
> Update subject of the PR, update patch.

Here it is. In addition to setting the compiler and linker flags, the patch disables precompiled headers whenever gcc is used -- not just on powerpc64.

Without this, I was getting PCH-error from g++12 on my amd64 machine too.

I _suspect_, it is currently set on powerpc64, because gcc is the only compiler there, but I have no access to a powerpc64-machine to test :(
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2024-09-02 02:53:40 UTC
Maybe create same for all java/openjdk*?
Comment 6 Mikhail T. 2024-09-02 02:56:24 UTC
(In reply to Vladimir Druzenko from comment #5)
> Maybe create same for all java/openjdk*?

That really is the job of java@, is not it? :-)
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2024-09-03 21:46:21 UTC
(In reply to Mikhail T. from comment #6)
I don't see them being active. Who is in this group anyway?
Comment 8 Ronald Klop freebsd_committer freebsd_triage 2024-09-04 10:50:15 UTC
(In reply to Vladimir Druzenko from comment #7)
See: https://wiki.freebsd.org/Java
I don't know how active the group is nowadays. But things are not a "job of java@". It is a lot of voluntary work.

The mechanism is to create a good patch and notify the maintainer of a port. After two weeks the patch can be committed by somebody else stating 'maintainer timeout' (this is documented somewhere).

About 'doing this for java/openjdk*', I would advice to first commit this patch. Then create a new patch for the other JDKs. Possible using a new issue. So this will not transform in a lingering project with a bigger and bigger scope. In the meantime we can learn from feedback on this change while rolling it out on the other JDK ports. This is how I roll out changes in my mongodb* ports. But, that is just my opinion.

Cheers.
Comment 9 Mikhail T. 2024-09-04 14:30:03 UTC
> The mechanism is to create a good patch and notify the maintainer of a port. After two weeks the patch can be committed by somebody else stating 'maintainer timeout' (this is documented somewhere).

You describe, how things should be, but they aren't. This PR is over 3 months old... Some of the changes I initially proposed were made independently, the committer evidently not even aware of this PR. Something is broken in our system -- something, portmgr@ should be fixing, in my not so humble opinion.

> After two weeks the patch can be committed by somebody else stating 'maintainer timeout'

Yes, I've done "maintainer timeout" commits too. But I cannot any more, because portmgr@ took away my commit-bit.

> I would advice to first commit this patch. 

Full agreement here.
Comment 10 commit-hook freebsd_committer freebsd_triage 2024-09-10 11:36:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e3120f0ac06e578482a669fe51fb65fb2bcb6619

commit e3120f0ac06e578482a669fe51fb65fb2bcb6619
Author:     Mikhail T. <freebsd-2024@virtual-estates.net>
AuthorDate: 2024-09-09 07:50:21 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2024-09-10 11:34:53 +0000

    java/openjdk11: respect compiler and linker flags

    pass CFLAGS, CXXFLAGS and LDFLAGS to the build
    This enables more easily testing different build options.

    fix build on gcc by passing --disable-precompiled-headers not only on powerpc64
    "Without this, I was getting PCH-error from g++12 on my amd64 machine too."

    PR:     279367
    Tested by:      poudriere
    Approved by:    maintainer timeout (java@)

 java/openjdk11/Makefile | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
Comment 11 Ronald Klop freebsd_committer freebsd_triage 2024-09-10 11:38:45 UTC
Committed. Thanks for your patch.