Test atk_test_util fails to compile due to missing header sys/time.h
The compilation of at-spi2-atk version 2.34.1 fails in a Linux system using GCC-8.3.0 with several errors related to struct timespec timeout
[...]
[52/74] Compiling C object 'tests/59830eb@@testutils@sta/atk_test_util.c.o'.
FAILED: tests/59830eb@@testutils@sta/atk_test_util.c.o
gcc -Itests/59830eb@@testutils@sta -Itests -I../at-spi2-atk-2.34.1/tests -I. -I../at-spi2-atk-2.34.1/ -I/apps/brussel/CO7/skylake/software/GLib/2.62.0-GCCcore-8.3.0/include/glib-2.0 -I/apps/brussel/CO7/skylake/software/GLib/2.62.0-GCCcore-8.3.0/lib/glib-2.0/include -I/user/brussel/101/vsc10122/.local/easybuild/software/at-spi2-core/2.34.0-GCCcore-8.3.0/include/at-spi-2.0 -I/apps/brussel/CO7/skylake/software/DBus/1.13.12-GCCcore-8.3.0/include/dbus-1.0 -I/apps/brussel/CO7/skylake/software/DBus/1.13.12-GCCcore-8.3.0/lib/dbus-1.0/include -I/user/brussel/101/vsc10122/.local/easybuild/software/ATK/2.34.1-GCCcore-8.3.0/include -I/apps/brussel/CO7/skylake/software/libxml2/2.9.9-GCCcore-8.3.0/include -I/user/brussel/101/vsc10122/.local/easybuild/software/at-spi2-core/2.34.0-GCCcore-8.3.0/include -I/apps/brussel/CO7/skylake/software/DBus/1.13.12-GCCcore-8.3.0/include -I/apps/brussel/CO7/skylake/software/GLib/2.62.0-GCCcore-8.3.0/include -I/apps/brussel/CO7/skylake/software/binutils/2.32-GCCcore-8.3.0/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c99 -O2 -g -D_DEFAULT_SOURCE -DATK_DISABLE_DEPRECATION_WARNINGS -O2 -ftree-vectorize -march=native -fno-math-errno -fPIC '-DTESTS_BUILD_DIR="/theia/scratch/brussel/101/vsc10122/easybuild-local/build/atspi2atk/2.34.1/GCCcore-8.3.0/easybuild_obj/tests"' -MD -MQ 'tests/59830eb@@testutils@sta/atk_test_util.c.o' -MF 'tests/59830eb@@testutils@sta/atk_test_util.c.o.d' -o 'tests/59830eb@@testutils@sta/atk_test_util.c.o' -c ../at-spi2-atk-2.34.1/tests/atk_test_util.c
../at-spi2-atk-2.34.1/tests/atk_test_util.c: In function assert_clean_exit:
../at-spi2-atk-2.34.1/tests/atk_test_util.c:30:3: warning: implicit declaration of function kill [-Wimplicit-function-declaration]
kill (child_pid, SIGTERM);
^~~~
../at-spi2-atk-2.34.1/tests/atk_test_util.c: In function get_root_obj:
../at-spi2-atk-2.34.1/tests/atk_test_util.c:75:10: error: variable timeout has initializer but incomplete type
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^~~~~~~~
../at-spi2-atk-2.34.1/tests/atk_test_util.c:75:32: error: struct timespec has no member named tv_sec
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^~~~~~
../at-spi2-atk-2.34.1/tests/atk_test_util.c:75:41: warning: excess elements in struct initializer
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^
../at-spi2-atk-2.34.1/tests/atk_test_util.c:75:41: note: (near initialization for timeout)
../at-spi2-atk-2.34.1/tests/atk_test_util.c:75:45: error: struct timespec has no member named tv_nsec
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^~~~~~~
../at-spi2-atk-2.34.1/tests/atk_test_util.c:75:55: warning: excess elements in struct initializer
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^~
../at-spi2-atk-2.34.1/tests/atk_test_util.c:75:55: note: (near initialization for timeout)
../at-spi2-atk-2.34.1/tests/atk_test_util.c:75:19: error: storage size of timeout isnt known
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^~~~~~~
../at-spi2-atk-2.34.1/tests/atk_test_util.c:90:5: warning: implicit declaration of function nanosleep; did you mean g_usleep? [-Wimplicit-function-declaration]
nanosleep(&timeout, NULL);
^~~~~~~~~
g_usleep
../at-spi2-atk-2.34.1/tests/atk_test_util.c:75:19: warning: unused variable timeout [-Wunused-variable]
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^~~~~~~
../at-spi2-atk-2.34.1/tests/atk_test_util.c: In function terminate_app:
../at-spi2-atk-2.34.1/tests/atk_test_util.c:108:10: error: variable timeout has initializer but incomplete type
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^~~~~~~~
../at-spi2-atk-2.34.1/tests/atk_test_util.c:108:32: error: struct timespec has no member named tv_sec
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^~~~~~
../at-spi2-atk-2.34.1/tests/atk_test_util.c:108:41: warning: excess elements in struct initializer
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^
../at-spi2-atk-2.34.1/tests/atk_test_util.c:108:41: note: (near initialization for timeout)
../at-spi2-atk-2.34.1/tests/atk_test_util.c:108:45: error: struct timespec has no member named tv_nsec
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^~~~~~~
../at-spi2-atk-2.34.1/tests/atk_test_util.c:108:55: warning: excess elements in struct initializer
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^~
../at-spi2-atk-2.34.1/tests/atk_test_util.c:108:55: note: (near initialization for timeout)
../at-spi2-atk-2.34.1/tests/atk_test_util.c:108:19: error: storage size of timeout isnt known
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
^~~~~~~
../at-spi2-atk-2.34.1/tests/atk_test_util.c:108:19: warning: unused variable timeout [-Wunused-variable]
Versions of relevant libraries used in the build:
- GLib-2.62.0
- at-spi2-core-2.34.0
- DBus-1.13.12
- ATK-2.34.1
- binutils-2.32
The reason of the compilation failure of tests/atk_test_util.c
seems to be a missing header declaration for sys/time.h
in tests/atk_test_util.h
. The following patch fixes the issue in our system
--- a/tests/atk_test_util.h 2019-10-07 20:25:50.000000000 +0200
+++ b/tests/atk_test_util.h 2020-02-04 17:09:56.856198000 +0100
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <unistd.h>
+#include <sys/time.h>
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>