ralna / CUTEst

The Constrained and Unconstrained Testing Environment with safe threads (CUTEst) for optimization software
Other
88 stars 19 forks source link

Issue in installing gfortran-4.3 #16

Closed senna1128 closed 3 years ago

senna1128 commented 3 years ago

Dear Prof. Gould,

I was tying to install CUTEst and its interface with MATLAB via the instruction from https://github.com/ralna/CUTEst/wiki. I'm using 64-bit max osx system. I have gone to the step of

"Now move to the ./cutest directory, enter the command $ARCHDEFS/install_optrove and follow the instructions."

When I change the directory and enter $ARCHDEFS/install_optrove, the first question is "Do you wish to install CUTEst (Y/n)? " I enter ``Y".

The second question is "Do you require the CUTEst-Matlab interface (y/N)?" I enter Y., Then I select platform "13", which is "64-bit MAC OS/X".

Then the third question is "Would you like to review and modify the system commands (y/N)?" I enter "N". Then I select Matlab version "4", which is "R2016b-R2017b", since I'm using R2017a.

Then, it results in a warning "Warning: you need to install gfortran-4.3 to allow for Matlab and CUTEst interaction. Aborting".

How to fix this issue? I think I have installed gfortran 10.2 from https://github.com/fxcoudert/gfortran-for-macOS/releases, though it's not 4.3. I also tried to run brew install gcc on the terminal, but the warning is still on.

Is there a way to fix this issue?

Although this is warning, I think I haven't installed CUTEst successfully. When I run the test by cutest2matlab_osx LUBRIFC.SIF

I got the result like

(base) Sens-MacBook-Pro:cutest senna$ cutest2matlab_osx LUBRIFC.SIF
#!/bin/bash -vx
###############################################################################
#
# cutest2matlab_osx: build the bridge between CUTEst and Matlab on OSX
# without relying on Matlab gfortran support
#
# Adapted from cutest2matlab by D. Orban, June 2017. Original version by
# Nick Gould for GALAHAD Productions, January 2013
#
###############################################################################

function help() {
  echo 'Use this script on OSX with gfortran and Matlab R2016a or later.'
  echo 'The script *may* work with earlier versions of Matlab but was not tested.'
  echo
  echo "Use: $(basename $0) PROBLEM[.SIF]"
  exit 0
}

[[ $# > 0 && ("$1" == '-h' || "$1" == '--help') ]] && help
+ [[ 1 > 0 ]]
+ [[ LUBRIFC.SIF == \-\h ]]
+ [[ LUBRIFC.SIF == \-\-\h\e\l\p ]]

if [[ -z "$MYMATLABARCH" ]]; then
  if [[ -z "$MYARCH" ]]; then
    echo ' neither environment variable MYMATLABARCH nor MYARCH is set.'
    echo ' Set MYMATLABARCH as a gfortran-installed version from the list '
    /bin/ls -1 $CUTEST/versions 2>/dev/null
    echo ' and re-run.'
    exit 1
  else
    ARCH=${MYARCH}
  fi
else
  ARCH=${MYMATLABARCH}
fi
+ [[ -z mac64.osx.gfo ]]
+ ARCH=mac64.osx.gfo

#  check that the architecture provided in MYMATLABARCH or MYARCH exists

if [[ ! -e $CUTEST/versions/$ARCH ]] ; then
    echo ' The architecture privided by the environment variables MYMATLABARCH'
    echo '  and MYARCH has not been installed. Install a gfortran version of'
    echo ' CUTEst unsing install_cutest and re-run.'
    exit 2
fi
+ [[ ! -e /Users/senna/course/Mihai/pro6/simu/code/cutest/versions/mac64.osx.gfo ]]
+ echo ' The architecture privided by the environment variables MYMATLABARCH'
 The architecture privided by the environment variables MYMATLABARCH
+ echo '  and MYARCH has not been installed. Install a gfortran version of'
  and MYARCH has not been installed. Install a gfortran version of
+ echo ' CUTEst unsing install_cutest and re-run.'
 CUTEst unsing install_cutest and re-run.
+ exit 2

Best, Sen

nimgould commented 3 years ago

Dear Sen

The issue is precisely as the error message suggests - Matlab R2017a needs gfortran 4.3 to build the Mex bridge from the fortran to Matlab, and other versions of gfortran are not compatible. I don't have access to an OSX machine, this side of CUTEst is taken care of by my colleague Dominique Orban who knows all about the tricky issues of homebrewing gcc/gfortran and OSX. Unfortunately as you are aware, Apple no longer supports gcc officially, and OSX users will always have to install an unofficial version, just as you have done. As far as I am aware, no verion of Matlab supports gfortran 10, Matlab is always a few years behind the state of the art. I am sorry but really I cannot help here, you will need a version of gfortran that is compatible with your version of Matlab.

Nick

senna1128 commented 3 years ago

Thanks Nick for quick reply. Finally I gave up using Matlab to interact with CUTEst. I'm now using Julia instead. I follow the instruction from https://abelsiqueira.github.io/blog/nlpmodelsjl-cutestjl-and-other-nonlinear-optimization-packages-on-julia/ and https://github.com/JuliaSmoothOptimizers/CUTEst.jl. It seems it now works fine.

In any case, thank you for the reply. Matlab is not very friendly to interact with other programs.

Sen