meson.build – ERROR: Dependency “x11” not found, tried pkgconfig and cmake

Another day and another major update exposed an error of missing the “x11” library. Apparently, the pkg-config got corrupted for X11 library. Most of the time the error is self-explanatory, but sometimes it is too generic like:

Run-time dependency x11 found: NO (tried pkgconfig and cmake)

meson.build:412:2: ERROR: Dependency "x11" not found, tried pkgconfig and cmake

The name “x11” is a part of multiple libraries:

srv ~ # pkg-config --list-all |grep x11

gdkglext-1.0                               GdkGLExt - OpenGL Extension to GDK (x11 target)
gdk-2.0                                    GDK - GTK+ Drawing Kit (x11 target)
gtk+-2.0                                   GTK+ - GTK+ Graphical UI Library (x11 target)
gdkglext-x11-1.0                           GdkGLExt - OpenGL Extension to GDK (x11 target)
x11-xcb                                    X11 XCB - X Library XCB interface
gdk-x11-3.0                                GDK - GTK+ Drawing Kit
gdk-x11-2.0                                GDK - GTK+ Drawing Kit (x11 target)
gtkglext-1.0                               GtkGLExt - OpenGL Extension to GTK+ (x11 target)
x11                                        X11 - X Library
xkbcommon-x11                              xkbcommon-x11 - XKB API common to servers and clients - X11 support
scim-x11utils                              scim-x11utils - X11 Utilities for Smart Common Input Method platform
clutter-x11-1.0                            Clutter - Clutter Core Library
gtk+-x11-3.0                               GTK+ - GTK+ Graphical UI Library
libva-x11                                  libva-x11 - Userspace Video Acceleration (VA) x11 interface
gtkglext-x11-1.0                           GtkGLExt - OpenGL Extension to GTK+ (x11 target)
gtk+-x11-2.0                               GTK+ - GTK+ Graphical UI Library (x11 target)

The above example is of working x11 library pkg-config. In our broken system the 10th line was missing.

To resolve the problem just emerge the “x11-libs/libX11” successfully and your pkg-config will be repaired.

If you happened to come here not using Gentoo but with the same problem, you just missed the X11 library – https://gitlab.freedesktop.org/xorg/lib/libx11.
Or you may check your pkg-config configuration file /usr/lib64/pkgconfig/x11.pc):

prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib64
includedir=${prefix}/include

xthreadlib=-lpthread

Name: X11
Description: X Library
Version: 1.6.9
Requires: xproto kbproto
Requires.private: xcb >= 1.11.1
Cflags: -I${includedir} 
Libs: -L${libdir} -lX11
Libs.private: -lpthread

This is currently our pkg-config file /usr/lib64/pkgconfig/x11.pc for version 1.6.9.

The real world error

Found pkg-config: /usr/bin/i686-pc-linux-gnu-pkg-config (0.29.2)
Run-time dependency x11 found: NO (tried pkgconfig and cmake)

meson.build:412:2: ERROR: Dependency "x11" not found, tried pkgconfig and cmake

