Question

I try to install udev. And udev gives me an error during the ./configure

--exists: command not found configure: error:
pkg-config and "glib-2.0 >= 2.16" not found, please set GLIB_CFLAGS and GLIB_LIBS
to the correct values or pass --with-internal-glib to configure 

Ok, pkg-config and glib-2.0 is missing.

At first I tried to install pkg-config. I got this message:

checking whether to list both direct and indirect dependencies... no
checking for Win32... no
checking if internal glib should be used... no
checking for pkg-config... no
./configure: line 13557: --exists: command not found
configure: error: pkg-config and "glib-2.0 >= 2.16" not found,
please set GLIB_CFLAGS and GLIB_LIBS to the correct values or 
pass --with-internal-glib to configure

Ok I interpret, that glib is missing.

Next step installing Glib.

And I got this message:

configure: error: in `/root/glib-2.33.3':
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables LIBFFI_CFLAGS
and LIBFFI_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

But I'm puzzled now. Do they need each other? What is my mistake?

Était-ce utile?

La solution

As you have already observed, there is indeed a circular dependency between pkg-config and glib. To break it, pkg-config's source code includes a version of glib, which is enough to compile it. This should break the dependency cycle.

Try configuring pkg-config with --with-internal-glib.

Autres conseils

It is already contained on the glib error message:

Alternatively, you may set the environment variables LIBFFI_CFLAGS and LIBFFI_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.

The Glib build script uses pkg-config to find libffi. But you can provide the information also manually, by setting environment variables. Then the call to pkg-config is not necessary. Glib itself does not need pkg-config at all.

Another solution to the problem is provided by the pkg-config people. Again, at the end of the error message:

please set GLIB_CFLAGS and GLIB_LIBS to the correct values or pass --with-internal-glib to configure

In this scenario, pkg-config itself is packaged with everything necessary to build without having Glib on your system already.

export GLIB_CFLAGS="$(pkg-config --cflags glib-2.0)" 
export GLIB_LIBS="$(pkg-config --libs glib-2.0)"
printf '# In the case of a RHEL6.5\n\tGLIB_CFLAGS=%s\n\tGLIB_LIBS=%s\n' "$GLIB_CFLAGS" "$GLIB_LIBS"
# In the case of a RHEL6.5
        GLIB_CFLAGS=-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
        GLIB_LIBS=-lglib-2.0

# _now_ it is a no-brainer.

libudev is now part of systemd and it doesn't depend on glib.

Most Linux distributions provide binaries for pkg-config, libudev, and glib. They are probably installed already, but if not, you can use the package manager to get them.

If you do need to compile this stuff yourself, consider using pkgconf, a light-weight implementation of the pkg-config that does not use glib.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top