[MacPorts] #57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[MacPorts] #57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?

MacPorts
#57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?
------------------------+----------------------
 Reporter:  ryandesign  |      Owner:  tenomoto
     Type:  defect      |     Status:  assigned
 Priority:  Normal      |  Milestone:
Component:  ports       |    Version:
 Keywords:              |       Port:  netcdf
------------------------+----------------------
 When netcdf +netcdf4 is installed, the nccopy, ncdump, ncgen, and ncgen3
 programs and the  libnetcdf library are linked with libhdf5 and libhdf5_hl
 (and libz and libcurl), but also:

 {{{
 $ pkg-config netcdf --libs
 -L/opt/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -ldl -lm -lcurl
 }}}

 {{{
 $ nc-config --libs
 -L/opt/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -ldl -lm -lcurl
 }}}

 This means anything that uses one of the above commands to determine what
 libraries to link to for netcdf will be told that it must link not only
 with libnetcdf but also with libhdf5 and libhdf5_hl and libz and libcurl.
 I suspect this is overlinking and that netcdf should not be doing that.

 Particularly in the case of libhdf5, this causes problems whenever hdf5 is
 updated, since it invariably comes with a new major library version
 number, which means everything linking with it must be rebuilt by having
 its revision increased. It's easy to identify which ports declare an
 explicit dependency on the hdf5 port and revbump those, but it is not
 expected that one would also have to seek out the ports that link with
 netcdf and revbump them, but that is what we currently have to do; see
 e.g. https://github.com/macports/macports-ports/pull/3137.

--
Ticket URL: <https://trac.macports.org/ticket/57733>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?

MacPorts
#57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?
-------------------------+----------------------
  Reporter:  ryandesign  |      Owner:  tenomoto
      Type:  defect      |     Status:  assigned
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:              |   Keywords:
      Port:  netcdf      |
-------------------------+----------------------

Comment (by Dave-Allured):

 For static linking, I think you need to name all those libraries.  For
 dynamic linking, you are right, this is overlinking.  From Netcdf install
 docs:

 https://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html#linking

 {{{
 "For shared builds, only -L${NCDIR}/lib -lnetcdf is needed.
 All other libraries will be found automatically."
 }}}

 I am not familiar with pkg-config.  In scenarios like this, single library
 with many dependencies under the hood, what is best practice for use or
 non-use of pkg-config or nc-config in package make files, and in the port
 file?  I would imagine there is already a standard solution for this.

 Use of nc-config and pkg-config is currently being discussed here.  Feel
 free to ask about application to Macports:

 https://github.com/Unidata/netcdf-c/issues/1257

--
Ticket URL: <https://trac.macports.org/ticket/57733#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?

MacPorts
In reply to this post by MacPorts
#57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?
-------------------------+----------------------
  Reporter:  ryandesign  |      Owner:  tenomoto
      Type:  defect      |     Status:  assigned
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:              |   Keywords:
      Port:  netcdf      |
-------------------------+----------------------

Comment (by tenomoto):

 I summarized the discussion here in the issue 1257. See what the upstream
 developers answer.

--
Ticket URL: <https://trac.macports.org/ticket/57733#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?

MacPorts
In reply to this post by MacPorts
#57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?
-------------------------+----------------------
  Reporter:  ryandesign  |      Owner:  tenomoto
      Type:  defect      |     Status:  assigned
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:              |   Keywords:
      Port:  netcdf      |
-------------------------+----------------------

Comment (by Dave-Allured):

 This problem is now fixed upstream in netcdf-c for pkg-config only.  On
 the next portfile update for new netcdf release 4.6.3, you can use this
 for dynamic (shared) linking:
 {{{
 $ pkg-config netcdf --libs
 }}}
 And for static builds, add the --static option:
 {{{
 $ pkg-config netcdf --libs --static
 }}}
 See pkg-config docs. This guide to pkg-config is helpful:
 https://people.freedesktop.org/~dbn/pkg-config-guide.html

--
Ticket URL: <https://trac.macports.org/ticket/57733#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?

MacPorts
In reply to this post by MacPorts
#57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?
-------------------------+----------------------
  Reporter:  ryandesign  |      Owner:  tenomoto
      Type:  defect      |     Status:  assigned
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:              |   Keywords:
      Port:  netcdf      |
-------------------------+----------------------

Comment (by Dave-Allured):

 Netcdf update is requested in #58212.

--
Ticket URL: <https://trac.macports.org/ticket/57733#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?

MacPorts
In reply to this post by MacPorts
#57733: netcdf: Ports linking with netcdf also link with hdf5—overlinking?
-------------------------+----------------------
  Reporter:  ryandesign  |      Owner:  tenomoto
      Type:  defect      |     Status:  closed
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:  fixed       |   Keywords:
      Port:  netcdf      |
-------------------------+----------------------
Changes (by tenomoto):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"379ff8de4f759f28290a273ef284119b0c40b68c/macports-ports"
 379ff8de4f759f28290a273ef284119b0c40b68c/macports-ports] (master):
 {{{
 #!ConfigurableCommitTicketReference repository="macports-ports"
 revision="379ff8de4f759f28290a273ef284119b0c40b68c"
 netcdf: update to 4.4.3 and associated rev-bumps

 Closes: https://trac.macports.org/ticket/58212
 Closes: https://trac.macports.org/ticket/57733
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/57733#comment:6>
MacPorts <https://www.macports.org/>
Ports system for macOS