Menu

Adding openmpi-gcc5 to MacPortsport configure.tcl

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 regexto 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} }
        }
Posted by Carsten Lemmen 2016-01-23 Labels: macports port regex openmpi gcc5 tcl configure.compiler portconfigure openmpi-gcc5 macports-openmpi-gcc5
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.