Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2064

C: Problems with the pkg-config .pc file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • c
    • None

    Description

      Hi,

      I built the avro-c library with all of the optional codecs enabled. The avro-c.pc file produced by the build had the following Requires line:

      Requires: zlib liblzma libsnappy
      

      Since these are all library dependencies, I think they should be listed using Requires.private, not Requires. From the pkg-config(1) manpage:

      Requires.private:
          A list of packages required by this package. The difference from Requires is
          that the packages listed under Requires.private are not taken into account
          when a flag list is computed for dynamically linked executable (i.e., when
          --static was not specified). In the situation where each .pc file
          corresponds to a library, Requires.private shall be used exclusively to
          specify the dependencies between the libraries.
      

      Also, "libsnappy" is not the name of the pkg-config package shipped by the snappy library; it uses "snappy" (without the "lib" prefix) for the name of the .pc file. However, support for installing a .pc file was removed from the snappy master branch, but there is a pending PR to restore support for it, again under the "snappy.pc" name: https://github.com/google/snappy/pull/51.

      The avro-c library has a dependency on the Jansson library, but this dependency isn't recorded in the .pc file. (Jansson uses "jansson" for its pkg-config package name, without the "lib" prefix).

      Some Linux distros like Debian/Ubuntu don't ship a .pc file for snappy at all. (I opened this bug on the Debian side: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=871437). Placing a Requires(.private) on "snappy" in the avro-c.pc file on those systems will result in a pkg-config error like:

      Package snappy was not found in the pkg-config search path.
      Perhaps you should add the directory containing `snappy.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'snappy', required by 'avro-c', not found
      

      The only workaround I know of for this case where snappy is installed but the snappy.pc file is missing is to omit "snappy" from Requires.private and place "-lsnappy" in Libs.private.

      Attachments

        Activity

          People

            Unassigned Unassigned
            edmonds Robert Edmonds
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: