Bug 266196 - science/octopus: Fails to build with GCC 12: Fatal Error: Sorry, polymorphic arrays not yet supported for firstprivate compilation terminated.
Summary: science/octopus: Fails to build with GCC 12: Fatal Error: Sorry, polymorphic ...
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: Lorenzo Salvadore
URL: http://package18.nyi.freebsd.org/data...
Keywords:
Depends on:
Blocks: 265948
  Show dependency treegraph
 
Reported: 2022-09-03 09:44 UTC by Lorenzo Salvadore
Modified: 2023-01-09 00:36 UTC (History)
4 users (show)

See Also:
salvadore: maintainer-feedback? (yuri)


Attachments
Do not ignore USE_GCC (505 bytes, patch)
2022-11-16 12:35 UTC, Thierry Thomas
no flags Details | Diff
Do not ignore USE_GCC (486 bytes, patch)
2022-11-16 16:52 UTC, Thierry Thomas
no flags Details | Diff
Respect USE_GCC for gfortran (813 bytes, patch)
2022-11-16 17:39 UTC, Thierry Thomas
thierry: maintainer-approval-
Details | Diff
Alternative patch for making gfortran respect USE_GCC (896 bytes, patch)
2022-11-16 21:03 UTC, Lorenzo Salvadore
thierry: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenzo Salvadore freebsd_committer freebsd_triage 2022-09-03 09:44:59 UTC
Updating GCC_DEFAULT from GCC 11 to GCC 12 is blocked by the fact that building this port with GCC 12 on amd64 fails.

The error message is the following:


grid/derivatives_inc.F90:717:54:

  717 |       !$omp parallel do private(tmp, ip, idim1, idim2)
      |                                                      ^
Fatal Error: Sorry, polymorphic arrays not yet supported for firstprivate
compilation terminated.
gmake[3]: *** [Makefile:3167: grid/derivatives.lo] Error 1



Please see also the log in the URL field. This URL might be useful to solve the issue: http://gcc.gnu.org/gcc-12/porting_to.html .
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2022-09-03 15:19:55 UTC
Octopus bug report: https://gitlab.com/octopus-code/octopus/-/issues/587
Comment 2 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-09-21 14:04:39 UTC
Is there any progress on this bug report? Is there anything I could do to help?

This is one of last three bugs that is blocking the update off GCC default version according to the most recent exp-run. If the bug is complex and requires more time, please also consider setting USE_GCC=11.

Thanks.
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-10-30 20:12:26 UTC
A commit in branch main references this bug:

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

commit 0e853a10fc56a3e2d827db16629dde19374a0de2
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-10-30 20:10:58 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-10-30 20:11:58 +0000

    science/octopus: Add USE_GCC=11

    octopus isn't yet compatible with gcc-12.

    PR:             266196
    Reported by:    salvadore@

 science/octopus/Makefile | 1 +
 1 file changed, 1 insertion(+)
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2022-10-30 20:12:32 UTC
USE_GCC=11 was added.
Comment 5 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-11-16 09:45:47 UTC
I am sorry, but I have to re-open this bug report: according to Antoine's exp-run, it still fails with GCC 12.

New log:

http://package18.nyi.freebsd.org/data/123amd64-default-foo/2022-11-12_19h30m16s/logs/octopus-11.4_2.log

I think I know what is the problem here. The dependency on GCC is not pulled in directly, but through USES=fortran, thus USE_GCC is ignored. So the issue can probably be fixed by setting the dependency on gfortran11 explicitely and dropping USE=fortran.
Although, in the long term it might be a better idea to improve USES=fortran so that an explicit version can be required (I think it cannot at the moment, am I wrong?) 

