Skip to content

networkmanager: only enable the vala bindings if gobject introspection is enabled#954

Closed
afenkart wants to merge 2 commits into
openembedded:masterfrom
afenkart:networkmanager
Closed

networkmanager: only enable the vala bindings if gobject introspection is enabled#954
afenkart wants to merge 2 commits into
openembedded:masterfrom
afenkart:networkmanager

Conversation

@afenkart

@afenkart afenkart commented Apr 4, 2025

Copy link
Copy Markdown
Contributor

Tested in a minimal environment, see below

with one of the the following options, or with none enabled:

in local.conf:
GI_DATA_ENABLED = "False"
DISTRO_FEATURES:remove = " gobject-introspection-data"

networkmanager-%.bbappend
GI_DATA_ENABLED = "False"

Project: bitbake
Mount path: poky-master/sources/bitbake
Current revision: 696c2c1ef095f8b11c7d2eff36fae50f58c62e5e
Manifest revision: 2.8
Local Branches: 0
----------------------------
Project: meta-openembedded
Mount path: poky-master/sources/meta-openembedded
Current revision: 9e203efd094c0474f8fe89eb47b41ef49e3def31
Current branch: networkmanager
Manifest revision: networkmanager
Local Branches: 1 [networkmanager]
----------------------------
Project: openembedded-core
Mount path: poky-master/sources/openembedded-core
Current revision: dc2ef2cc1183a14cd3a05d388a1d0485a1bc8d20
Manifest revision: master
Local Branches: 0
----------------------------
Project: poky
Mount path: poky-master/sources/poky
Current revision: e894acce6ede8bedafc1859ea0345ee6d80e9c74
Manifest revision: master
Local Branches: 0

The workaround introduced in commit
63db9c0 is no longer needed.
Typelib
files are now correctly located solely within STAGING_LIBDIR_NATIVE,
aligning with the intended build configuration. Removing the
workaround
avoids the following error during build:

cp: cannot stat '.../GObject*typelib': No such file or directory

Signed-off: Andreas Fenkart <afenkart@gmail.com>
@kraj

kraj commented Apr 4, 2025

Copy link
Copy Markdown
Contributor

I get this error when building it with yoe distro

   | Compiler for language vala for the build machine not found.
   | Compiler for language vala for the host machine not found.
   |
   | ../NetworkManager-1.50.0/meson.build:854:4: ERROR: Assert failed: vala is required to build. Use -Dvapi=false to disable it
   |
   | A full log can be found at /home/kraj200/yoe/build/tmp/work/core2-64-yoe-linux/networkmanager/1.50.0/build/meson-logs/meson-log.txt
   | ERROR: meson failed
   | WARNING: /home/kraj200/yoe/build/tmp/work/core2-64-yoe-linux/networkmanager/1.50.0/temp/run.do_configure.821907:176 exit 1 from 'exit 1'
   | WARNING: Backtrace (BB generated script):
   |   #1: bbfatal_log, /home/kraj200/yoe/build/tmp/work/core2-64-yoe-linux/networkmanager/1.50.0/temp/run.do_configure.821907, line 176
   |   #2: meson_do_configure, /home/kraj200/yoe/build/tmp/work/core2-64-yoe-linux/networkmanager/1.50.0/temp/run.do_configure.821907, line 165
   |   #3: do_configure, /home/kraj200/yoe/build/tmp/work/core2-64-yoe-linux/networkmanager/1.50.0/temp/run.do_configure.821907, line 154
   |   #4: main, /home/kraj200/yoe/build/tmp/work/core2-64-yoe-linux/networkmanager/1.50.0/temp/run.do_configure.821907, line 189
   NOTE: recipe networkmanager-1.50.0-r0: task do_configure: Failed

@kraj

kraj commented Apr 5, 2025

Copy link
Copy Markdown
Contributor

@afenkart

afenkart commented Apr 14, 2025

Copy link
Copy Markdown
Contributor Author

My apologies, I had to make a full rebuild to see the error.

After testing, I've determined that GI_DATA_ENABLED is not set during the inheritance evaluation.

I also tried with inherit_defer

inherit_defer ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'vala', '', d)}

