Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux glib needs pkg-config and pkg-config needs glib?

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?

like image 329
Peter Avatar asked Sep 04 '12 11:09

Peter


People also ask

What is pkg-config used for?

pkg-config is a computer program that defines and supports a unified interface for querying installed libraries for the purpose of compiling software that depends on them. It allows programmers and installation scripts to work without explicit knowledge of detailed library path information.

What is pkgconfig file?

The primary use of pkg-config is to provide the necessary details for compiling and linking a program to a library. This metadata is stored in pkg-config files. These files have the suffix . pc and reside in specific locations known to the pkg-config tool.

What is pkg-config -- cflags?

pkg-config uses configuration files (defined by the libraries) to generate the above information for compilers, and allows us to not worry about what operating system or distribution the compilation takes place on. --cflags means the pkg-config should give the compilation flags for the listed packages.

What is Pkgconfig in Linux?

pkg-config is a helper tool used when compiling applications and libraries. It helps you insert the correct compiler options on the command line so an application can use gcc -o test test. c `pkg-config --libs --cflags glib-2.0` for instance, rather than hard-coding values on where to find glib (or other libraries).


1 Answers

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.

like image 171
user1202136 Avatar answered Sep 19 '22 14:09

user1202136