Meson build fails to find Ninja
Background: I'm building Glib in a Docker build process in order to build GStreamer. The base image is ubuntu:16.04. I'm building lots of libraries in this Docker build process - it's been building FFmpeg for years, but now I want to add GStreamer, so I need to add GLib to my built libraries.
I have added Ninga and Meson to my Docker build process.
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
build-essential \
gcc-multilib \
g++-multilib \
binutils-multiarch \
autoconf \
cmake \
ninja-build \
libtool \
pkg-config \
perl \
python \
python3-pip \
texi2html \
doxygen \
bison \
flex \
m4 \
curl \
unzip \
tar \
git-core \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install --upgrade pip \
&& python3 -m pip install meson
When the build gets to building glib the build fails.
RUN cd ${ffbuild_prefix}/src/glib \
&& meson _build \
&& ninja -v -j 6 -C _build \
&& ninja -C _build install
ERROR: Could not detect Ninja v1.5 or newer
A full log can be found at /opt/ffbuild/src/glib/_build/meson-logs/meson-log.txt
The command '/bin/sh -c cd ${ffbuild_prefix}/src/glib && meson _build && ninja -v -j 6 -C _build && ninja -C _build install' returned a non-zero code: 1
This is the full error I get when I run the glib build in the last completed Docker image:
$ docker run -it --rm f66a71bef7eb bash
root@737c33057f8b:/opt/ffbuild# cd src/glib/
root@737c33057f8b:/opt/ffbuild/src/glib# meson _build
The Meson build system
Version: 0.54.0
Source dir: /opt/ffbuild/src/glib
Build dir: /opt/ffbuild/src/glib/_build
Build type: native build
Using 'PKG_CONFIG_PATH' from environment with value: '/opt/ffbuild/lib/pkgconfig'
Using 'PKG_CONFIG_PATH' from environment with value: '/opt/ffbuild/lib/pkgconfig'
Project name: glib
Project version: 2.65.0
Using 'CC' from environment with value: '/usr/bin/gcc'
Using 'CFLAGS' from environment with value: ' -I/opt/ffbuild/include'
Using 'LDFLAGS' from environment with value: '-L/opt/ffbuild/lib '
Using 'CPPFLAGS' from environment with value: ' -I/opt/ffbuild/include'
Using 'AR' from environment with value: '/usr/bin/ar'
Using 'CXX' from environment with value: '/usr/bin/g++'
Using 'CXXFLAGS' from environment with value: ' -I/opt/ffbuild/include'
Using 'LDFLAGS' from environment with value: '-L/opt/ffbuild/lib '
Using 'CPPFLAGS' from environment with value: ' -I/opt/ffbuild/include'
Using 'CC' from environment with value: '/usr/bin/gcc'
Using 'CFLAGS' from environment with value: ' -I/opt/ffbuild/include'
Using 'LDFLAGS' from environment with value: '-L/opt/ffbuild/lib '
Using 'CPPFLAGS' from environment with value: ' -I/opt/ffbuild/include'
C compiler for the host machine: /usr/bin/gcc (gcc 5.4.0 "gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609")
C linker for the host machine: /usr/bin/gcc ld.bfd 2.26.1
Using 'AR' from environment with value: '/usr/bin/ar'
Using 'CXX' from environment with value: '/usr/bin/g++'
Using 'CXXFLAGS' from environment with value: ' -I/opt/ffbuild/include'
Using 'LDFLAGS' from environment with value: '-L/opt/ffbuild/lib '
Using 'CPPFLAGS' from environment with value: ' -I/opt/ffbuild/include'
C++ compiler for the host machine: /usr/bin/g++ (gcc 5.4.0 "g++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609")
C++ linker for the host machine: /usr/bin/g++ ld.bfd 2.26.1
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -fno-strict-aliasing: YES
Checking if "GNU C visibility attributes test" compiles: YES
Compiler for C supports arguments -fvisibility=hidden: YES
Message: Enabling various debug infrastructure
Has header "alloca.h" : YES
Has header "crt_externs.h" : NO
Has header "dirent.h" : YES
Has header "float.h" : YES
Has header "fstab.h" : YES
Has header "grp.h" : YES
Has header "inttypes.h" : YES
Has header "limits.h" : YES
Has header "linux/magic.h" : YES
Has header "locale.h" : YES
Has header "mach/mach_time.h" : NO
Has header "memory.h" : YES
Has header "mntent.h" : YES
Has header "poll.h" : YES
Has header "pwd.h" : YES
Has header "sched.h" : YES
Has header "spawn.h" : YES
Has header "stdint.h" : YES
Has header "stdlib.h" : YES
Has header "string.h" : YES
Has header "strings.h" : YES
Has header "sys/auxv.h" : YES
Has header "sys/event.h" : NO
Has header "sys/filio.h" : NO
Has header "sys/inotify.h" : YES
Has header "sys/mkdev.h" : NO
Has header "sys/mntctl.h" : NO
Has header "sys/mnttab.h" : NO
Has header "sys/mount.h" : YES
Has header "sys/param.h" : YES
Has header "sys/resource.h" : YES
Has header "sys/select.h" : YES
Has header "sys/statfs.h" : YES
Has header "sys/stat.h" : YES
Has header "sys/statvfs.h" : YES
Has header "sys/sysctl.h" : YES
Has header "sys/time.h" : YES
Has header "sys/times.h" : YES
Has header "sys/types.h" : YES
Has header "sys/uio.h" : YES
Has header "sys/vfs.h" : YES
Has header "sys/vfstab.h" : NO
Has header "sys/vmount.h" : NO
Has header "sys/wait.h" : YES
Has header "termios.h" : YES
Has header "unistd.h" : YES
Has header "values.h" : YES
Has header "wchar.h" : YES
Has header "xlocale.h" : YES
Checking if "malloc.h" compiles: YES
Has header "linux/netlink.h" : YES
Header <locale.h> has symbol "LC_MESSAGES" : YES
Checking whether type "struct stat" has member "st_mtimensec" : NO
Checking whether type "struct stat" has member "st_mtim.tv_nsec" : YES
Checking whether type "struct stat" has member "st_atimensec" : NO
Checking whether type "struct stat" has member "st_atim.tv_nsec" : YES
Checking whether type "struct stat" has member "st_ctimensec" : NO
Checking whether type "struct stat" has member "st_ctim.tv_nsec" : YES
Checking whether type "struct stat" has member "st_birthtime" : NO
Checking whether type "struct stat" has member "st_birthtimensec" : NO
Checking whether type "struct stat" has member "st_birthtim" : NO
Checking whether type "struct stat" has member "st_birthtim.tv_nsec" : NO
Checking whether type "struct stat" has member "st_blksize" : YES
Checking whether type "struct stat" has member "st_blocks" : YES
Checking whether type "struct statfs" has member "f_fstypename" : NO
Checking whether type "struct statfs" has member "f_bavail" : YES
Checking whether type "struct dirent" has member "d_type" : YES
Checking whether type "struct statvfs" has member "f_basetype" : NO
Checking whether type "struct statvfs" has member "f_fstypename" : NO
Checking whether type "struct tm" has member "tm_gmtoff" : YES
Checking whether type "struct tm" has member "__tm_gmtoff" : NO
Compiler for C supports arguments -Wduplicated-branches: NO
Compiler for C supports arguments -Wimplicit-fallthrough: NO
Compiler for C supports arguments -Wmisleading-indentation: NO
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wunused: YES
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Compiler for C supports arguments -Wno-bad-function-cast -Wbad-function-cast: YES
Compiler for C supports arguments -Wno-cast-function-type -Wcast-function-type: NO
Compiler for C supports arguments -Wno-pedantic -Wpedantic: YES
Compiler for C supports arguments -Werror=declaration-after-statement: YES
Compiler for C supports arguments -Werror=format=2: YES
Compiler for C supports arguments -Werror=implicit-function-declaration: YES
Compiler for C supports arguments -Werror=init-self: YES
Compiler for C supports arguments -Werror=missing-include-dirs: YES
Compiler for C supports arguments -Werror=missing-prototypes: YES
Compiler for C supports arguments -Werror=pointer-arith: YES
Compiler for C supports link arguments -Wl,-z,nodelete: YES
Compiler for C supports link arguments -Wl,-Bsymbolic-functions: YES
Checking for function "endmntent" : YES
Checking for function "endservent" : YES
Checking for function "fallocate" : YES
Checking for function "fchmod" : YES
Checking for function "fchown" : YES
Checking for function "fdwalk" : NO
Checking for function "fsync" : YES
Checking for function "getauxval" : YES
Checking for function "getc_unlocked" : YES
Checking for function "getfsstat" : NO
Checking for function "getgrgid_r" : YES
Checking for function "getmntent_r" : YES
Checking for function "getpwuid_r" : YES
Checking for function "getresuid" : YES
Checking for function "getvfsstat" : NO
Checking for function "gmtime_r" : YES
Checking for function "hasmntopt" : YES
Checking for function "inotify_init1" : YES
Checking for function "issetugid" : NO
Checking for function "kevent" : NO
Checking for function "kqueue" : NO
Checking for function "lchmod" : NO
Checking for function "lchown" : YES
Checking for function "link" : YES
Checking for function "localtime_r" : YES
Checking for function "lstat" : YES
Checking for function "mbrtowc" : YES
Checking for function "memalign" : YES
Checking for function "mmap" : YES
Checking for function "newlocale" : YES
Checking for function "pipe2" : YES
Checking for function "poll" : YES
Checking for function "prlimit" : YES
Checking for function "readlink" : YES
Checking for function "recvmmsg" : YES
Checking for function "sendmmsg" : YES
Checking for function "setenv" : YES
Checking for function "setmntent" : YES
Checking for function "strerror_r" : YES
Checking for function "strnlen" : YES
Checking for function "strsignal" : YES
Checking for function "strtod_l" : YES
Checking for function "strtoll_l" : YES
Checking for function "strtoull_l" : YES
Checking for function "symlink" : YES
Checking for function "timegm" : YES
Checking for function "unsetenv" : YES
Checking for function "uselocale" : YES
Checking for function "utimes" : YES
Checking for function "valloc" : YES
Checking for function "vasprintf" : YES
Checking for function "vsnprintf" : YES
Checking for function "wcrtomb" : YES
Checking for function "wcslen" : YES
Checking for function "wcsnlen" : YES
Checking for function "sysctlbyname" : NO
Checking for function "_NSGetEnviron" : NO
Checking for function "statvfs" : YES
Checking for function "statfs" : YES
Checking for function "if_indextoname" : YES
Checking for function "if_nametoindex" : YES
Checking for function "splice" : YES
Checking for function "stpcpy" : YES
Checking for function "posix_memalign" : YES
Checking for function "posix_spawn" : YES
Checking if "strerror_r() returns char *" compiles: YES
Checking for function "snprintf" : YES
Checking for function "strcasecmp" : YES
Checking for function "strncasecmp" : YES
Header <sys/sysmacros.h> has symbol "major" : YES
Header <dlfcn.h> has symbol "RTLD_LAZY" : YES
Header <dlfcn.h> has symbol "RTLD_NOW" : YES
Header <dlfcn.h> has symbol "RTLD_GLOBAL" : YES
Header <dlfcn.h> has symbol "RTLD_NEXT" : YES
Message: Checking whether to use statfs or statvfs .. statfs
Checking for function "mkostemp" : YES
Checking if "futex(2) system call" links: YES
Checking if "eventfd(2) system call" links: YES
Checking if "clock_gettime" links: YES
Checking if "dlopen() and dlsym() in system libraries" links: NO
Checking if "dlopen() and dlsym() in libdl" links: YES
Library dl found: YES
Checking if "number of arguments to statfs() (n=2)" compiles: YES
Checking if "open() option O_DIRECTORY" compiles: YES
Checking if "C99 vsnprintf" runs: YES
Checking if "C99 snprintf" runs: YES
Checking if "Unix98 printf positional parameters" runs: YES
Checking if "nl_langinfo and CODESET" links: YES
Checking if "nl_langinfo (PM_STR)" links: YES
Checking if "nl_langinfo (_NL_CTYPE_OUTDIGITn_MB)" links: YES
Checking if "nl_langinfo (ALTMON_n)" links: NO
Checking if "nl_langinfo (_NL_ABALTMON_n)" links: NO
Checking if "signed" compiles: YES
Header <stddef.h> has symbol "ptrdiff_t" : YES
Checking if "sig_atomic_t" links: YES
Checking if "long long" compiles: YES
Checking if "long double" compiles: YES
Header <stddef.h> has symbol "wchar_t" : YES
Header <wchar.h> has symbol "wint_t" : YES
Checking if "uintmax_t in inttypes.h" compiles: YES
Checking if "uintmax_t in stdint.h" compiles: YES
Checking for size of "char" : 1
Checking for size of "short" : 2
Checking for size of "int" : 4
Checking for size of "void*" : 8
Checking for size of "long" : 8
Checking for size of "long long" : 8
Checking for size of "size_t" : 8
Checking for size of "ssize_t" : 8
Checking if "int64_t is long" compiles: YES
Checking for alignment of "char" : 1
Checking for alignment of "short" : 2
Checking for alignment of "int" : 4
Checking for alignment of "void*" : 8
Checking for alignment of "long" : 8
Checking for alignment of "long long" : 8
Checking for alignment of "size_t" : 8
Checking for size of "wchar_t" : 4
Checking if "GCC size_t typedef is long long" compiles: NO
Checking if "GCC size_t typedef is long" compiles: YES
Checking if "__va_copy check" compiles: YES
Checking if "va_copy check" compiles: YES
Checking if "va_lists can be copied as values" runs: DID NOT COMPILE
Checking if "ISO C99 varargs macros in C" compiles: YES
Checking if "ISO C99 varargs macros in C++" compiles: YES
Checking if "GNUC varargs macros" compiles: YES
Has header "alloca.h" : YES (cached)
Has header "sys/poll.h" : YES
Has header "sys/types.h" : YES (cached)
Has header "winsock2.h" : NO
Computing int of "POLLIN" : 1
Computing int of "POLLOUT" : 4
Computing int of "POLLPRI" : 2
Computing int of "POLLERR" : 8
Computing int of "POLLHUP" : 16
Computing int of "POLLNVAL" : 32
Computing int of "AF_UNIX" : 1
Computing int of "AF_INET" : 2
Computing int of "AF_INET6" : 10
Computing int of "MSG_OOB" : 1
Computing int of "MSG_PEEK" : 2
Computing int of "MSG_DONTROUTE" : 4
Checking if "atomic ops" links: YES
Checking if "atomic ops define" compiles: YES
Run-time dependency threads found: YES
Header <pthread.h> has symbol "pthread_attr_setstacksize" : YES
Header <pthread.h> has symbol "pthread_attr_setinheritsched" : YES
Header <pthread.h> has symbol "pthread_condattr_setclock" : YES
Header <pthread.h> has symbol "pthread_cond_timedwait_relative_np" : NO
Header <pthread.h> has symbol "pthread_getname_np" : YES
Header <sys/syscall.h> has symbol "SYS_sched_getattr" : YES
Checking if "pthread_setname_np(const char*)" with dependency threads links: NO
Checking if "pthread_setname_np(pthread_t, const char*)" with dependency threads links: YES
Checking if "stack grows check" runs: NO (1)
Checking for function "iconv_open" : YES
Using 'PKG_CONFIG' from environment with value: '/usr/bin/pkg-config '
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Found CMake: /usr/bin/cmake (3.5.1)
Run-time dependency libpcre found: NO (tried pkgconfig and cmake)
Library m found: YES
Cloning into 'libffi'...
remote: Enumerating objects: 11784, done.
remote: Counting objects: 100% (11784/11784), done.
remote: Compressing objects: 100% (4320/4320), done.
remote: Total 11784 (delta 7342), reused 11600 (delta 7217), pack-reused 0
Receiving objects: 100% (11784/11784), 7.14 MiB | 3.17 MiB/s, done.
Resolving deltas: 100% (7342/7342), done.
Checking connectivity... done.
Already on 'meson'
Your branch is up-to-date with 'origin/meson'.
Run-time dependency libffi found: NO (tried pkgconfig and cmake)
Looking for a fallback subproject for the dependency libffi
|Executing subproject libffi method meson
|
|Using 'PKG_CONFIG_PATH' from environment with value: '/opt/ffbuild/lib/pkgconfig'
|Using 'PKG_CONFIG_PATH' from environment with value: '/opt/ffbuild/lib/pkgconfig'
|Project name: libffi
|Project version: 3.2.9999
|C compiler for the host machine: /usr/bin/gcc (gcc 5.4.0 "gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609")
|C linker for the host machine: /usr/bin/gcc ld.bfd 2.26.1
|Message: host cpu: x86_64
|Message: host cpu_family: x86_64
|Message: host system: linux
|Checking if "ASM .cfi" compiles: NO
|Checking if "ASM x86 PCREL" compiles: YES
|Checking if "ASM .ascii" compiles: YES
|Checking if "ASM .string" compiles: YES
|Checking for size of "size_t" : 8
|Checking for size of "long double" : 16
|Checking for size of "double" : 8
|Message: sizeof "long double" is greater than "double"
|Message: .eh_frame is hard-coded to not be ro
|Message: Assembler supports .unwind section type
|Checking for function "memcpy" : YES
|Checking for function "mkostemp" : YES
|Has header "alloca.h" : YES (cached)
|Has header "inttypes.h" : YES (cached)
|Has header "stdint.h" : YES (cached)
|Compiler for C supports function attribute visibility: YES
|Program test-cc-supports-hidden-visibility.py found: YES (/usr/bin/python3 /opt/ffbuild/src/glib/subprojects/libffi/test-cc-supports-hidden-visibility.py)
|Message: .hidden pseudo-op is available
|Program msvcc.sh found: YES (/opt/ffbuild/src/glib/subprojects/libffi/msvcc.sh)
|Configuring ffi-x86_64.h using configuration
|Configuring ffitarget.h using configuration
|Configuring ffi.h using configuration
|Configuring fficonfig.h using configuration
|Build targets in project: 1
|Subproject libffi finished.
Dependency libffi from subproject subprojects/libffi found: YES 3.2.9999
Using 'PKG_CONFIG_PATH' from environment with value: '/opt/ffbuild/lib/pkgconfig'
Run-time dependency zlib found: YES 1.2.11
Checking for function "ngettext" : YES
Checking for function "bind_textdomain_codeset" : YES
Run-time dependency mount found: NO (tried pkgconfig and cmake)
Run-time dependency libselinux found: NO (tried pkgconfig and cmake)
Checking for function "getxattr" : YES
Has header "sys/xattr.h" : YES
Checking if "XATTR_NOFOLLOW" compiles: NO
Checking for function "strlcpy" : NO
Checking if "/proc/self/cmdline" runs: YES
Program python3 found: YES (/usr/bin/python3)
Program bash found: YES (/bin/bash)
Program sh found: YES (/bin/sh)
Program env found: YES (/usr/bin/env)
Configuring glibconfig.h using configuration
WARNING: Project targeting '>= 0.49.2' but tried to use feature introduced in '0.53.0': meson.override_dependency
Configuring gtester-report using configuration
Configuring libglib-2.0.so.0.6500.0-gdb.py using configuration
Program xmllint found: YES (/opt/ffbuild/bin/xmllint)
Configuring glib-genmarshal using configuration
Program /opt/ffbuild/src/glib/_build/gobject/glib-genmarshal found: YES (/opt/ffbuild/src/glib/_build/gobject/glib-genmarshal)
Configuring glib-mkenums using configuration
Program /opt/ffbuild/src/glib/_build/gobject/glib-mkenums found: YES (/opt/ffbuild/src/glib/_build/gobject/glib-mkenums)
Configuring libgobject-2.0.so.0.6500.0-gdb.py using configuration
Checking if "dlsym() preceding underscores" with dependency -ldl runs: NO (1)
Checking for function "dlerror" with dependency -ldl: YES
Configuring gmoduleconf.h using configuration
Checking if "C_IN in public headers (no arpa/nameser_compat.h needed)" compiles: YES
Checking if "res_query()" links: NO
Checking if "res_query() in -lresolv" links: YES
Library resolv found: YES
Checking if "socket()" links: YES
Checking if "res_init()" links: YES
Checking if "res_nclose()" links: YES
Checking if "res_ndestroy()" links: NO
Checking if "res_ninit()" links: YES
Checking if "res_nquery()" links: YES
Checking for type "struct ip_mreqn" : YES
Checking if "ioctl with request SIOCGIFADDR" compiles: YES
Configuring gnetworking.h using configuration
Configuring gdbus-codegen using configuration
Program /opt/ffbuild/src/glib/_build/gio/gdbus-2.0/codegen/gdbus-codegen found: YES (/opt/ffbuild/src/glib/_build/gio/gdbus-2.0/codegen/gdbus-codegen)
Configuring config.py using configuration
Run-time dependency libelf found: NO (tried pkgconfig and cmake)
Library elf found: NO
Program gengiotypefuncs.py found: YES (/usr/bin/python3 /opt/ffbuild/src/glib/gio/tests/gengiotypefuncs.py)
Run-time dependency dbus-1 found: NO (tried pkgconfig and cmake)
Program dbus-daemon found: NO
Program msgfmt found: NO
Configuring appinfo-test-gnome.desktop using configuration
Configuring appinfo-test-notgnome.desktop using configuration
Configuring appinfo-test.desktop using configuration
Configuring appinfo-test2.desktop using configuration
Program objcopy found: YES (/usr/bin/objcopy)
Program ld found: YES (/usr/bin/ld)
Configuring org.freedesktop.portal.Documents.service using configuration
Compiler for C supports arguments -Werror=unused-function: YES
Library FuzzingEngine skipped: feature oss_fuzz disabled
Program xgettext found: NO
Configuring glib-gettextize using configuration
Configuring config.h using configuration
Build targets in project: 346
WARNING: Project specifies a minimum meson_version '>= 0.49.2' but uses features which were added in newer versions:
* 0.53.0: {'meson.override_dependency'}
WARNING: Deprecated features used:
* 0.53.0: {'meson.override_dependency'}
glib 2.65.0
Subprojects
libffi: YES
ERROR: Could not detect Ninja v1.5 or newer
A full log can be found at /opt/ffbuild/src/glib/_build/meson-logs/meson-log.txt
But, I can see that ninja is installed and is v1.5.1.
root@737c33057f8b:/opt/ffbuild/src/glib# ninja --version
1.5.1
I cannot see any helpful hints at the end of _build/meson-logs/meson-log.txt
...
Program xgettext found: NO
Configuring glib-gettextize using configuration
Configuring config.h using configuration
Build targets in project: 346
WARNING: Project specifies a minimum meson_version '>= 0.49.2' but uses features which were added in newer versions:
* 0.53.0: {'meson.override_dependency'}
WARNING: Deprecated features used:
* 0.53.0: {'meson.override_dependency'}
glib 2.65.0
Subprojects
libffi: YES
ERROR: Could not detect Ninja v1.5 or newer
How can I build Glib?