libpeas-1.0 未被 meson-dependency 找到,但被 pkg-config 找到

libpeas-1.0 not found by meson-dependency but by pkg-config

我正在使用 GNOME builder 创建一个 vala 项目,并尝试通过以下方式将 libpeas-1.0 添加为介子的依赖项:

dependency('libpeas-1.0', version: '>= 1.22')

失败:

src/meson.build:10:0: ERROR:  Native dependency 'libpeas-1.0' not found

如果我执行:

pkg-config --print-provides libpeas-1.0

在 bash 中,我得到:

libpeas-1.0 = 1.22.0

同样有效的是:

meson.get_compiler('vala').find_library('libpeas-1.0')

知道这里哪里出了问题吗?

GNOME Builder 面向 FlatPak, which is a containerization technology and infrastructure。问题可能是 GNOME Builder 使用的默认 Flatpak 运行时不包含 libpeas。

很明显,您的主机系统上安装了 libpeas-1.0。因此,一种选择是让 GNOME Builder 使用主机操作系统。有一个选项可以选择 Flatpak 运行时。选择Host Operating Sytem.

或者,您可以将 libpeas-1.0 依赖项作为模块添加到您的 Flatpak 清单中。清单采用 JSON 格式,因此它意味着添加类似以下示例的内容,添加 gee-0.8:

  "modules": [
    {
      "name": "libgee",
      "buildsystem": "meson",
      "config-opts": [
        "--libdir=lib"
      ],
      "builddir": true,
      "sources": [
        {
          "type": "git",
          "tag": "meson",
          "url": "https://github.com/GNOME/libgee.git"
        }
      ]
    }
  ]

在这个 Whosebug 问题中有一个冗长而详细的讨论:. Hopefully that will give you enough information to get things working. It would be nice to simplify the instructions from that Whosebug question so some documentation can be added to the Vala wiki's GNOME Builder page