You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下用gst-build编译GStreamer无法导入_giscanner如何解决?

Windows gst-build编译GStreamer _giscanner DLL加载失败解决方案

1. 修复_giscanner模块DLL加载错误

_giscanner.pyd除了自身所在目录的依赖,还依赖本次构建生成的glib、gobject、gio等库的DLL,你之前添加的路径缺少GLib相关依赖的DLL输出目录,按以下步骤操作:

  • 确认所有构建生成的DLL所在路径,通常包括:
    • build/subprojects/glib/meson-out
    • build/subprojects/gobject-introspection
    • build/subprojects/gobject-introspection/giscanner
  • 构建前先完成如下配置:
    1. 所有操作必须在x64 Native Tools Command Prompt for VS 2019终端下执行,避免VC运行时依赖找不到
    2. 给g-ir-scanner脚本添加DLL路径加载逻辑:打开subprojects/gobject-introspection/tools/g-ir-scanner文件,在导入giscanner模块的代码前添加如下内容:
import os
extra_dll_dirs = [
    os.path.join(os.path.dirname(__file__), '..', '..', '..', 'glib', 'meson-out'),
    os.path.join(os.path.dirname(__file__), '..'),
    os.path.join(os.path.dirname(__file__), '..', 'giscanner'),
]
for d in extra_dll_dirs:
    if os.path.isdir(d):
        os.add_dll_directory(os.path.abspath(d))

2. 修复pkg-config找不到gio的问题

本次构建生成的gio未安装到系统路径,pkg-config默认无法扫描到子项目的构建输出,需要设置PKG_CONFIG_PATH环境变量:

  • cmd终端执行如下命令(路径根据你的实际构建目录调整):
set PKG_CONFIG_PATH=C:\Work\GStreamer-build\source\gst-build\build\subprojects\glib\meson-out\pkgconfig;%PKG_CONFIG_PATH%
  • powershell终端执行如下命令:
$env:PKG_CONFIG_PATH = "C:\Work\GStreamer-build\source\gst-build\build\subprojects\glib\meson-out\pkgconfig;$env:PKG_CONFIG_PATH"

配置完成后重新执行ninja构建命令即可。

可选替代方案

如果你不需要GObject Introspection相关功能,可以在meson配置阶段直接禁用自检,跳过该问题:

meson setup build -Dintrospection=disabled

内容的提问来源于stack exchange,提问作者James Kent

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.15 04:27:02