Opened 14 years ago

Closed 13 years ago

#29059 closed defect (invalid)

netcdf: ld: symbol(s) not found error when compiling fortran code using netcdf +gcc45 and gcc45 macports install

Reported by: serra@… Owned by: tenomoto (Takeshi Enomoto)
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: Cc:
Port: netcdf

Description (last modified by jmroot (Joshua Root))

Hi,

I have installed gcc45 and netcdf +gcc45 on a mac running 10.5.8 and have tested the install on a simple fortran code which calls the netcdf library. When I compile this code I get the error:

[cassava:~] serra% gfortran -I/opt/local/include handle_err.f -o handle_err -L/opt/local/lib -lnetcdf
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
  "_nf_strerror_", referenced from:
      _handle_err_ in ccJcyNUi.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I've had trouble before with macports netcdf libs not working with fortran and ended up creating my own Portfile. But that installation will not work any more. I think because I upgraded all my macports code and hdf5 is now hdf5-18. I did try to fix the problem by installing hdf5-18 +gcc45 and then reinstalling netcdf but this did not fix the problem.

I rely on the netcdf libraries every day in my work so desperately need to fix this issue!

Thanks.

Change History (4)

comment:1 Changed 14 years ago by jmroot (Joshua Root)

Description: modified (diff)
Keywords: netcdf removed
Owner: changed from macports-tickets@… to takeshi@…
Priority: HighNormal

Please remember to cc the maintainer. As per the ticket guidelines, the High priority is reserved for the use of MacPorts team members.

comment:2 Changed 14 years ago by tenomoto (Takeshi Enomoto)

You need to link against the netcdf fortran library.

$ nc-config --flibs
-L/opt/local/lib -lnetcdff -lnetcdf

comment:3 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Summary: ld: symbol(s) not found error when compiling fortran code using netcdf +gcc45 and gcc45 macports installnetcdf: ld: symbol(s) not found error when compiling fortran code using netcdf +gcc45 and gcc45 macports install

Is there a bug here that we need to fix or can we close this ticket?

comment:4 Changed 13 years ago by tenomoto (Takeshi Enomoto)

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.