Date: Fri, 18 Nov 2022 21:45:18 +0000 From: Lorenzo Salvadore <developer@lorenzosalvadore.it> To: =?utf-8?Q?T=C4=B3l_Coosemans?= <tijl@FreeBSD.org> Cc: Lorenzo Salvadore <salvadore@FreeBSD.org>, thierry@FreeBSD.org, yuri@FreeBSD.org, ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org, Gerald Pfeifer <gerald@pfeifer.com> Subject: Re: git: 4191c71fbd22 - main - Mk/Uses/fortran.mk: Make gfortran respect USE_GCC Message-ID: <olRp2HqIcFyc-uwbm3PutqTp9F1m_isNBceiZ1_ktkhjYmoUKAvo232U4ns4_2UHa9wIszJN0xPNFSDf8qHuL34fPkV24_3GXpzYiJNzoKM=@lorenzosalvadore.it> In-Reply-To: <20221118204110.5ff6c228@hal.tijl.coosemans.org> References: <202211162139.2AGLdojd006463@gitrepo.freebsd.org> <20221118204110.5ff6c228@hal.tijl.coosemans.org>
next in thread | previous in thread | raw e-mail | index | archive | help
------- Original Message ------- On Friday, November 18th, 2022 at 8:41 PM, T=C4=B3l Coosemans <tijl@FreeBSD= .org> wrote: >=20 >=20 > On Wed, 16 Nov 2022 21:39:50 GMT Lorenzo Salvadore > salvadore@FreeBSD.org wrote: >=20 > > The branch main has been updated by salvadore: > >=20 > > URL: https://cgit.FreeBSD.org/ports/commit/?id=3D4191c71fbd229e5a96382b= c6fa271a1ce5668b0f > >=20 > > 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 > >=20 > > Mk/Uses/fortran.mk: Make gfortran respect USE_GCC > >=20 > > Allow choosing a specific version of gfortran through USE_GCC variable. > >=20 > > PR: 266196 > > Approved by: thierry (fortran) > > Co-authored by: thierry > > --- > > Mk/Uses/fortran.mk | 4 ++++ > > 1 file changed, 4 insertions(+) > >=20 > > diff --git a/Mk/Uses/fortran.mk b/Mk/Uses/fortran.mk > > index 09ebd62b1a0f..d335fad4dc8e 100644 > > --- a/Mk/Uses/fortran.mk > > +++ b/Mk/Uses/fortran.mk > > @@ -14,7 +14,11 @@ fortran_ARGS=3D ${FORTRAN_DEFAULT} > > . endif > >=20 > > . if ${fortran_ARGS} =3D=3D gfortran > > +. if empty(USE_GCC) > > _GCC_VER=3D ${GCC_DEFAULT:S/.//} > > +. else > > +_GCC_VER=3D ${_USE_GCC} > > +. endif > > BUILD_DEPENDS+=3D gfortran${_GCC_VER}:lang/gcc${_GCC_VER} > > RUN_DEPENDS+=3D gfortran${_GCC_VER}:lang/gcc${_GCC_VER} > > F77=3D gfortran${_GCC_VER} >=20 >=20 > When I wrote this file I didn't include this because users will end up > with multiple versions of GCC installed, each with its own set of runtime > libraries. So they'll have programs/libraries built against different > runtime libraries and those don't always work together. For instance, > science/octopus is now built with GCC 11 but its dependencies like > lapack are built with GCC 12. These dependencies may require features > from GCC 12 runtime libraries while science/octopus programs probably > (I haven't checked) load GCC 11 runtime libraries when you run them. I do not think it is a big issue if multiple versions of GCC are installed at the same time. Indeed, USE_GCC exists since a long time and while a few bugs might arise sometimes, they get fixed eventually and things work fine. Moreover, if for some fortran dependent port it is better to ignore USE_GCC= , it is sufficient to set USE_GCC=3Dyes and things work just as before this c= ommit. > Even if this happens to work now it may not work when the default > switches to 13. I believe it's better for ports like science/octopus to > have something like this in their Makefile: >=20 > .if ${GCC_DEFAULT} !=3D 11 > IGNORE=3D This port only works with gcc 11. You can add DEFAULT_VERSIONS+= =3Dgcc=3D11 to /etc/make.conf > .endif I think this is a bad idea as: - it prevents the port to be built on the official packages builder as soon= as GCC_DEFAULT gets updated to 12, so that users that prefer to install softwa= re from packages only cannot install science/octopus anymore; - adding DEFAULT_VERSIONS+=3Dgcc11 to /etc/make.conf would change the depen= dencies of all the gcc dependent ports, not just science/octopus. This could genera= te more issues: what if a port does not build with GCC 11 but needs GCC 12+ in= stead? > I noticed there's a new version of Octopus so maybe an update would fix > this particular case. I hope so, but if Yuri has not done that update yet I guess that the update is not straightforward. Setting USE_GCC together with this commit allows th= e update of GCC_DEFAULT to proceed instead of waiting for science/octopus. Moreover, GCC 11 is not going away any soon, so, while this is hopefully a temporary solution, it can safely last many months without any risk to brea= k science/octopus in the short term. That said, if you want to revert the commit on Mk/Uses/fortran.mk it is fin= e for me as long as another solution is implemented to prevent science/octopu= s from blocking GCC_DEFAULT upgrade. Please note that I also had suggested an alternative solution in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D266196#c5 : "the issue can probably be fixed by setting the dependency on gfortran11 explicitely and dropping USE=3Dfortran". Cheers, Lorenzo Salvadore
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?olRp2HqIcFyc-uwbm3PutqTp9F1m_isNBceiZ1_ktkhjYmoUKAvo232U4ns4_2UHa9wIszJN0xPNFSDf8qHuL34fPkV24_3GXpzYiJNzoKM=>