A full log can be found at /var/tmp/portage/x11-libs/gdk-pixbuf-2.40.0/work/gdk-pixbuf-2.40.0-abi_x86_32.x86/meson-logs/meson-log.txt
 * ERROR: x11-libs/gdk-pixbuf-2.40.0::gentoo failed (configure phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line  125:  Called src_configure
 *   environment, line 4000:  Called multilib-minimal_src_configure
 *   environment, line 2539:  Called multilib_foreach_abi 'multilib-minimal_abi_src_configure'
 *   environment, line 2766:  Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_configure'
 *   environment, line 2469:  Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_configure'
 *   environment, line 2467:  Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_configure'
 *   environment, line  492:  Called multilib-minimal_abi_src_configure
 *   environment, line 2533:  Called multilib_src_configure
 *   environment, line 2996:  Called meson_src_configure
 *   environment, line 2401:  Called die
 * The specific snippet of code:
 *       tc-env_build "$@" || die
 * 
 * If you need support, post the output of `emerge --info '=x11-libs/gdk-pixbuf-2.40.0::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=x11-libs/gdk-pixbuf-2.40.0::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/x11-libs/gdk-pixbuf-2.40.0/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/x11-libs/gdk-pixbuf-2.40.0/temp/environment'.
 * Working directory: '/var/tmp/portage/x11-libs/gdk-pixbuf-2.40.0/work/gdk-pixbuf-2.40.0-abi_x86_32.x86'
 * S: '/var/tmp/portage/x11-libs/gdk-pixbuf-2.40.0/work/gdk-pixbuf-2.40.0'

>>> Failed to emerge x11-libs/gdk-pixbuf-2.40.0, Log file:

>>>  '/var/tmp/portage/x11-libs/gdk-pixbuf-2.40.0/temp/build.log'

t
As you can see there is a problem only with the 32 bit abi multilib configuration.

x11 library missing error because of corrupted x11-libs/lib* library

Trying to build the “media-sound/pulseaudio-13.0” threw the following error even we had rebuilt the x11-libs/libX11:

checking for iconv... yes
checking for working iconv... yes
checking for iconv declaration... 
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking whether SYS_memfd_create is declared... yes
checking for memfd_create... yes
checking for  x11-xcb xcb >= 1.6 ice sm xtst ... no
configure: error: *** X11 not found

!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/media-sound/pulseaudio-13.0/work/pulseaudio-13.0-abi_x86_32.x86/config.log
 * ERROR: media-sound/pulseaudio-13.0::gentoo failed (configure phase):
 *   econf failed
 * 
 * Call stack:
 *               ebuild.sh, line  125:  Called src_configure
 *             environment, line 4983:  Called multilib-minimal_src_configure
 *             environment, line 4002:  Called multilib_foreach_abi 'multilib-minimal_abi_src_configure'
 *             environment, line 4229:  Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_configure'
 *             environment, line 3932:  Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_configure'
 *             environment, line 3930:  Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_configure'
 *             environment, line  750:  Called multilib-minimal_abi_src_configure
 *             environment, line 3996:  Called multilib_src_configure
 *             environment, line 4474:  Called econf '--disable-adrian-aec' '--disable-esound' '--disable-gconf' '--disable-solaris' '--enable-largefile' '--localstatedir=/var' '--with-systemduserunitdir=/usr/lib/systemd/user' '--with-udev-rules-dir=//lib/udev/rules.d' '--disable-alsa' '--disable-bluez5' '--disable-gsettings' '--disable-gtk3' '--disable-jack' '--disable-samplerate' '--disable-lirc' '--disable-orc' '--disable-oss-output' '--disable-openssl' '--disable-default-build-tests' '--disable-udev' '--disable-webrtc-aec' '--disable-avahi' '--without-fftw' '--without-soxr' '--with-database=simple' '--enable-glib2' '--enable-asyncns' '--disable-neon-opt' '--disable-tcpwrap' '--enable-dbus' '--enable-x11' '--disable-systemd-daemon' '--disable-systemd-login' '--disable-systemd-journal' '--enable-ipv6' '--with-caps' '--disable-bluez5-native-headset' '--disable-bluez5-ofono-headset' 'ac_cv_lib_ltdl_lt_dladvise_init=yes' 'LIBSPEEX_CFLAGS= ' 'LIBSPEEX_LIBS= '
 *        phase-helpers.sh, line  681:  Called __helpers_die 'econf failed'
 *   isolated-functions.sh, line  112:  Called die
 * The specific snippet of code:
 *              die "$@"
 * 
 * If you need support, post the output of `emerge --info '=media-sound/pulseaudio-13.0::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=media-sound/pulseaudio-13.0::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/media-sound/pulseaudio-13.0/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/media-sound/pulseaudio-13.0/temp/environment'.
 * Working directory: '/var/tmp/portage/media-sound/pulseaudio-13.0/work/pulseaudio-13.0-abi_x86_32.x86'
 * S: '/var/tmp/portage/media-sound/pulseaudio-13.0/work/pulseaudio-13.0'

The 7th line is not very clear if any of the following “xcb >= 1.6 ice sm xtst” is the problem or not!

Apparently, the check for x11 in the initial emerge build phase may throw a generic error for missing x11 library if there is problem with some libraries part of this group “x11-libs/” (probably – x11-libs/lib*).

To find out more details about the error follow the advice of the emerge just read the support log file “/var/tmp/portage/media-sound/pulseaudio-13.0/work/pulseaudio-13.0-abi_x86_32.x86/config.log” (in this current example, in your case it would be different) and search for the error:

 configure:24280: result:
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
configure:24301: checking whether SYS_memfd_create is declared
configure:24301: x86_64-pc-linux-gnu-gcc -m32 -c -march=haswell -O2 -fomit-frame-pointer -pipe -Wall -W -Wextra -Wno-long-long -Wno-overlength-strings -Wunsafe-loop-optimi>
configure:24301: $? = 0
configure:24301: result: yes
configure:24321: checking for memfd_create
configure:24321: x86_64-pc-linux-gnu-gcc -m32 -o conftest -march=haswell -O2 -fomit-frame-pointer -pipe -Wall -W -Wextra -Wno-long-long -Wno-overlength-strings -Wunsafe-lo>
configure:24321: $? = 0
configure:24321: result: yes
configure:24358: checking for  x11-xcb xcb >= 1.6 ice sm xtst
configure:24365: $PKG_CONFIG --exists --print-errors " x11-xcb xcb >= 1.6 ice sm xtst "
Package xtst was not found in the pkg-config search path.
Perhaps you should add the directory containing `xtst.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xtst' found
configure:24368: $? = 1
configure:24382: $PKG_CONFIG --exists --print-errors " x11-xcb xcb >= 1.6 ice sm xtst "
Package xtst was not found in the pkg-config search path.
Perhaps you should add the directory containing `xtst.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xtst' found
configure:24385: $? = 1
configure:24399: result: no
No package 'xtst' found
configure:24432: error: *** X11 not found

There are more details, you see the error “No package ‘xtst‘ found” and the missing pkg-config file “xtst.pc“. We have a hint to search for a library with a name “xtst” or similar. You may do it with “qlist” (part of package app-portage/portage-utils):

srv ~ # qlist -IC|grep -i xtst
x11-libs/libXtst

And the library package “x11-libs/libXtst” should be rebuilt (note the “-i” for grep case insensitive search is important). Building the package pulseaudio does not fail.

Leave a Reply

Your email address will not be published. Required fields are marked *