pkg-config --cflags will always add private dependency #114

Closed
opened 2017-02-15 05:14:49 +00:00 by mtasaka · 8 comments
mtasaka commented 2017-02-15 05:14:49 +00:00 (Migrated from github.com)

ref:
https://bugzilla.redhat.com/show_bug.cgi?id=1422256
With
https://github.com/pkgconf/pkgconf/blob/master/main.c#L1139
pkg-config --cflags will always adds private dependency, which is not desired.

Perhaps changed with the commit 7b39c38408 , I think the line above is not intended change.

ref: https://bugzilla.redhat.com/show_bug.cgi?id=1422256 With https://github.com/pkgconf/pkgconf/blob/master/main.c#L1139 pkg-config --cflags will always adds private dependency, which is not desired. Perhaps changed with the commit 7b39c38408889c4a2a18e8dc3b2fedada5bc94ed , I think the line above is not intended change.
mtasaka commented 2017-02-15 05:59:38 +00:00 (Migrated from github.com)
Especially the change: https://github.com/pkgconf/pkgconf/commit/7b39c38408889c4a2a18e8dc3b2fedada5bc94ed#diff-2045016cb90d1e65d71c2407a2570927R1084
ignatenkobrain commented 2017-02-15 10:33:57 +00:00 (Migrated from github.com)

I think this is not a bug:

[brain@ignatenko-w541 libsolv]$ cat /usr/lib64/pkgconfig/gnutls.pc 
# Process this file with autoconf to produce a pkg-config metadata file.

# Copyright (C) 2004-2012 Free Software Foundation, Inc.

# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.  This file is offered as-is,
# without any warranty.

# Author: Simon Josefsson

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib64
includedir=/usr/include

Name: GnuTLS
Description: Transport Security Layer implementation for the GNU system
URL: http://www.gnutls.org/
Version: 3.5.8
Libs: -L${libdir} -lgnutls
Libs.private: -L/usr/lib64 -lz     -lp11-kit    -ltspi -lgmp -L/usr/lib64 -lunistring
Requires.private: nettle, hogweed, libtasn1, libidn, p11-kit-1, zlib
Cflags: -I${includedir}
[brain@ignatenko-w541 libsolv]$ pkgconf --libs gnutls
-lgnutls 

If any of Requires.private doesn't exist (and you don;t use them) it seems like bug in upstream rather than in pkgconf...

I think this is not a bug: ``` [brain@ignatenko-w541 libsolv]$ cat /usr/lib64/pkgconfig/gnutls.pc # Process this file with autoconf to produce a pkg-config metadata file. # Copyright (C) 2004-2012 Free Software Foundation, Inc. # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. This file is offered as-is, # without any warranty. # Author: Simon Josefsson prefix=/usr exec_prefix=/usr libdir=/usr/lib64 includedir=/usr/include Name: GnuTLS Description: Transport Security Layer implementation for the GNU system URL: http://www.gnutls.org/ Version: 3.5.8 Libs: -L${libdir} -lgnutls Libs.private: -L/usr/lib64 -lz -lp11-kit -ltspi -lgmp -L/usr/lib64 -lunistring Requires.private: nettle, hogweed, libtasn1, libidn, p11-kit-1, zlib Cflags: -I${includedir} [brain@ignatenko-w541 libsolv]$ pkgconf --libs gnutls -lgnutls ``` If any of Requires.private doesn't exist (and you don;t use them) it seems like bug in upstream rather than in pkgconf...
mtasaka commented 2017-02-15 11:16:32 +00:00 (Migrated from github.com)

--libs behaves correctly. Here we say --cflags behavior.

``--libs`` behaves correctly. Here we say ``--cflags`` behavior.
mtasaka commented 2017-02-15 11:21:09 +00:00 (Migrated from github.com)

If any of Requires.private doesn't exist (and you don;t use them)

Well, I don't understand what you are saying here. Requires.private must be used when used with --static flags appended, but must not for usual --libs or --cflags

