Question

I Have in my Mac:

  • Octave-3.4.0
  • Gnuplot 4.2 - that I had to install because I had problems plotting - it wouldn't plot at all.

I need to load a netcdf file, the error that came was:

nc = netcdf('/users/matheuscortezi/Desktop/Pcse005/ocean_avg.nc', 'r')
error: `netcdf' undefined near line 9 column 6

So I think I don't have the netcdf comand installed, and tried installing by typing this on octave:

pkg install -global -forge octcdf

The error message that I receive from that is:

configure: error: in `/var/tmp/oct-t8XcYD/octcdf/src':
configure: error: C compiler cannot create executables
See `config.log' for more details.
the configure script returned the following error: checking for gcc... /usr/bin/gcc-4.2
checking whether the C compiler works... no
error: called from `pkg>configure_make' in file /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/pkg/pkg.m near line 1325, column 9
error: called from:
error:   /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/pkg/pkg.m at line 783, column 5
error:   /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/pkg/pkg.m at line 354, column 9

I haven't the faintest idea about what I should do. How can I solve this problem with either:

  • fixing this error, or
  • installing a netcdf "comand pack" (i don't know the name for that) so I can use netcdf() as in the example given.

Hope I was clear enough.

Was it helpful?

Solution

It seems to me that you installed Octave from the Mac OSX App bundle. That is not recommended at all. You should install from one of the package managers as explained on Octave's wiki. As far as I know, there are 3 options for Mac (see previous link). Just search for one that also has the netcdf package.

Anyway, if you really don't want to install it through a package manager (but seems to me you really should), seems that your problem lies on gcc (the GNU C compiler). do you have it installed at all? Some packages have code in C++ or C and are also dependent on some external libraries.

EDIT using a package manager would have also solved your problem about plotting since it would install gnuplot at same time

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top