and added some debug output in bitbake:

--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -46,6 +46,7 @@ def inherit(files, fn, lineno, d, deferred=False):
     __inherit_cache = d.getVar('__inherit_cache', False) or []
     #if "${" in files and not deferred:
     #    bb.warn("%s:%s has non deferred conditional inherit" % (fn, lineno))
+    bb.warn("BBHandler:inherit %s:%s files:%s" % (fn,lineno,files))
     files = d.expand(files).split()
     for file in files:
         classtype = d.getVar("__bbclasstype", False)

Its output demonstrates that the variable has not yet been resolved.

WARNING: BBHandler:inherit ../poky-master/sources/meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.50.0.bb:92 files:${@bb.utils.contains
('GI_DATA_ENABLED', 'True', 'vala', '', d)}                                                                                                                                                                          

I would have to add a python __anonymous section to add it

python __anonymous() {
    vala_class_path = d.expand("${COREBASE}/meta/classes-recipe/vala.bbclass")
    packageconfig = d.getVar('PACKAGECONFIG')

    if 'vala' in packageconfig.split():
        bb.parse.handle(vala_class_path, d, True)
}

Which is more verbose and complex than necessary.

Within poky/meta/classes-recipe/gobject-introspection-data.bbclass, the default for GI_DATA_ENABLED is set

GI_DATA_ENABLED ?= "${@bb.utils.contains('DISTRO_FEATURES', 'gobject-introspection-data', \
                      bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d), 'False', d)}"

As DISTRO_FEATURES testing is already used for systemd, selinux, and other features. I've replaced the failing test with a DISTRO_FEATURES check against gobject-introspection-data. While this only partially covers GI_DATA_ENABLED and ignores overrides of that variable, it is closer to the current vala-always-enabled default behavior.

@afenkart

afenkart commented Apr 14, 2025

Copy link
Copy Markdown
Contributor Author

A copy-paste error required a second push. I've restarted my full build. No need to trigger any automated builds yet.

@kraj

kraj commented Apr 14, 2025

Copy link
Copy Markdown
Contributor

A copy-paste error required a second push. I've restarted my full build. No need to trigger any automated builds yet.

still fails to configure


../NetworkManager-1.50.0/meson.build:854:4: ERROR: Assert failed: vala is required to build. Use -Dvapi=false to disable it

full logs are below

https://0x0.st/8fjG.158391

when opting out from the DISTRO_FEATURE gobject-introspection-date, the
build fails with error:
../NetworkManager-1.50.0/meson.build:849:4: ERROR: Assert failed: vala api require GObject introspection. Use -Dvapi=false to disable it

The gobject-introspection-data feature, while ultimately added to
DISTRO_FEATURES via DISTRO_FEATURE_BACKFILL, isn't available during the
vala.bbclass inheritance check. This also excludes derived variables
e.g. GI_DATA_ENABLED.

To properly disable a DISTRO_FEATURE_BACKFILL feature, it must be
included in DISTRO_FEATURE_BACKFILL_CONSIDERED, a variable that is
available during the parsing phase.

Similar situations have been resolved in:

[openembedded-core:31daea70b18b2b2266bf94063b655aaf142a6166]
librsvg: Only enable the Vala bindings if GObject Introspection is enabled
 PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'vala', '', d)}"

  -- and --

[meta-openembedded:d89fc6ffbdf8f947643def51b804052bb5e7ac97
libpeas: add recipe for 2.0.5
 PACKAGECONFIG ?= "python3 gjs lua51 ${@bb.utils.contains('DISTRO_FEATURES', 'gobject-introspection', 'vala', '', d)}"

Signed-off: Andreas Fenkart <afenkart@gmail.com>
@afenkart

Copy link
Copy Markdown
Contributor Author

Would you mind triggering another build?

@kraj

kraj commented Apr 18, 2025

Copy link
Copy Markdown
Contributor

Would you mind triggering another build?

looks good in latest runs, its staged in master-next branch now.

@kraj

kraj commented Apr 21, 2025

Copy link
Copy Markdown
Contributor

applied to master at e81fefb

@kraj kraj closed this Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants