[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #SWV-560841]: Linking problem to pgf90 (Fortran90, Portland compiler)



Hi Johan,

I'm sorry we were unable to diagnose the previously reported problem building 
netCDF with a PGI compiler on a SUSE 10.1 platform.  The only other netCDF 
support staff has been on vacation for a couple of weeks, but I see your 
previous question is still open, which means we haven't given up on it yet.  I 
just looked at it and noticed something simple that may solve the original 
problem with the PGI compiler, and also the new problem with gfortran as well.

I think you just have to get the compiler options in the right order, putting 
the library options *after* the named object file so the compiler knows what 
objects have to be resolved in the library before it looks in the library.

In other words, where you tried

  pgf90 -L/usr/local/netcdf-3.6.1/lib -lnetcdf \
        -I/usr/local/netcdf-3.6.1/src/f90 -o pres_temp_4D_wr.x \
         pres_temp_4D_wr.o

you should instead use something like

  
  pgf90 -I/usr/local/netcdf-3.6.1/src/f90 -o pres_temp_4D_wr.x \
         pres_temp_4D_wr.o -L/usr/local/netcdf-3.6.1/lib -lnetcdf

I just tried this the first way, which resulted in undefined references, and 
the second way, which worked fine.  I suspect you are seeing the same problem 
with gfortran.

Also, for future reference, you should only refer to installed locations, not 
to paths in the original source directories, so instead of 
-I/usr/local/netcdf-3.6.1/src/f90, use -I/usr/local/netcdf-3.6.1/include, 
assuming that's where the .h, .inc, and .mod files were installed.

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: SWV-560841
Department: Support netCDF
Priority: Critical
Status: Closed