Created attachment 183857 [details]
This can potentially lift the limitation that fortran programs can't be mixed with clang-compiled C++ due to the libgcc_s.so conflict. Base libgcc_s.so and libgcc_s.so from gcc port are in conflict.
Kept gcc a default.
Tested with math/R. math/R builds and seems to work fine with flang.
I will create the bug report with the patch to math/R soon.
This patch made the RStudio (IDE for R) possible: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220359
It looks fine to me.
A member of portmgr opined that it is premature to add flang support here since flang is currently only supported on amd64.
(In reply to Joseph Mingrone from comment #3)
Presumably the feature/support could be limited to be used with/scoped to amd64
@Yuri, if bug 220359 depends on this issue, please add it to the Blocks field here.
Mk/Uses/fortran.mk is maintained by fortran@FreeBSD.org but an account with that email does not exist within Bugzilla, so cannot be made assignee or added to flags for feedback. Bugmeister can take care of this on request.
Therefore, assign to freebsd-ports-bugs as portmgr has indicated recently (Mk/* except for a few files do not require their approval). portmgr@ remain CC'd.
@Diane, do you know who could provide feedback and/or approve this change 'with hat fortran@' ?
I see a mailing list post  from 2013 mentioning:
"3. There are several developers/committers with Fortran "expertise, e.g. bf@, gerald@, maho@,"
CC those users accordingly.
This https://reviews.freebsd.org/D11482 has just been added. I'm looking at this now as well. I'll note that this also only covers amd64.
I see absolutely no harm in adding flang support at this time even if it only covers amd64 since the more testing and bug fixing we can get the better IMO.
But really this is now up to the @fortran @toolchain groups.
I just want my pony.
If it's not possible to mix flang and gfortran code the choice of Fortran compiler should be system-wide and controlled by the user, not individual ports. Users should be able to add fortran=gcc or fortran=flang to DEFAULT_VERSIONS in /etc/make.conf. USES=fortran should then set the Fortran compiler based on that and support for USES=fortran:gcc can be removed.
(In reply to Tijl Coosemans from comment #6)
I've noted this possibility to emaste as well. As discussed at last Dev Summit in June it also matters muchly if we continue the path of a faux libgcc or rename it.
If the entire toolchain for orts has to be chosen a priori then we might want to rename our base libgcc to something else entirely.
Many potential fortran ports aren't even possible with the current gfortran. So the option USES=fortran is generally broken anyways.
fortran:flang can be committed as an experimental option, with a corresponding message. It makes it easier to test flang. Some package combinations can directly benefit. For example, R with fortran:flang makes RStudio possible with flang. R isn't currently linked to by anything else.
Also please see the upstream requests:
> Presumably the feature/support could be limited to be used with/scoped to amd64
It's conceivable we could make the default flang on amd64 and gfortran on i386, similarly to how we've transitioned base system toolchain components on a per-arch basis as they become usable. That's a decision for portmgr and fortran folks; I just want to point out that there is a precedent for configuration like this.
(In reply to Yuri Victorovich from comment #8)
> Many potential fortran ports aren't even possible with the current
> gfortran. So the option USES=fortran is generally broken anyways.
How that? Why that?
And does the upgrade of the default to GCC 6 two weeks ago make a
(In reply to Gerald Pfeifer from comment #10)
> How that? Why that?
Conflicts between libgcc.so versions.
> And does the upgrade of the default to GCC 6 two weeks ago make a
Very unlikely. All versions of gcc build their own libgcc version.
See https://reviews.freebsd.org/D12529 It is essentially the same as the patch attached here, but does an architecture check with the flang argument.
A commit references this bug:
Date: Tue Oct 24 19:13:02 UTC 2017
New revision: 452811
Mk/Uses/fortran.mk: Add flang as a non-default USES=fortran argument. Note,
flang is currently only available for amd64.
Submitted by: firstname.lastname@example.org
Reviewed by: db, jmd, mat, swills
Approved by: portmgr
Differential Revision: https://reviews.freebsd.org/D12529