pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: compiler/gfortran.mk



On 2020-02-18 20:35, Jason Bacon wrote:

Is there a reason the default version is unconditionally hard-coded at 4.8?

GFORTRAN_VERSION?=      48

Seems to me it would be better to match the base compiler (e.g. 5.5 on NetBSD 8.1).

I can override it in etc/mk.conf of course, but maybe this is something that could use some attention?

    JB



Note to posterity:

I replaced the hard-coded and outdated gcc48 in gfortran.mk with the following:

# If pkgsrc base compiler is GCC, match the gfortran requirement as closely as # possible.  Otherwise, default to a mainstream version and hope for the best. # If base compiler is clang, we really should use flang rather than gfortran.
.if ${PKGSRC_COMPILER} == gcc
GFORTRAN_VERSION?=    ${CC_VERSION:C/.[0-9].[0-9]$//:S/gcc-//}
.else
GFORTRAN_VERSION?=    7
.endif

The first will ensure that NetBSD uses the same major version of GCC for Fortran as the base compiler.  We don't have multiple minor versions for gcc packages, but gcc is generally binary compatible within a major version.

The else clause selects a reasonably modern GCC that's likely to be compatible with clang.  gcc8 might actually be a better choice, but I have not tested it much at this point since the gcc8 package is currently broken on RHEL.

You can, of course, override by setting GFORTRAN_VERSION to the major version of any working gcc package in etc/mk.conf.

Since this update, I was able to build math/R on Darwin for the first time.   So Mac users should now be able to run Fortran-dependent packages without any hacking.  I also verified that R will build and run with gcc8 using GFORTRAN_VERSION=7 in mk.conf.

Note that you still must set PKGSRC_FORTRAN=gfortran in order to use a gcc package for Fortran at all.  The default Fortran compiler is still g95 (or f2c for fortran77 only if I'm not mistaken).

    JB



Home | Main Index | Thread Index | Old Index