Linux glib necesita pkg-config y pkg-config necesita glib?


Intento instalar udev. Y udev me da un error durante el ./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 

Bien, faltan pkg-config y glib-2.0.

Al principio intenté instalar pkg-config. Recibí este mensaje:

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

Bien, interpreto que falta ese lenguaje.

Siguiente paso instalando Glib.

Y recibí este mensaje:

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.

Pero ahora estoy desconcertado. ¿Se necesitan el uno al otro? ¿Cuál es mi error?

Author: Dan Aloni, 2012-09-04

4 answers

Como ya has observado, existe una dependencia circular entre pkg-config y glib. Para romperlo, el código fuente de pkg-config incluye una versión de glib, que es suficiente para compilarlo. Esto debería romper el ciclo de dependencia.

Intente configurar pkg-config con --with-internal-glib.

 25
Author: user1202136,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-09-04 12:29:07

Ya está contenido en el mensaje de error glib:

Alternativamente, puede establecer las variables de entorno LIBFFI_CFLAGS y LIBFFI_LIBS para evitar la necesidad de llamar a pkg-config. Vea la página man de pkg-config para más detalles.

El script de construcción Glib usa pkg-config para encontrar libffi. Pero también puede proporcionar la información manualmente, estableciendo variables de entorno. Entonces la llamada a pkg-config no es necesaria. Glib en sí no necesita pkg-config en todo.

Otra solución al problema es proporcionada por la gente de pkg-config. De nuevo, al final del mensaje de error:

Por favor establezca GLIB_CFLAGS y GLIB_LIBS en los valores correctos o pase --with-internal-glib para configurar

En este escenario, pkg-config en sí está empaquetado con todo lo necesario para construir sin tener Glib en su sistema ya.

 8
Author: ypnos,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-09-04 12:27:18
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.
 1
Author: fned,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-05-06 09:38:14

Libudev ahora es parte de systemd y no depende de glib.

La mayoría de las distribuciones de Linux proporcionan binarios para pkg-config, libudev y glib. Probablemente ya estén instalados, pero si no, puede usar el administrador de paquetes para obtenerlos.

Si necesita compilar este material usted mismo, considere usar pkgconf, una implementación ligera del pkg-config que no usa glib.

 0
Author: David Grayson,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-02 16:20:57