[jira] [Created] (AVRO-2064) C: Problems with the pkg-config .pc file

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

[jira] [Created] (AVRO-2064) C: Problems with the pkg-config .pc file

JIRA jira@apache.org
Robert Edmonds created AVRO-2064:

             Summary: C: Problems with the pkg-config .pc file
                 Key: AVRO-2064
                 URL: https://issues.apache.org/jira/browse/AVRO-2064
             Project: Avro
          Issue Type: Bug
          Components: c
            Reporter: Robert Edmonds
            Priority: Minor


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:

    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.

This message was sent by Atlassian JIRA