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 Li, I'm not sure whether you're trying to build shared or static libraries, but the instructions are different in the two cases. In any case, the instructions are here for both kinds of libraries: http://www.unidata.ucar.edu/netcdf/docs/building_netcdf_fortran.html#building_fortran_shared_libraries For OSX, be sure to use DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH to indicate where the C library is installed. Please let us know if following the instructions above doesn't work. It works for us on OSX. --Russ > I am developing a package manager (https://github.com/dongli/packman), > which will install packages (i.e. netcdf) by just one command. It should > support multiple Linux distributions and Mac OS X. Currently, I am > testing netcdf-fortran with parallel option enabled. The compiler set is > from GCC 4.9.1. > > The hdf5, netcdf-c and mpich (or openmpi) have been installed correctly > on CentOS and Mac OS X. Then I tried to build netcdf-fortran 4.4.1, the > one on CentOS was built successfully, but the one on Mac OS X failed > with the following errors when checking: > > libtool: link: /opt/packman/mpich/3.1.2/1/bin/mpif77 -I../fortran > -I../fortran -g -O2 -o .libs/nf_test f03lib_f_interfaces.o test_get.o > test_put.o nf_error.o nf_test.o test_read.o test_write.o util.o f03lib.o > -L/opt/packman/netcdf_c/4.3.2/1/lib ../fortran/.libs/libnetcdff.dylib > Undefined symbols for architecture x86_64: > "_nc__create", referenced from: > import-atom in libnetcdff.dylib > "_nc__create_mp", referenced from: > import-atom in libnetcdff.dylib > "_nc__enddef", referenced from: > import-atom in libnetcdff.dylib > … > > I have checked the same compile command on CentOS: > > libtool: link: /home/dongli/tools/mpich/3.1.2/1/bin/mpif77 -I../fortran > -I../fortran -g -O2 -o .libs/nf_test f03lib_f_interfaces.o test_get.o > test_put.o nf_error.o nf_test.o test_read.o test_write.o util.o f03lib.o > -L/home/dongli/tools/netcdf_c/4.3.2/1/lib ../fortran/.libs/libnetcdff.so > -L/home/dongli/tools/curl/7.37.1/1/lib -L/home/dongli/tools/zlib/1.2.8/1/lib > -L/home/dongli/tools/szip/2.1/1/lib -L/home/dongli/tools/hdf5/1.8.13/1/lib > -L/home/dongli/tools/parallel_netcdf/1.5.0/1/lib > /home/dongli/tools/netcdf_c/4.3.2/1/lib/libnetcdf.so -lpnetcdf > /home/dongli/tools/hdf5/1.8.13/1/lib/libhdf5_hl.so > /home/dongli/tools/hdf5/1.8.13/1/lib/libhdf5.so > /home/dongli/tools/szip/2.1/1/lib/libsz.so -ldl -lm > /home/dongli/tools/curl/7.37.1/1/lib/libcurl.so -lidn -lssl -lcrypto -lldap > -lz -lrt -Wl,-rpath -Wl,/home/dongli/tools/netcdf_fortran/4.4.1/1/lib > -Wl,-rpath -Wl,/home/dongli/tools/netcdf_c/4.3.2/1/lib -Wl,-rpath > -Wl,/home/dongli/tools/hdf5/1.8.13/1/lib -Wl,-rpath -Wl,/home/dongli/tool s/ > szip/2.1/1/lib -Wl,-rpath -Wl,/home/dongli/tools/curl/7.37.1/1/lib > > As you can see, on CentOS more options have been appended, so the '_nc_*' > symbols have been resolved. > > So I would like to know what are the differences of building procedures > on the two systems, and how could I solve this problem on Mac OS X? > > Best regards, > > Li > > ----------------------------------------- > Dr. Li Dong (??) > LASG, Institute of Atmospheric Physics > Chinese Academy of Sciences > P.O. Box 9804 > Beijing 100029, China > Phone: 8610-8299 5143 > Website: http://dongli.github.io/dongli > > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: QBX-695002 Department: Support netCDF Priority: Normal Status: Closed