Meson: In dependencies requires gobject-introspection but meson dont can find it

Created on 2 Sep 2017  路  23Comments  路  Source: mesonbuild/meson

Im getting this error line:
_gobject-introspection dependency was not found, gir cannot be generated._
But i have gobject-introspection in my pkg-config list.

pkg-config --libs gobject-introspection-1.0
-L/usr/local/Cellar/gobject-introspection/1.52.1_1/lib -L/usr/local/Cellar/glib/2.52.3/lib -L/usr/local/opt/gettext/lib -lgirepository-1.0 -lgobject-2.0 -lglib-2.0 -lintl -Wl,-framework -Wl,CoreFoundation

Target OS build - Mac OS Sierra

macos bug dependencies gnome

Most helpful comment

@ljmf00
I have tried to run the same command it complains about (see the exit code -> 1)

dade@choo:~$ pkg-config --cflags gobject-introspection-1.0
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libffi', required by 'gobject-introspection-1.0', not found
dade@choo:~$ brew search libffi

So i tried

brew reinstall libffi

which reminded me of

libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.

For compilers to find libffi you may need to set:
  export LDFLAGS="-L/usr/local/opt/libffi/lib"

For pkg-config to find libffi you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

so then i tried to export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

This fixed the issue, at least on my mac

All 23 comments

It needs the g-i tools not the library, and i imagine the tools are not in PATH.

The error message should be fixed to specifically say which tool is missing.

We might even be able to do better in this case. The gobject-introspection-1.0 pkg-config file contains absolute paths to its tools.

Ok so I was wrong about this error being because of missing tools and it is indeed failing to look up the 'gobject-introspection-1.0' pkgconfig.

@TingPing this bug reproduce only on Mac OS? How i can fix this problem? Or this bug into meson?

Meson just calls pkg-config directly so for some reason it is failing to find it and I would say that is unique to your environment.

@TingPing but if PkgConfig just call from my env - why meson dont find gobject? Mac it is like Linux... but Mac

This issue does not appeared to be limited to macOS. I'm seeing it on Ubuntu v17.10 with Meson v0.42.1 and v0.44.0:

$ dpkg -l gobject-introspection
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                  Version      Architecture Description
+++-=====================-============-============-===========================================================
ii  gobject-introspection 1.54.1-1     amd64        Generate interface introspection data for GObject libraries

$ which g-ir-compiler g-ir-scanner
/usr/bin/g-ir-compiler
/usr/bin/g-ir-scanner

$ dpkg -s gobject-introspection
Package: gobject-introspection
Status: install ok installed
Priority: optional
Section: devel
Installed-Size: 1430
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Version: 1.54.1-1
Depends: libc6 (>= 2.14), libffi6 (>= 3.0.4), libgirepository-1.0-1 (= 1.54.1-1), libglib2.0-0 (>= 2.54.0), python3:any, build-essential, python3-mako
...

@niedzielski Debian Sid needed libgirepository1.0-dev.

@tcitworld thanks, that fixes the build on Ubuntu 17.10 too.

sudo dnf install gobject-introspection-devel on Fedora 27

Same issue on macOS Mojave 10.14 Beta:

Dependency gobject-2.0 found: YES 2.54.2
Configuring meson-sample.h using configuration
Determining dependency 'gobject-introspection-1.0' with pkg-config executable '/usr/local/bin/pkg-config'
Called `/usr/local/bin/pkg-config --modversion gobject-introspection-1.0` -> 0
1.54.1
Called `/usr/local/bin/pkg-config --cflags gobject-introspection-1.0` -> 1


mesongir/meson.build:18:0: ERROR:  gobject-introspection dependency was not found, gir cannot be generated.

image

same here, is there a osx workaround

@ljmf00
I have tried to run the same command it complains about (see the exit code -> 1)

dade@choo:~$ pkg-config --cflags gobject-introspection-1.0
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libffi', required by 'gobject-introspection-1.0', not found
dade@choo:~$ brew search libffi

So i tried

brew reinstall libffi

which reminded me of

libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.

For compilers to find libffi you may need to set:
  export LDFLAGS="-L/usr/local/opt/libffi/lib"

For pkg-config to find libffi you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

so then i tried to export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

This fixed the issue, at least on my mac

@davibe macOS is not my main operation system, I just use it to test releases and code to work on cross platform, so I just figured it out because of #4132 . I can test it on High Sierra too, but whats your macOS version? Because your problem was not that, at all. The thing is pkg-config can find it but meson don't.

@ljmf00 in my case pkg-config --libs was able to find gobject-introspection-1.0 just fine but --cflags failed with that error, which is the same as not finding it
Infact i got the very same error you have with meson. It could be a different case but i think its worth doublechecking

I am using high sierra 10.13.6

@davibe 's suggestion worked for me. Thank you.

This might help here:

In my case I did the export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" as well; but I noticed that it was not finding it when using as a dependency of glib. When I switched the current version of glib (2.60) to an older one (2.56), everything worked correctly in my project (OTRv4 in pidgin).

this is the same error with my situation in os: ubuntu 16.04.5
gobject-introspection dependency was not found, gir cannot be generated.

and when i check meson-logs/meson-log.txt. it shows:
Determining dependency 'gobject-introspection-1.0' with pkg-config executable '/usr/bin/pkg-config' Meson encountered an error in file atk/meson.build, line 143, column 8: gobject-introspection dependency was not found, gir cannot be generated

i try to install libgirepository1.0-dev:
sudo apt-get install libgirepository1.0-dev

it works.

Program(s) ['g-ir-scanner'] not found in Ubuntu 18.04
i try to install libgirepository1.0-dev:
sudo apt-get install libgirepository1.0-dev

it works.

I tried @davibe's solution of putting libffi in the PKG_CONFIG_PATH on macOS, but it's still not working. It looks like #2400 might be why.

I tried @davibe's solution of putting libffi in the PKG_CONFIG_PATH on macOS, but it's still not working. It looks like #2400 might be why.

I've added some findings to #2400, I'm still looking for a solution, but I found why it's not working, I just don't understand why that value is missing.

Program(s) ['g-ir-scanner'] not found in Ubuntu 18.04
i try to install libgirepository1.0-dev:
sudo apt-get install libgirepository1.0-dev

it works.

Instead better
sudo apt-get install gobject-introspection

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amitdo picture amitdo  路  6Comments

ignatenkobrain picture ignatenkobrain  路  4Comments

jhasse picture jhasse  路  5Comments

z33ky picture z33ky  路  5Comments

robertsanseries picture robertsanseries  路  6Comments