Skip to content

Question: correct way to use Requires.private #300

@freeekanayaka

Description

@freeekanayaka

Hi,

I'm trying to understand how to correctly use the Requires.private property in a .pc file.

Let's say that libA internally depends on libB and that libA.so is dynamically linked to libB.so when libA is built as shared library.

My understanding is that libA should include libB in its Requires.private .pc file, is that right?

That would be mainly in order to support static builds.

Now, let's say that my-app is using libA and uses PKG_CHECK_MODULES in its configure.ac to detect the presence of libA. As far as I can see if Requires.private is used, the configure script of my-app will fail with something:

configure: error: Package requirements (libA >= 0.0.1) were not met:

Package 'libB', required by 'libA', not found

if the .pc file of libB is not installed on the system. This happens because the pkg.m4 macros generates a command like:

/usr/bin/pkg-config --cflags "libA >= 0.0.1"

which fails with:

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

Distributions like Debian ship .pc files in a separate -dev package, so the scenario in which the .pc file of libA is present, but the one of libB is not is actually the normal one, because a user building my-app should only need the the libA-dev package.

Should perhaps Libs.private be used instead? I'm confused about the proper way to do this.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions