Skip to contentSkip to conversation

package.bbclass: Add Requires.private field in package_do_pkgconfig()

PATCH In review Sreejith Ravi 3 participants 8 messages Jun 25, 2024 – Jun 26, 2024 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package.bbclass: Add Requires.private field in package_do_pkgconfig()

Currently, the package_do_pkgconfig() only handles the "Requires" key field from the .pc file and ignores the "Requires.private" field while generating the dev dependency chain. This results in a broken dependency list and requires the installation of recommended packages to resolve the build dependencies when using the dev IPKs. This increases the hard disk space usage and download time and installs many unnecessary packages as part of the recommendations.

This patch ensures that the "Requires.private" field is also considered when creating the dependency list for the dev IPKs. With this, the dev IPK will have the proper dependencies listed, eliminating the need to install recommended packages to resolve the build time dependencies.

Example: usr/lib/pkgconfig/libical.pc
----------
Libs: -L${libdir} -lical -licalss -licalvcal
Libs.private: -lpthread
Requires.private: icu-i18n
----------
Depends field generated for libical-dev
Depends: glib-2.0-dev, libical (= 3.0.7-r0)
------------

When trying to resolve the build time dependency with libical package using “-dev” ipk generated, it will throw the below error.
-----------
Package icu-i18n was not found in the pkg-config search path. Perhaps you should add the directory containing `icu-i18n.pc' to the PKG_CONFIG_PATH environment variable
Package 'icu-i18n', required by 'libical', not found
-----------

This patch will fix the broken dependency list.

-------
libical-dev depends field generated with this patch
Depends: glib-2.0-dev, icu-dev, libical (= 3.0.7-r0)
-------

Other examples of packages generated with broken dev dependency.

libflac-dev : https://packages.debian.org/sid/libflac-dev
Without patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++ with patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++, libogg-dev

libglib2.0-dev : https://packages.debian.org/buster/libglib2.0-dev
without patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev with patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev,
util-linux-dev, zlib-dev

---
 meta/classes/package.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/package.bbclass +1 -1
index 67351b2510..084fe428e5 100644
@@ -2182,7 +2182,7 @@ python package_do_pkgconfig () {
                         if m:
                             hdr = m.group(1)
                             exp = pd.expand(m.group(2))
-                            if hdr == 'Requires':
+                            if hdr == 'Requires' or hdr == 'Requires.private':
                                 pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
                                 continue
                         m = var_re.match(l)
Signature · 1 line
2.34.1
#1 lore raw
Quoted 64 lines · Sreejith Ravi via lists.openembedded.org

Currently, the package_do_pkgconfig() only handles the "Requires" key field from the .pc file and ignores the "Requires.private" field while generating the dev dependency chain. This results in a broken dependency list and requires the installation of recommended packages to resolve the build dependencies when using the dev IPKs. This increases the hard disk space usage and download time and installs many unnecessary packages as part of the recommendations.

This patch ensures that the "Requires.private" field is also considered when creating the dependency list for the dev IPKs. With this, the dev IPK will have the proper dependencies listed, eliminating the need to install recommended packages to resolve the build time dependencies.

Example: usr/lib/pkgconfig/libical.pc
----------
Libs: -L${libdir} -lical -licalss -licalvcal
Libs.private: -lpthread
Requires.private: icu-i18n
----------
Depends field generated for libical-dev
Depends: glib-2.0-dev, libical (= 3.0.7-r0)
------------

When trying to resolve the build time dependency with libical package using “-dev” ipk generated, it will throw the below error.
-----------
Package icu-i18n was not found in the pkg-config search path. Perhaps you should add the directory containing `icu-i18n.pc' to the PKG_CONFIG_PATH environment variable
Package 'icu-i18n', required by 'libical', not found
-----------

This patch will fix the broken dependency list.

-------
libical-dev depends field generated with this patch
Depends: glib-2.0-dev, icu-dev, libical (= 3.0.7-r0)
-------

Other examples of packages generated with broken dev dependency.

libflac-dev : https://packages.debian.org/sid/libflac-dev
Without patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++ with patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++, libogg-dev

libglib2.0-dev : https://packages.debian.org/buster/libglib2.0-dev
without patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev with patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev, util-linux-dev, zlib-dev

---
 meta/classes/package.bbclass | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/package.bbclass +0 -0
