2

I'm trying to run fortran code using NetBeans 8.2 on my Mac running MacOS 10.14.3 Mojave. I installed gcc using homebrew, and the compiler is found at /usr/local/Cellar/gcc/8.2.0/bin/gfortran. This is the error from NetBeans Console:

cd '/Users/david/Desktop/Computational/ComputationalHW'
/usr/bin/make -f Makefile CONF=Debug
"/Library/Developer/CommandLineTools/usr/bin/make" -f
nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
"/Library/Developer/CommandLineTools/usr/bin/make"  -f
nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/computationalhw
mkdir -p dist/Debug/GNU-MacOSX
gfortran    -o dist/Debug/GNUMacOSX/computationalhwbuild/Debug/GNUMacOSX/HW1.o 
make[2]: gfortran: No such file or directory
make[2]: *** [dist/Debug/GNU-MacOSX/computationalhw] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 113ms)

Here's my configuration from NetBeans: image

UPDATE: I have also tried this configuration, same error:

/usr/local/bin/gfortran

Any help is appreciated.

UPDATE: One must simply add /usr/local/bin/ to $PATH on NetBeans. This resolves the issue.

  • Possible duplicate of [Netbeans fortran build fails on Mac OS 10.8, cannot see gfortran file](https://stackoverflow.com/q/19203622/2985643) though that question did not have an accepted answer. However, one answer stated _"I needed to make a new gfortran link in my /usr/bin (Base directory). After that it worked fine. If I had it in usr/local/bin,..or any other path it didn't work."_, so perhaps that is worth trying. – skomisa Feb 06 '19 at 04:25
  • Thanks, after following several links it became apparent that just adding /usr/local/bin to the $PATH config on NetBeans fixes it (DUH!). Apparently NetBeans doesn't look on that directory automatically. Issue has been resolved. – David Atri Schuller Feb 06 '19 at 05:26
  • Cool. Based on your feedback, presumably the solution I referred to worked for that user because `/usr/bin` was already on their $PATH. – skomisa Feb 06 '19 at 05:34
  • Thanks for the help. I'll accept my own answer once StackOverflow allows me (need to wait some time...) – David Atri Schuller Feb 06 '19 at 06:22

1 Answers1

2

Turns out NetBeans does not look under /usr/local/bin even though you might declare your compiler to be directly underneath that directory. Therefore, it is necessary to add the /usr/local/bin option to the $PATH configuration. enter image description here

On the Build Tools options in the settings on NetBeans, click on the $PATH button across Base Directory and under PATH = add the path to your own directory where your compiler is found.

Mine looks likes this:

${TOOLS_PATH};${PATH};/usr/local/bin

enter image description here