race condition during build: config.h generated too late
What problem did you encounter
Build failure, when cross compiling to aarch64 with pmbootstrap for postmarketOS.
Note that we execute meson and ninja's aarch64 binaries with qemu when building like this, so the issue could be a qemu bug. I'm just reporting it anyway in case somebody else runs into this.
Workaround for the problem is explicitly generating config.h before the build:
--- a/phosh/calls/APKBUILD
+++ b/phosh/calls/APKBUILD
@@ -15,6 +15,7 @@ builddir="$srcdir/$pkgname-v$pkgver"
build() {
meson . _build --prefix=/usr
+ ninja -C _build src/config.h
ninja -C _build
}
Downstream bug report: https://gitlab.com/postmarketOS/pmaports/issues/383
What is the actual behaviour?
calls-main-window.c tries to include config.h (68/174), but the build system tries to generate config.h after building calls-main-window.c (69/174):
[68/174] Compiling C object 'src/25a6634@@calls@exe/calls-main-window.c.o'.
FAILED: src/25a6634@@calls@exe/calls-main-window.c.o
gcc -Isrc/25a6634@@calls@exe -Isrc -I../src -I. -I../ -Isrc/wayland -I../src/wayland -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/in
clude/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/fribidi -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/incl
ude/uuid -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gi
o-unix-2.0 -I/usr/include/libdrm -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/li
b/dbus-1.0/include -I/usr/include/libhandy-0.0 -I/usr/include/libpeas-1.0 -I/usr/include/gobject-introspection-1.0 -I/usr/include/gom-1.0 -I/usr/i
nclude/evolution-data-server -I/usr/include/libsecret-1 -I/usr/include/libxml2 -I/usr/include/libsoup-2.4 -I/usr/include/nss -I/usr/include/nspr -
fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu11 -O2 -g -Os -fomit-frame-pointer -Os -fomit-frame-pointer -pt
hread -MD -MQ 'src/25a6634@@calls@exe/calls-main-window.c.o' -MF 'src/25a6634@@calls@exe/calls-main-window.c.o.d' -o 'src/25a6634@@calls@exe/calls
-main-window.c.o' -c ../src/calls-main-window.c
../src/calls-main-window.c:32:10: fatal error: config.h: No such file or directory
32 | #include "config.h"
| ^~~~~~~~~~
compilation terminated.
[69/174] Generating config.h with a custom command.
ninja: build stopped: subcommand failed.
What is the expected behaviour?
Always generate config.h before trying to build anything that requires it.
How to reproduce
I'm not expecting anybody to reproduce this, since this is not supported by purism... but for the record:
$ pip install pmbootstrap
$ pmbootstrap init
$ cd "$(pmbootstrap -q config aports)"
$ git checkout 4098ca9638c3ea57d41a4881901a4d1c893a5e4a
$ pmbootstrap build --arch=aarch64 calls
Which version of Calls did you encounter the bug in?
-
I compiled it myself.
Calls Version: 0.1.0