index 67351b2510..084fe428e5 100644
@@ -2182,7 +2182,7 @@ python package_do_pkgconfig () {
Quoted 9 lines

                         if m:
                             hdr = m.group(1)
                             exp = pd.expand(m.group(2))
-                            if hdr == 'Requires':
+                            if hdr == 'Requires' or hdr == 'Requires.private':
                                 pkgconfig_needed[pkg] += exp.replace(',', ' ').split() continue
                         m = var_re.match(l)

As I understand it, Requires.private are only needed for static linking so shouldn't this dependency just be added to the -staticdev package? The -dev package wouldn't contain a static library anyway. Did you have static libraries enabled?

Cheers,

Richard

#2 lore raw

No, static libraries were not enabled. I am using only the -dev IPK, which has only the shared libraries. With this change, it is successfully building. Also, if it links to the static library, it will fail as I am not installing the static IPK.

In the latest pkgconf commit, it looks like Requires.private is needed for header inclusion also:
https://github.com/pkgconf/pkgconf/commit/2d26db3a984e7a69cedc6274c22119de4bcf1b40

Cheers
Sreejith

Quoted 90 lines · Richard Purdie
Quoted 64 lines · Sreejith Ravi via lists.openembedded.org

Currently, the package_do_pkgconfig() only handles the "Requires" key field from the .pc file and ignores the "Requires.private" field while generating the dev dependency chain. This results in a broken dependency list and requires the installation of recommended packages to resolve the build dependencies when using the dev IPKs. This increases the hard disk space usage and download time and installs many unnecessary packages as part of the recommendations.

This patch ensures that the "Requires.private" field is also considered when creating the dependency list for the dev IPKs. With this, the dev IPK will have the proper dependencies listed, eliminating the need to install recommended packages to resolve the build time dependencies.

Example: usr/lib/pkgconfig/libical.pc
----------
Libs: -L${libdir} -lical -licalss -licalvcal
Libs.private: -lpthread
Requires.private: icu-i18n
----------
Depends field generated for libical-dev
Depends: glib-2.0-dev, libical (= 3.0.7-r0)
------------

When trying to resolve the build time dependency with libical package using “-dev” ipk generated, it will throw the below error.
-----------
Package icu-i18n was not found in the pkg-config search path. Perhaps you should add the directory containing `icu-i18n.pc' to the PKG_CONFIG_PATH environment variable
Package 'icu-i18n', required by 'libical', not found
-----------

This patch will fix the broken dependency list.

-------
libical-dev depends field generated with this patch
Depends: glib-2.0-dev, icu-dev, libical (= 3.0.7-r0)
-------

Other examples of packages generated with broken dev dependency.

libflac-dev : https://packages.debian.org/sid/libflac-dev
Without patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++ with patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++, libogg-dev

libglib2.0-dev : https://packages.debian.org/buster/libglib2.0-dev
without patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev with patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev,
util-linux-dev, zlib-dev

---
 meta/classes/package.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/package.bbclass +0 -0
index 67351b2510..084fe428e5 100644

meta/classes/package.bbclass python package_do_pkgconfig () { · line 2185

Quoted 5 lines
meta/classes/package.bbclass +1 -1
@@ -2182,7 +2182,7 @@ python package_do_pkgconfig () {
                         if m:
                             hdr = m.group(1)
                             exp = pd.expand(m.group(2))
-                            if hdr == 'Requires':
+                            if hdr == 'Requires' or hdr ==

'Requires.private':

meta/classes/package.bbclass python package_do_pkgconfig () { · line 2186

Quoted 1 line
meta/classes/package.bbclass +0 -0
                                 pkgconfig_needed[pkg] +=

exp.replace(',', ' ').split()

meta/classes/package.bbclass python package_do_pkgconfig () { · line 2188

Quoted 3 lines
meta/classes/package.bbclass +0 -0
                                 continue
                         m = var_re.match(l)

As I understand it, Requires.private are only needed for static linking so shouldn't this dependency just be added to the -staticdev package? The -dev package wouldn't contain a static library anyway. Did you have static libraries enabled?

Cheers,

Richard

#3 lore raw
Quoted 8 lines · Sreejith Ravi

No, static libraries were not enabled. I am using only the -dev IPK, which has only the shared libraries. With this change, it is successfully building. Also, if it links to the static library, it will fail as I am not installing the static IPK.

In the latest pkgconf commit, it looks like Requires.private is needed for header inclusion also:
https://github.com/pkgconf/pkgconf/commit/2d26db3a984e7a69cedc6274c22119de4bcf1b40

We standardised on and use pkgconfig which does say Requires.private is for static linking.

If pkg-conf wants to change the "standard" I really wish they'd use a different file extension so we didn't have two incompatible implementations :(

I'm reluctant to try and mix both tools since they behave differently and one form will end up being broken.

We should mention to them this change of behaviour makes the compatibility situation worse.

Cheers,

Richard

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 19 lines · Richard Purdie via lists.openembedded.org
Quoted 9 lines · Sreejith Ravi

No, static libraries were not enabled. I am using only the -dev IPK,
which has only the shared libraries. With this change, it is successfully building. Also, if it links to the static library, it will fail as I am not installing the static IPK.

In the latest pkgconf commit, it looks like Requires.private is needed for header inclusion also:
https://github.com/pkgconf/pkgconf/commit/2d26db3a984e7a69cedc6274c22119de4bcf1b40

We standardised on and use pkgconfig which does say Requires.private is
for static linking.

If pkg-conf wants to change the "standard" I really wish they'd use a different file extension so we didn't have two incompatible implementations :(

Quoted 5 lines

I'm reluctant to try and mix both tools since they behave differently and one form will end up being broken.

We should mention to them this change of behaviour makes the compatibility situation worse.

I did more investigation on this one including looking at the pkg- config guide from freedesktop:

https://people.freedesktop.org/~dbn/pkg-config-guide.html

I suspect you're probably right that this is needed for headers usage. It is worth noting that change is just fixing documentation so this could well have been the case for a long time. It all is a bit unclear but we should probably take the patch assuming it passes testing.

Cheers,

Richard

#6 lore raw
In reply to Sreejith Ravi
Quoted 71 lines · Sreejith Ravi via lists.openembedded.org

Currently, the package_do_pkgconfig() only handles the "Requires" key field from the .pc file and ignores the "Requires.private" field while
generating the dev dependency chain. This results in a broken dependency
list and requires the installation of recommended packages to resolve the build dependencies when using the dev IPKs. This increases the hard disk space usage and download time and installs many unnecessary packages as part of the recommendations.

This patch ensures that the "Requires.private" field is also considered
when creating the dependency list for the dev IPKs. With this, the dev
IPK will have the proper dependencies listed, eliminating the need to install recommended packages to resolve the build time dependencies.

Example: usr/lib/pkgconfig/libical.pc
----------
Libs: -L${libdir} -lical -licalss -licalvcal
Libs.private: -lpthread
Requires.private: icu-i18n
----------
Depends field generated for libical-dev
Depends: glib-2.0-dev, libical (= 3.0.7-r0)
------------

When trying to resolve the build time dependency with libical package using “-dev” ipk generated, it will throw the below error.
-----------
Package icu-i18n was not found in the pkg-config search path. Perhaps you should add the directory containing `icu-i18n.pc' to the PKG_CONFIG_PATH environment variable
Package 'icu-i18n', required by 'libical', not found
-----------

This patch will fix the broken dependency list.

-------
libical-dev depends field generated with this patch
Depends: glib-2.0-dev, icu-dev, libical (= 3.0.7-r0)
-------

Other examples of packages generated with broken dev dependency.

libflac-dev : https://packages.debian.org/sid/libflac-dev
Without patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++ with patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++, libogg-dev

libglib2.0-dev : https://packages.debian.org/buster/libglib2.0-dev
without patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev with patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev, util-linux-dev, zlib-dev

---
 meta/classes/package.bbclass | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/package.bbclass +0 -0
index 67351b2510..084fe428e5 100644
@@ -2182,7 +2182,7 @@ python package_do_pkgconfig () {

                         if m:
                             hdr = m.group(1)

Quoted 9 lines

                             exp = pd.expand(m.group(2)) -                            if hdr == 'Requires':
+                            if hdr == 'Requires' or hdr == 'Requires.private':
                                 pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
                                 continue
                         m = var_re.match(l)

Unfortunately this patch fails to apply. This is not a patch against master and obviously hasn't need tested there.

Cheers,

Richard

#7 lore raw

Patch is created from the Kirkstone branch.

Cheers
Sreejith

Quoted 91 lines · Richard Purdie
Quoted 75 lines · Sreejith Ravi via lists.openembedded.org

Currently, the package_do_pkgconfig() only handles the "Requires" key field from the .pc file and ignores the "Requires.private" field while
generating the dev dependency chain. This results in a broken dependency
list and requires the installation of recommended packages to resolve the build dependencies when using the dev IPKs. This increases the hard disk space usage and download time and installs many unnecessary packages as part of the recommendations.

This patch ensures that the "Requires.private" field is also considered
when creating the dependency list for the dev IPKs. With this, the dev
IPK will have the proper dependencies listed, eliminating the need to install recommended packages to resolve the build time dependencies.

Example: usr/lib/pkgconfig/libical.pc
----------
Libs: -L${libdir} -lical -licalss -licalvcal
Libs.private: -lpthread
Requires.private: icu-i18n
----------
Depends field generated for libical-dev
Depends: glib-2.0-dev, libical (= 3.0.7-r0)
------------

When trying to resolve the build time dependency with libical package using “-dev” ipk generated, it will throw the below error.
-----------
Package icu-i18n was not found in the pkg-config search path. Perhaps you should add the directory containing `icu-i18n.pc' to the PKG_CONFIG_PATH environment variable
Package 'icu-i18n', required by 'libical', not found
-----------

This patch will fix the broken dependency list.

-------
libical-dev depends field generated with this patch
Depends: glib-2.0-dev, icu-dev, libical (= 3.0.7-r0)
-------

Other examples of packages generated with broken dev dependency.

libflac-dev : https://packages.debian.org/sid/libflac-dev
Without patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++ with patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++, libogg-dev

libglib2.0-dev : https://packages.debian.org/buster/libglib2.0-dev
without patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev with patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev,
util-linux-dev, zlib-dev

---
 meta/classes/package.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/package.bbclass +1 -1
index 67351b2510..084fe428e5 100644
@@ -2182,7 +2182,7 @@ python package_do_pkgconfig () {
                         if m:
                             hdr = m.group(1)
                             exp = pd.expand(m.group(2))
-                            if hdr == 'Requires':
+                            if hdr == 'Requires' or hdr ==

'Requires.private':

Quoted 5 lines
                                 pkgconfig_needed[pkg] +=
exp.replace(',', ' ').split()
                                 continue
                         m = var_re.match(l)

Unfortunately this patch fails to apply. This is not a patch against master and obviously hasn't need tested there.

Cheers,

Richard

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

The reason for the failure in master is that the functionality has been moved from package.bbclass to package.py. I have created the patch for master and sent it for review.

Cheers
Sreejith

Quoted 109 lines · Sreejith Ravi via lists.openembedded.org

Patch is created from the Kirkstone branch.

Cheers
Sreejith

Quoted 86 lines · Richard Purdie
Quoted 75 lines · Sreejith Ravi via lists.openembedded.org

Currently, the package_do_pkgconfig() only handles the "Requires" key field from the .pc file and ignores the "Requires.private" field while
generating the dev dependency chain. This results in a broken dependency
list and requires the installation of recommended packages to resolve the build dependencies when using the dev IPKs. This increases the hard disk space usage and download time and installs many unnecessary packages as part of the recommendations.

This patch ensures that the "Requires.private" field is also considered
when creating the dependency list for the dev IPKs. With this, the dev
IPK will have the proper dependencies listed, eliminating the need to install recommended packages to resolve the build time dependencies.

Example: usr/lib/pkgconfig/libical.pc
----------
Libs: -L${libdir} -lical -licalss -licalvcal
Libs.private: -lpthread
Requires.private: icu-i18n
----------
Depends field generated for libical-dev
Depends: glib-2.0-dev, libical (= 3.0.7-r0)
------------

When trying to resolve the build time dependency with libical package using “-dev” ipk generated, it will throw the below error.
-----------
Package icu-i18n was not found in the pkg-config search path. Perhaps you should add the directory containing `icu-i18n.pc' to the PKG_CONFIG_PATH environment variable
Package 'icu-i18n', required by 'libical', not found
-----------

This patch will fix the broken dependency list.

-------
libical-dev depends field generated with this patch
Depends: glib-2.0-dev, icu-dev, libical (= 3.0.7-r0)
-------

Other examples of packages generated with broken dev dependency.

libflac-dev : https://packages.debian.org/sid/libflac-dev
Without patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++ with patch:
Depends: flac (= 1.3.3-r0), libflac, libflac++, libogg-dev

libglib2.0-dev : https://packages.debian.org/buster/libglib2.0-dev
without patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev with patch:
Depends: libffi-dev, libglib-2.0-0 (= 1:2.62.6-r0), libpcre-dev,
util-linux-dev, zlib-dev

---
 meta/classes/package.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/package.bbclass +1 -1
index 67351b2510..084fe428e5 100644
@@ -2182,7 +2182,7 @@ python package_do_pkgconfig () {
                         if m:
                             hdr = m.group(1)
                             exp = pd.expand(m.group(2))
-                            if hdr == 'Requires':
+                            if hdr == 'Requires' or hdr ==

'Requires.private':

Quoted 5 lines
                                 pkgconfig_needed[pkg] +=
exp.replace(',', ' ').split()
                                 continue
                         m = var_re.match(l)

Unfortunately this patch fails to apply. This is not a patch against master and obviously hasn't need tested there.

Quoted 5 lines

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#201165):
https://lists.openembedded.org/g/openembedded-core/message/201165
Mute This Topic: https://lists.openembedded.org/mt/106876780/8634312
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-