Skip to contentSkip to conversation

package.bbclass: Fix broken dev package dependency.

PATCH In review Sreejith Ravi 2 participants 11 messages Jun 24, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package.bbclass: Fix broken dev package dependency.

Currently, the process_pkgconfig() would process only the "Requires" key field and ignore "Requires.private" while generating the dev dependency chain.

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 add the packages listed in "Requires.private" to the dependency chain.

-------
Depends field generated with this change for libical-dev
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

From b559be82ffc16a012d40d5f15722ef0bb840ee9e Mon Sep 17 00:00:00 2001
From: Sreejith Ravi <[email protected]>
Date: Mon, 24 Jun 2024 10:18:10 +0100
Subject: [PATCH] package.bbclass: Fix broken dev package dependency.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently, the process_pkgconfig() would process only the "Requires" key field and ignore "Requires.private" while generating the dev dependency chain.

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 add the packages listed in "Requires.private" to the dependency chain.

-------
Depends field generated with this change for libical-dev
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 21 lines · Sreejith Ravi via lists.openembedded.org

Currently, the process_pkgconfig() would process only the "Requires" key field and ignore "Requires.private" while generating the dev dependency chain.

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
-----------

Quoted 6 lines

This patch will add the packages listed in "Requires.private" to the dependency chain.

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

The icu-dev package is already listed in the Recommends section that is formed from shared libraries libical uses, so you need to install the recommended packages:

%package -n libical-dev
Summary: iCal and scheduling (RFC 2445, 2446, 2447) library - Development files
License: LGPL-2.1-only | MPL-2.0
Group: devel
Requires: glib-2.0-dev
Requires: libical
Recommends: glib-2.0-dev
Recommends: glibc-dev
Recommends: gobject-introspection-dev
Recommends: icu-dev
Recommends: libgcc-dev
Recommends: libical = 3.0.18-r0
Recommends: libicui18n-dev
Recommends: libicuuc-dev
Recommends: libstdc++-dev
Recommends: libxml2-dev
Recommends: vala-dev

Seems like there's quite a bit more needed for a successful build than just icu-dev and glib-2.0-dev.

Alex

#2 lore raw

The icu package is necessary for the compilation of libical; otherwise, the build will fail. "Recommended" contains all the packages that are part of the dependent build. If we try to install the recommended packages, it will download and install many unnecessary packages, consuming hard disk space and increasing download time. Referring to the Debian packages, icu-dev is a dependent package, meaning it is required for the build. "Depends" is a must-have, and "Recommends" is optional. In this case, the ICU package is a must-have.

Sreejith

Quoted 62 lines · Alexander Kanavin
Quoted 2 lines · Sreejith Ravi via lists.openembedded.org

Currently, the process_pkgconfig() would process only the "Requires" key

field and ignore "Requires.private" while generating the dev dependency chain.

Quoted 11 lines

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)
------------

Quoted 1 line

When trying to resolve the build time dependency with libical package

using “-dev” ipk generated, it will throw the below error.

Quoted 8 lines

-----------
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 add the packages listed in "Requires.private" to the

dependency chain.

Quoted 5 lines

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

The icu-dev package is already listed in the Recommends section that is formed from shared libraries libical uses, so you need to install the recommended packages:

%package -n libical-dev
Summary: iCal and scheduling (RFC 2445, 2446, 2447) library - Development files
License: LGPL-2.1-only | MPL-2.0
Group: devel
Requires: glib-2.0-dev
Requires: libical
Recommends: glib-2.0-dev
Recommends: glibc-dev
Recommends: gobject-introspection-dev
Recommends: icu-dev
Recommends: libgcc-dev
Recommends: libical = 3.0.18-r0
Recommends: libicui18n-dev
Recommends: libicuuc-dev
Recommends: libstdc++-dev
Recommends: libxml2-dev
Recommends: vala-dev

Seems like there's quite a bit more needed for a successful build than just icu-dev and glib-2.0-dev.

Alex

#3 lore raw
Quoted 1 line · Sreejith Ravi

The icu package is necessary for the compilation of libical; otherwise, the build will fail. "Recommended" contains all the packages that are part of the dependent build. If we try to install the recommended packages, it will download and install many unnecessary packages, consuming hard disk space and increasing download time. Referring to the Debian packages, icu-dev is a dependent package, meaning it is required for the build. "Depends" is a must-have, and "Recommends" is optional. In this case, the ICU package is a must-have.

