My macports refused to install openmpi
with the gcc5
compiler, i.e.
port install openmpi-gcc5
complained
"Invalid value for configure.compiler: macports-gcc-5"
Looking at /opt/local/libexec/macports/lib/port1.0/portconfigure.tcl
it is evident that the regex
for deterimining the compiler is expecting a version as version.subversion
and not just a plain major version. The fix is then to duplicate the gccX.Y
sections in portconfigure.tcl
and adjust the regex
to deal with gccX
.
Adjust first the list of valid compilers:
set valid_compilers {
{^apple-gcc-(4\.[02])$} {MacPorts Apple GCC %s}
{^cc$} {System cc}
{^clang$} {Xcode Clang}
{^gcc$} {System GCC}
{^gcc-(3\.3|4\.[02])$} {Xcode GCC %s}
{^llvm-gcc-4\.2$} {Xcode LLVM-GCC 4.2}
{^macports-clang$} {MacPorts Clang (port select)}
{^macports-clang-(\d+\.\d+)$} {MacPorts Clang %s}
{^macports-dragonegg-(\d+\.\d+)$} {MacPorts DragonEgg %s}
{^macports-dragonegg-(\d+\.\d+)-gcc-(\d+\.\d+)$}
{MacPorts DragonEgg %s with GCC %s}
{^macports-gcc$} {MacPorts GCC (port select)}
{^macports-gcc-(\d+\.\d+)$} {MacPorts GCC %s}
{^macports-gcc-(\d)$} {MacPorts GCC %s}
{^macports-llvm-gcc-4\.2$} {MacPorts LLVM-GCC 4.2}
}
and then add further below the macports-gcc-X section.
} elseif {[regexp {^macports-gcc(-\d+)?$} $compiler -> suffix]} {
if {$suffix ne ""} {
set suffix "-mp${suffix}"
}
switch $type {
cc -
objc { return ${prefix}/bin/gcc${suffix} }
cxx -
objcxx { return ${prefix}/bin/g++${suffix} }
cpp { return ${prefix}/bin/cpp${suffix} }
fc -
f77 -
f90 { return ${prefix}/bin/gfortran${suffix} }
}