This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Dusanka, > Package Version: netcdf-4.3.0, C libraries > Operating System: Mac OS X Version 10.5.8 > Hardware: iMac Intel Core 2 Duo, 2.8 GHz > Description of problem: Could you please read the attached pdf file. In the future, please attach plain text files rather than PDF's. The conversion to PDF can change some characters, for example minus signs to hyphens. > I tried to install and build the NetCDF C libraries following the > instructions for > building NetCDF with classic libraries only. I typed the following: > ./configure ‐‐prefix=/Applications/netcdf ‐‐disable‐netcdf‐4 That's an unconventional place to install library software such as netCDF. More typical would be --prefix=/usr/local (the default) or --prefix=/usr/local/netcdf. But it should work OK anyway ... > and got the following messages: > > configure: netCDF 4.3.0 > checking build system type... i386‐apple‐darwin9.8.0 That is MacOS-X 10.5.8 ("Leopard"), from 2009. We no longer have that version, so I can't reproduce exactly what happened in your case. > checking type gcc... gcc is hashed (/usr/bin/gcc) It looks like you're using the gcc compiler from Apple rather than one from a package management system such as MacPorts, fink, or brewpub. Below, you also indicate problems with building the Fortran netCDF library. Finding and installing a gfortran that works with the Apple gcc is not easy, but one of these sites may provide a way to get or build gfortran for older versions of MacOS-X that will work with Apple's gcc: http://gcc.gnu.org/wiki/GFortranBinariesMacOS http://r.research.att.com/tools/ http://www.webmo.net/support/fortran_osx.html http://web.mit.edu/mfloyd/www/computing/mac/gfortran/ Your configure for the netCDF C library, version 4.3.0 seems to have worked OK. > milija‐zupanskis‐imac:netcdf‐4.3.0 milija$ make check install > Making check in include ... looks OK > Making check in oc2 ... looks OK > Making check in libdispatch ... looks OK > Making check in libsrc ... looks OK > Making check in libdap2 ... looks OK, until this compile error occurs: > /bin/sh ../libtool ‐‐tag=CC ‐‐mode=compile gcc ‐DHAVE_CONFIG_H ‐I. ‐I.. ‐ > I../include ‐I../oc2 ‐g ‐O2 ‐MT libdap2_la‐daputil.lo ‐MD ‐MP ‐MF > .deps/libdap2_ladaputil. > Tpo ‐c ‐o libdap2_la‐daputil.lo `test ‐f 'daputil.c' || echo './'`daputil.c > libtool: compile: gcc ‐DHAVE_CONFIG_H ‐I. ‐I.. ‐I../include ‐I../oc2 ‐g ‐O2 > ‐MT > libdap2_la‐daputil.lo ‐MD ‐MP ‐MF .deps/libdap2_la‐daputil.Tpo ‐c daputil.c > ‐fnocommon > ‐DPIC ‐o .libs/libdap2_la‐daputil.o > In file included from ncdap3.h:12, > from daputil.c:16: > /usr/include/unistd.h:117: error: two or more data types in declaration > specifiers > make[1]: *** [libdap2_la‐daputil.lo] Error 1 > make: *** [check‐recursive] Error 1 The above looks like a problem in the system header file in /usr/include/unistd.h rather than netCDF. It may be a symptom that the versions of the XCode software and associated command-line tools available from the Downloads for Apple Developers are not consistent. I can't duplicate the error here, but it looks like you found a work-around by configuring with --disable-dap ... > Then, I installed it successfully in /Applications/netcdf using the options > "‐‐disablenetcdf‐ > 4 ‐‐disable‐dap". When typing > ls ‐l /Applications/netcdf > I get this response: > drwxr‐xr‐x 7 milija admin 238 Oct 26 08:43 bin > drwxr‐xr‐x 3 milija admin 102 Oct 26 08:43 include > drwxr‐xr‐x 8 milija admin 272 Oct 26 08:44 lib > drwxr‐xr‐x 4 milija admin 136 Oct 26 08:54 share > Indicating that I have installed netCDF C libraries (however, I did not see > libnetcdf.so under lib) On OSX, shared libraries have a ".dylib" extension instead of ".so". If you see a file in lib/ with that extension, you have installed shared libraries. > Finally, I wanted to install fortran libraries (version netcdf‐fortran‐4.2) > by typing > these commands (for shared libraries): > export DIR1=/Applications/netcdf > export LD_LIBRARY_PATH=${DIR1}/lib:${LD_LIBRARY_PATH} > CPPFLAGS=‐I${DIR1}/include LDFLAGS=‐L${DIR1}/lib ./configure ‐‐prefix=${DIR1} > and got these messages: > configure: netCDF‐Fortran 4.2 > checking build system type... i386‐apple‐darwin9.8.0 ... > configure: finding Fortran compiler (will not be used if Fortran API is not > desired) > checking for gfortran... no ... > checking for ifort... ifort > checking whether we are using the GNU Fortran compiler... no I don't think you can use the ifort Fortran compiler with the gcc C compiler. You should either be using gcc with gfortran or icc with ifort. That explains why configure can't link a Fortran program with a C function: ... > checking for Fortran "integer*2"... yes > checking if Fortran "byte" is C "signed char"... configure: error: Could not > link > conftestf.o and conftest.o The detailed error message will be in your config.log file, but it almost certainly means you tried to use ifort to link an ifort-compiled object with a gcc-compiled shared library. Also note that when using shared libraries and following the instructions here: http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html on OSX you would have to use DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH. I hope this helps. Another alternative for you would be to install a package management system, such as from macports.org, and then you could get netCDF Fortran installed with just: port install netcdf-fortran though it would take a long time to first install all the dependencies, such as HDF5 and compatible gcc and gfortran compilers ... --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: ZVF-115031 Department: Support netCDF Priority: Normal Status: Closed