Wait a moment. What are you building and in which context? If you are building libical, then I don't understand why libical-dev (which is produced by building libical) needs to be fixed.

In other words, can you show steps to reproduce the problem?

Alex

#4 lore raw

We are building the components through Yocto and using dev IPKs for the dependent packages (generated from Yocto) to resolve the build dependencies.

Steps:
1) Generate the libical IPKs from Yocto.
2) Copy the IPKs to a folder and create the local opkg feed.
3) Remove libical from the BlueZ dependencies list.
4) Install the libical-dev IPK from the local feed to the BlueZ recipe sysroot.
4) Build the BlueZ package.

When we tried to build BlueZ from source, by using the libical dev IPK, we are getting the error. "
configure:14460: checking for libical
configure:14467: $PKG_CONFIG --exists --print-errors "libical"
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
configure:14470: $? = 1
configure:14484: $PKG_CONFIG --exists --print-errors "libical"
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
configure:14487: $? = 1
configure:14501: result: no
Package 'icu-i18n', required by 'libical', not found
configure:14517: error: libical is required
"

Similarly, when we are trying to build the 'gstreamer1.0_1.18' package, which has a dependency on 'glib2-0,' and using the glib2-0 dev IPK, it is failing with the error below due to the missing zlib dependency chain. "
pkg-config error with 'gio-2.0': Could not generate cargs for gio-2.0:
Package zlib was not found in the pkg-config search path.
Perhaps you should add the directory containing `zlib.pc'
to the PKG_CONFIG_PATH environment variable
Package 'zlib', required by 'gio-2.0', not found
"

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

We are building the components through Yocto and using dev IPKs for the dependent packages (generated from Yocto) to resolve the build dependencies.

Steps:
1) Generate the libical IPKs from Yocto.
2) Copy the IPKs to a folder and create the local opkg feed.
3) Remove libical from the BlueZ dependencies list.
4) Install the libical-dev IPK from the local feed to the BlueZ recipe sysroot.
4) Build the BlueZ package.

The supported way to do this is with 'devtool modify bluez'.

Another option is to use a Yocto SDK, if you only want to build binaries with a cross-toolchain and not run any of the recipe tasks.

Installing things into sysroots with anything else except bitbake isn't supported.

Alex

#6 lore raw

What is the purpose of the dev IPKs generated by Yocto? As I understand, we can use them to resolve build dependencies.

#7 lore raw
Quoted 2 lines · Sreejith Ravi via lists.openembedded.org

What is the purpose of the dev IPKs generated by Yocto? As I understand, we can use them to resolve build dependencies.

The purpose is to generate a SDK for cross-builds with a toolchain, or a target image for native development on the target, but in both cases recommended packages are enabled and installed.

Resolving build dependencies in a yocto build is done with DEPENDS lists specified in recipes, which bitbake will handle in prepare_recipe_sysroot.

Alex

#8 lore raw

We should be able to install the dev IPK and resolve its corresponding dependency chain. As I mentioned earlier, enabling recommended packages and installing them increases hard disk usage and installation time when installing a lot of unnecessary recommended packages.

Yocto handles the dev dependency chain by parsing the 'Requires' field from the .pc file in the package_do_pkgconfig function. However, there is one more field, 'Requires.private', which also needs to be considered when creating the dependency chain for the dev IPKs. With this, the dev IPK has the proper dependencies listed and there is no need to install the recommended packages.

#9 lore raw
Quoted 4 lines · Sreejith Ravi via lists.openembedded.org

We should be able to install the dev IPK and resolve its corresponding dependency chain. As I mentioned earlier, enabling recommended packages and installing them increases hard disk usage and installation time when installing a lot of unnecessary recommended packages.

Yocto handles the dev dependency chain by parsing the 'Requires' field from the .pc file in the package_do_pkgconfig function. However, there is one more field, 'Requires.private', which also needs to be considered when creating the dependency chain for the dev IPKs. With this, the dev IPK has the proper dependencies listed and there is no need to install the recommended packages.

Very well. But you need to resend the patch as an email with 'git send-email', not as an attachment. Also, make a better commit header:

package.bbclass: consider Requires.private in package_do_pkgconfig()

Alex