New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #29059 (closed defect: invalid)

Opened 2 years ago

Last modified 15 months ago

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

Reported by: serra@… Owned by: takeshi@…
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: Cc:
Port: netcdf

Description (last modified by jmr@…) (diff)

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

comment:1 Changed 2 years ago by jmr@…

  • Owner changed from macports-tickets@… to takeshi@…
  • Priority changed from High to Normal
  • Description modified (diff)
  • Keywords netcdf removed

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 2 years ago by takeshi@…

You need to link against the netcdf fortran library.

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

comment:3 Changed 15 months ago by ryandesign@…

  • Summary changed from ld: symbol(s) not found error when compiling fortran code using netcdf +gcc45 and gcc45 macports install to netcdf: 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 15 months ago by takeshi@…

  • Status changed from new to closed
  • Resolution set to invalid
Note: See TracTickets for help on using tickets.