I add fortran@ and gerald@, in case they have some smarter solution to suggest.
Comment 6 Yuri Victorovich freebsd_committer freebsd_triage 2022-11-16 10:16:20 UTC
(In reply to Lorenzo Salvadore from comment #5)

It looks like a deficiency/bug in USES=fortran that it ignores USE_GCC.
Comment 7 Thierry Thomas freebsd_committer freebsd_triage 2022-11-16 12:35:05 UTC
Created attachment 238118 [details]
Do not ignore USE_GCC

Would the attached patch do the expected thing?
Comment 8 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-11-16 15:08:48 UTC
Thanks Thierry. Your patch looks as a good starting point, however I see two issues:

- if I add DEFAULT_VERSIONS+=gcc=12 to my /etc/make.conf and then run make -V BUILD_DEPENDS in science/octopus I still get gfortran12:lang/gcc12;

- USE_GCC also supports notations such as USE_GCC=11+ and USE_GCC=11+:BUILD, so I fear something more complex than _GCC_VER=${USE_GCC} is needed.

Thanks for working on this.
Comment 9 Thierry Thomas freebsd_committer freebsd_triage 2022-11-16 15:16:13 UTC
(In reply to Lorenzo Salvadore from comment #8)

OK, I see!

Does Mk/bsd.gcc.mk provide a variable with the chosen GCC version? (I don’t see it). If not, is it possible to export one?
Comment 10 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-11-16 15:25:43 UTC
I think the variable you need is _USE_GCC. Gerald, since you are still maintaining bsd.gcc.mk, do you confirm we can safely use this variable in this context?
Comment 11 Thierry Thomas freebsd_committer freebsd_triage 2022-11-16 15:39:16 UTC
(In reply to Lorenzo Salvadore from comment #10)

Remark: the variables prefixed by "_" are not intended to be exported.
Comment 12 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-11-16 15:41:46 UTC
(In reply to Thierry Thomas from comment #11)

Ah thanks, I did not know that. I assumed _USE_GCC would have worked since make -V _USE_GCC gives me output.
Comment 13 Gerald Pfeifer freebsd_committer freebsd_triage 2022-11-16 16:37:00 UTC
(In reply to Lorenzo Salvadore from comment #8)
> - USE_GCC also supports notations such as USE_GCC=11+ and 
> USE_GCC=11+:BUILD, so I fear something more complex than
> _GCC_VER=${USE_GCC} is needed.

I noticed the same and it got me thinking: Between this report and
PR267215 and there only being two(!) ports left that use the USE_GCC=X+
notation (security/openssl-unsafe and x11-wm/hyprland-devel, and the
former having it disabled), maybe the time has come to end of life it?

Even if we don't, Thierry's patch does not run into any special cases,
so KISS (Keep It Simple Sweatheart) and go with that patch?


(In reply to Lorenzo Salvadore from comment #10)
> I think the variable you need is _USE_GCC. Gerald, since you are 
> still maintaining bsd.gcc.mk, do you confirm we can safely use this
> variable in this context?
(In reply to Thierry Thomas from comment #11)
> Remark: the variables prefixed by "_" are not intended to be exported.

Both of you are right. :-)  Thierry, you are definitely right about
variables whose name starts with a "_". That was my intention here. 

Practically I think we can make this an exception since it's within
the Mk/ infrastructure and document this use in bsd.gcc.mk.

Thierry and Salvadore, if you want to proceed with this patch I'm good
(Reviewed by: gerald) and volunteer adding such a note as follow-up.
Comment 14 Thierry Thomas freebsd_committer freebsd_triage 2022-11-16 16:52:12 UTC
Created attachment 238126 [details]
Do not ignore USE_GCC

If everybody agrees, see my newer patch, with _USE_GCC.
You can commit it.
Comment 15 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-11-16 17:10:12 UTC
(In reply to Thierry Thomas from comment #14)

Running "make -V BUILD_DEPENDS" in science/octopus still gives me gfortran12:lang/gcc12 when I have DEFAULT_VERSIONS+=gcc=12, although the port has USE_GCC=11. Something is still wrong somewhere.

Is it something about my test environment? Do you have the same output Thierry?
Comment 16 Thierry Thomas freebsd_committer freebsd_triage 2022-11-16 17:39:58 UTC
Created attachment 238127 [details]
Respect USE_GCC for gfortran

You are right: it did not work!

It seems we have to patch both bsd.gcc.mk and Uses/fortran.mk - unless you find a simpler solution. The attached patch seems OK for me.
Comment 17 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-11-16 21:03:27 UTC
Created attachment 238129 [details]
Alternative patch for making gfortran respect USE_GCC

Your patch works Thierry, but it seems it is not necessary to modify bsd.gcc.mk: the second patch you submitted also works if you change the test condition with the one you used in the third patch. Please see attachment.
Comment 18 Thierry Thomas freebsd_committer freebsd_triage 2022-11-16 21:06:21 UTC
Comment on attachment 238129 [details]
Alternative patch for making gfortran respect USE_GCC

Great!
Comment 19 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-11-16 21:09:35 UTC
Comment on attachment 238129 [details]
Alternative patch for making gfortran respect USE_GCC

(In reply to Thierry Thomas from comment #18)

Are you in fortran@ Thierry? Is the change maintainer-approved?
Comment 20 Thierry Thomas freebsd_committer freebsd_triage 2022-11-16 21:32:13 UTC
Comment on attachment 238129 [details]
Alternative patch for making gfortran respect USE_GCC

Approved, with fortran hat.
Comment 21 commit-hook freebsd_committer freebsd_triage 2022-11-16 21:40:48 UTC
A commit in branch main references this bug:

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

commit 4191c71fbd229e5a96382bc6fa271a1ce5668b0f
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2022-11-16 14:43:40 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2022-11-16 21:38:54 +0000

    Mk/Uses/fortran.mk: Make gfortran respect USE_GCC

    Allow choosing a specific version of gfortran through USE_GCC variable.

    PR:             266196
    Approved by:    thierry (fortran)
    Co-authored by: thierry

 Mk/Uses/fortran.mk | 4 ++++
 1 file changed, 4 insertions(+)
Comment 22 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-11-16 21:43:38 UTC
Now we should be able to safely close this PR.

Assign to myself as per triaging rules (assign to committer that committed the fix).

Thanks everyone for working on this.
Comment 23 commit-hook freebsd_committer freebsd_triage 2023-01-09 00:36:25 UTC
A commit in branch main references this bug:

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

commit 9b5f5ab8482f105311d01a32260ef32bba4a2628
Author:     Gerald Pfeifer <gerald@FreeBSD.org>
AuthorDate: 2023-01-09 00:32:48 +0000
Commit:     Gerald Pfeifer <gerald@FreeBSD.org>
CommitDate: 2023-01-09 00:34:15 +0000

    Mk/bsd.gcc.mk: Remove support for USE_GCC=X+

    At this point most ports that employ USE_GCC have the USE_GCC=yes
    form, some have USE_GCC=X (where X is an older version of GCC than
    the current default), and none is left with USE_GCC=X+.

    To reduce complexity and since we are actively tracking upstream GCC
    with our default version, remove support for the USE_GCC=X+ form.

    This also derisks Mk/Uses/fortran.mk which aligns with USE_GCC after
    commit 4191c71fbd229e5a96382bc6fa271a1ce5668b0f. [1]

    PR:             266196 [1]

 Mk/bsd.gcc.mk | 32 +++++---------------------------
 1 file changed, 5 insertions(+), 27 deletions(-)