> If any of Requires.private doesn't exist (and you don;t use them) Well, I don't understand what you are saying here. ``Requires.private`` must be used when used with ``--static`` flags appended, but must not for usual ``--libs`` or ``--cflags``

Changing that causes 3 testsuite failures. I need to dissect those failures.

Changing that causes 3 testsuite failures. I need to dissect those failures.

I am not sure this is a bug actually. Observe with freedesktop's implementation:

kaniini@Williams-iMac-2 ~/d/pkgconf> pkg-config --version
0.29.1
kaniini@Williams-iMac-2 ~/d/pkgconf> cat tests/lib1/baz.pc
prefix=/test
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: bar
Description: Another pkg-config test (with private Requires, ha!)
Version: 1.3
Libs: -L${libdir} -lbaz
Libs.private: -L${libdir} -lzee
Requires.private: foo
kaniini@Williams-iMac-2 ~/d/pkgconf> env PKG_CONFIG_PATH=tests/lib1 pkg-config --cflags baz
-fPIC -I/test/include/foo
kaniini@Williams-iMac-2 ~/d/pkgconf> sed s:foo:moo:g tests/lib1/baz.pc > tests/lib1/baz-broken.pc
kaniini@Williams-iMac-2 ~/d/pkgconf> env PKG_CONFIG_PATH=tests/lib1 pkg-config --cflags baz-broken
Package moo was not found in the pkg-config search path.
Perhaps you should add the directory containing `moo.pc'
to the PKG_CONFIG_PATH environment variable
Package 'moo', required by 'baz-broken', not found
I am not sure this is a bug actually. Observe with freedesktop's implementation: ``` kaniini@Williams-iMac-2 ~/d/pkgconf> pkg-config --version 0.29.1 kaniini@Williams-iMac-2 ~/d/pkgconf> cat tests/lib1/baz.pc prefix=/test exec_prefix=${prefix} libdir=${prefix}/lib includedir=${prefix}/include Name: bar Description: Another pkg-config test (with private Requires, ha!) Version: 1.3 Libs: -L${libdir} -lbaz Libs.private: -L${libdir} -lzee Requires.private: foo kaniini@Williams-iMac-2 ~/d/pkgconf> env PKG_CONFIG_PATH=tests/lib1 pkg-config --cflags baz -fPIC -I/test/include/foo kaniini@Williams-iMac-2 ~/d/pkgconf> sed s:foo:moo:g tests/lib1/baz.pc > tests/lib1/baz-broken.pc kaniini@Williams-iMac-2 ~/d/pkgconf> env PKG_CONFIG_PATH=tests/lib1 pkg-config --cflags baz-broken Package moo was not found in the pkg-config search path. Perhaps you should add the directory containing `moo.pc' to the PKG_CONFIG_PATH environment variable Package 'moo', required by 'baz-broken', not found ```

To expand on this -- at the very least, it is not a regression. We could argue it is still suboptimal behaviour (or at least unobvious), and I would tend to agree.

Requires.private is not strictly actually about --static, it is meant to be a list of dependent SDKs that are not directly required by the end user but still needed to build against. For CFLAGS, this means that Requires.private should be considered. If anything, the error message should likely be improved to clarify if it is a private dependency or not, and then more appropriate advice could be given. There is also freedesktop bug 4378 that documents some other quirkyness.

To expand on this -- at the very least, it is not a regression. We could argue it is still suboptimal behaviour (or at least unobvious), and I would tend to agree. `Requires.private` is not strictly actually about `--static`, it is meant to be a list of dependent SDKs that are not directly required by the end user but still needed to build against. For CFLAGS, this means that `Requires.private` should be considered. If anything, the error message should likely be improved to clarify if it is a private dependency or not, and then more appropriate advice could be given. There is also [freedesktop bug 4378](https://bugs.freedesktop.org/show_bug.cgi?id=4738) that documents some other quirkyness.

For now, we will reject this bug, but we should look into making Requires.private more flexible in the future.

For now, we will reject this bug, but we should look into making Requires.private more flexible in the future.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ariadne/pkgconf#114
There is no content yet.