Gst-python build issue. GObject not found trying to import Gst from gi.repository

Finally succeeded in building gstreamer 1.26.6 on Windows 10, python 3.12 using meson. I needed to use options -Dintrospection=enabled -Dlibxml2:python=false. Otherwise, I’d get an error on building libxml2.

When I try to test with a simple import , I get an error.

Python 3.12.10 (tags/v3.12.10:0cc8128, Apr  8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> gi.version_info
(3, 50, 1)
>>> gi.require_version('Gst','1.0')
>>> from gi.repository import Gst
Traceback (most recent call last):
  File "D:\opt\gstreamer\lib\site-packages\gi\importer.py", line 139, in create_module
    introspection_module = get_introspection_module(namespace)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\opt\gstreamer\lib\site-packages\gi\module.py", line 267, in get_introspection_module
    module = IntrospectionModule(namespace, version)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\opt\gstreamer\lib\site-packages\gi\module.py", line 114, in __init__
    repository.require(namespace, version)
gi.RepositoryError: Typelib file for namespace 'GObject', version '2.0' not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\opt\gstreamer\lib\site-packages\gi\importer.py", line 141, in create_module
    raise ImportError(e)
ImportError: Typelib file for namespace 'GObject', version '2.0' not found
>>> 

It looks to be related to this issue.

I tried to downgrade gobject-introspection but was unsuccessful. In order to get back to this point, I needed to re-clone my gstreamer and start over.

Tried to checkout tag 1.26.5, and meson subprojects update.

glib| Dependency zlib from subproject subprojects/zlib-1.3.1 found: YES 1.3.1
glib| Checking if "check for -latomic" links: NO (cached)
glib| Run-time dependency intl found: NO (tried builtin and system)
glib| Run-time dependency intl found: NO (tried builtin and system)

..\subprojects\glib-2.82.4\meson.build:2299:12: ERROR: Dependency "intl" not found, tried builtin and system

A full log can be found at D:\GitClones\gstreamer\build\meson-logs\meson-log.txt
ninja: error: rebuilding 'build.ninja': subcommand failed

FAILED: build.ninja

Tried to go back by checking out tag 1.26.6 again and doing meson subprojects update.

Now meson compile -C build gives:

[30/605] Generating subprojects/gstreamer/gst/Gst-1.0.gir with a custom command (wrapped by meson to set PATH, to set env)
FAILED: subprojects/gstreamer/gst/Gst-1.0.gir
"C:\Users\Tim\.virtualenvs\build_gst_py312\Scripts\meson" "--internal" "exe" "--unpickle" "D:\GitClones\gstreamer\build\meson-private\meson_exe_g-ir-scanner_231f0e2bf68e7134a4cbea36bb04451f3f46ab89.dat"
while executing ['C:\\Users\\Tim\\.virtualenvs\\build_gst_py312\\Scripts\\python.EXE', 'D:\\GitClones\\gstreamer\\build\\subprojects\\gobject-introspection-1.84.0\\tools\\g-ir-scanner', '--quiet', '--no-libtool', '--namespace=Gst', '--nsversion=1.0', '--warn-all', '--output', 'subprojects/gstreamer/gst/Gst-1.0.gir', '--add-init-section=extern void gst_init(gint*,gchar**);g_setenv("GST_REGISTRY_DISABLE", "yes", TRUE);g_setenv("GST_REGISTRY_1.0", "/no/way/this/exists.reg", TRUE);g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);g_setenv("GST_TRACERS", "", TRUE);gst_init(NULL,NULL);', '--quiet', '--c-include=gst/gst.h', '--cflags-begin', '-DGST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS', '--cflags-end', '--cflags-begin', '-ID:/GitClones/gstreamer/subprojects/gstreamer/gst/..', '-ID:/GitClones/gstreamer/build/subprojects/gstreamer/gst/..', '--cflags-end', '-ID:/GitClones/gstreamer/subprojects/gstreamer/gst', '-ID:/GitClones/gstreamer/build/subprojects/gstreamer/gst', '-ID:/GitClones/gstreamer/subprojects/gstreamer/.', '-ID:/GitClones/gstreamer/build/subprojects/gstreamer/.', '-ID:/GitClones/gstreamer/subprojects/gstreamer/gst/parse', '-ID:/GitClones/gstreamer/build/subprojects/gstreamer/gst/parse', '-ID:/GitClones/gstreamer/subprojects/glib-2.82.5/gobject', '-ID:/GitClones/gstreamer/build/subprojects/glib-2.82.5/gobject', '-ID:/GitClones/gstreamer/subprojects/glib-2.82.5/.', '-ID:/GitClones/gstreamer/build/subprojects/glib-2.82.5/.', '-ID:/GitClones/gstreamer/subprojects/glib-2.82.5/glib', '-ID:/GitClones/gstreamer/build/subprojects/glib-2.82.5/glib', '-ID:/GitClones/gstreamer/subprojects/proxy-libintl/.', '-ID:/GitClones/gstreamer/build/subprojects/proxy-libintl/.', '-ID:/GitClones/gstreamer/subprojects/glib-2.82.5/gmodule', '-ID:/GitClones/gstreamer/build/subprojects/glib-2.82.5/gmodule', '--filelist=D:/GitClones/gstreamer/build/subprojects/gstreamer/gst/gstreamer-1.0-0.dll.p/Gst_1.0_gir_filelist', '--include=GLib-2.0', '--include=GObject-2.0', '--include=GModule-2.0', '--symbol-prefix=gst', '--identifier-prefix=Gst', '--pkg-export=gstreamer-1.0', '--cflags-begin', '-DG_DISABLE_CAST_CHECKS', '-ID:/GitClones/gstreamer/subprojects/gstreamer/.', '-ID:/GitClones/gstreamer/build/subprojects/gstreamer/.', '-ID:/GitClones/gstreamer/subprojects/gstreamer/gst/parse', '-ID:/GitClones/gstreamer/build/subprojects/gstreamer/gst/parse', '-ID:/GitClones/gstreamer/subprojects/glib-2.82.5/gobject', '-ID:/GitClones/gstreamer/build/subprojects/glib-2.82.5/gobject', '-ID:/GitClones/gstreamer/subprojects/glib-2.82.5/.', '-ID:/GitClones/gstreamer/build/subprojects/glib-2.82.5/.', '-ID:/GitClones/gstreamer/subprojects/glib-2.82.5/glib', '-ID:/GitClones/gstreamer/build/subprojects/glib-2.82.5/glib', '-ID:/GitClones/gstreamer/subprojects/proxy-libintl/.', '-ID:/GitClones/gstreamer/build/subprojects/proxy-libintl/.', '-ID:/GitClones/gstreamer/subprojects/glib-2.82.5/gmodule', '-ID:/GitClones/gstreamer/build/subprojects/glib-2.82.5/gmodule', '-ID:/GitClones/gstreamer/subprojects/libffi/.', '-ID:/GitClones/gstreamer/build/subprojects/libffi/.', '-ID:/GitClones/gstreamer/subprojects/libffi/include', '-ID:/GitClones/gstreamer/build/subprojects/libffi/include', '-ID:/GitClones/gstreamer/subprojects/pcre2-10.44/.', '-ID:/GitClones/gstreamer/build/subprojects/pcre2-10.44/.', '-ID:/GitClones/gstreamer/subprojects/pcre2-10.44/src', '-ID:/GitClones/gstreamer/build/subprojects/pcre2-10.44/src', '-ID:/GitClones/gstreamer/subprojects/gobject-introspection-1.84.0/girepository/.', '-ID:/GitClones/gstreamer/build/subprojects/gobject-introspection-1.84.0/girepository/.', '-DPCRE2_STATIC', '--cflags-end', '--add-include-path=D:/GitClones/gstreamer/build/subprojects/gobject-introspection-1.84.0/gir', '-LD:/GitClones/gstreamer/build/subprojects/gobject-introspection-1.84.0/girepository', '-LD:/GitClones/gstreamer/build/subprojects/glib-2.82.5/glib', '-LD:/GitClones/gstreamer/build/subprojects/proxy-libintl', '-LD:/GitClones/gstreamer/build/subprojects/glib-2.82.5/gobject', '-LD:/GitClones/gstreamer/build/subprojects/libffi/src', '-LD:/GitClones/gstreamer/build/subprojects/glib-2.82.5/gmodule', '--extra-library=girepository-1.0', '--extra-library=glib-2.0', '--extra-library=intl', '--extra-library=gobject-2.0', '--extra-library=gmodule-2.0', '-LD:/GitClones/gstreamer/build/subprojects/gstreamer/gst', '--library', 'gstreamer-1.0', '-LD:/GitClones/gstreamer/build/subprojects/glib-2.82.5/glib', '-LD:/GitClones/gstreamer/build/subprojects/proxy-libintl', '-LD:/GitClones/gstreamer/build/subprojects/glib-2.82.5/gobject', '-LD:/GitClones/gstreamer/build/subprojects/libffi/src', '-LD:/GitClones/gstreamer/build/subprojects/glib-2.82.5/gmodule', '--extra-library=ws2_32', '--extra-library=winmm', '--sources-top-dirs', 'D:/GitClones/gstreamer/subprojects/gstreamer', '--sources-top-dirs', 'D:/GitClones/gstreamer/build/subprojects/gstreamer']
--- stdout ---
Gst-1.0.c
Microsoft (R) Incremental Linker Version 14.44.35217.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Gst-1.0.obj : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
Microsoft (R) Incremental Linker Version 14.44.35217.0
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1181: cannot open input file 'gio-2.0.lib'

--- stderr ---
Microsoft (R) C/C++ Optimizing Compiler Version 19.44.35217 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

g-ir-cpp-sig1xbtn.c
linking of temporary binary failed: Command '['C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX64\\x64\\link.exe', '-out:D:\\GitClones\\gstreamer\\build\\tmp-introspect2lkpsovw\\Gst-1.0.exe', 'D:\\GitClones\\gstreamer\\build\\tmp-introspect2lkpsovw\\Gst-1.0.obj', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\gobject-introspection-1.84.0\\girepository', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\glib-2.82.5\\glib', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\proxy-libintl', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\glib-2.82.5\\gobject', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\libffi\\src', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\glib-2.82.5\\gmodule', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\gstreamer\\gst', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\glib-2.82.5\\glib', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\proxy-libintl', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\glib-2.82.5\\gobject', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\libffi\\src', '-libpath:D:\\GitClones\\gstreamer\\build\\subprojects\\glib-2.82.5\\gmodule', 'gstreamer-1.0.lib', 'girepository-1.0.lib', 'glib-2.0.lib', 'intl.lib', 'gobject-2.0.lib', 'gmodule-2.0.lib', 'ws2_32.lib', 'winmm.lib', '/libpath:D:/GitClones/gstreamer/build/subprojects/glib-2.82.5/gio.lib', '/libpath:D:/GitClones/gstreamer/build/subprojects/glib-2.82.5/gobject.lib', '/libpath:D:/GitClones/gstreamer/build/subprojects/glib-2.82.5/gmodule.lib', '/libpath:D:/GitClones/gstreamer/build/subprojects/glib-2.82.5/glib.lib', '/libpath:D:/GitClones/gstreamer/build/subprojects/proxy-libintl.lib', 'gio-2.0.lib', 'gobject-2.0.lib', 'gmodule-2.0.lib', 'glib-2.0.lib', 'intl.lib']' returned non-zero exit status 1181.

[31/605] Compiling C++ object subprojects/gst-plugins-bad/gst-libs/gst/d3d12/gstd3d12-1.0-0.dll.p/gstd3d12bufferpool.cpp.obj
ninja: build stopped: subcommand failed.
(build_gst_py312) PS D:\GitClones\gstreamer>

So I finally broke down and set up cerbero. I succeeded in building gst-python with that, but the process of setting that up broke my meson build. (That route didn’t work anyway, but still.) :grinning_face:

Rebooting seemed to help in my meson issue. Trying to build gstreamer with meson now…

Not sure what updating msys2 has to do with it, but after rebuilding, the GObject not found issue is now resolved.

Tested with PATH set to my cerberos build by mistake! Issue remains.