Dear maintainer(s),
virglrenderer fails to build from source with glibc 2.43, currently in
experimental. From the build log:
| [5/132] cc -Isrc/mesa/libmesa.a.p -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -Werror=format -fvisibility=hidden -fno-strict-aliasing -imacros /build/reproducible-path/virglrenderer-1.2.0/obj-aarch64-linux-gnu/config.h -DHAVE_CONFIG_H=1 -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/virglrenderer-1.2.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -pthread -MD -MQ src/mesa/libmesa.a.p/util_u_math.c.o -MF src/mesa/libmesa.a.p/util_u_math.c.o.d -o src/mesa/libmesa.a.p/util_u_math.c.o -c ../src/mesa/util/u_math.c
| FAILED: [code=1] src/mesa/libmesa.a.p/util_u_math.c.o
| cc -Isrc/mesa/libmesa.a.p -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -Werror=format -fvisibility=hidden -fno-strict-aliasing -imacros /build/reproducible-path/virglrenderer-1.2.0/obj-aarch64-linux-gnu/config.h -DHAVE_CONFIG_H=1 -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/virglrenderer-1.2.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -pthread -MD -MQ src/mesa/libmesa.a.p/util_u_math.c.o -MF src/mesa/libmesa.a.p/util_u_math.c.o.d -o src/mesa/libmesa.a.p/util_u_math.c.o -c ../src/mesa/util/u_math.c
| In file included from ../src/mesa/compat/c11/threads.h:64,
| from ../src/mesa/util/u_thread.h:35,
| from ../src/mesa/util/u_cpu_detect.h:40,
| from ../src/mesa/util/u_math.c:32:
| ../src/mesa/compat/c11/threads_posix.h:54:9: warning: ‘ONCE_FLAG_INIT’ redefined
| 54 | #define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
| | ^~~~~~~~~~~~~~
| In file included from /usr/include/stdlib.h:1191,
| from ../src/mesa/compat/c11/threads_posix.h:29:
| /usr/include/aarch64-linux-gnu/bits/types/once_flag.h:25:9: note: this is the location of the previous definition
| 25 | #define ONCE_FLAG_INIT __ONCE_FLAG_INIT
| | ^~~~~~~~~~~~~~
| ../src/mesa/compat/c11/threads_posix.h:69:25: error: conflicting types for ‘once_flag’; have ‘pthread_once_t’ {aka ‘int’}
| 69 | typedef pthread_once_t once_flag;
| | ^~~~~~~~~
| /usr/include/aarch64-linux-gnu/bits/types/once_flag.h:24:21: note: previous declaration of ‘once_flag’ with type ‘once_flag’
| 24 | typedef __once_flag once_flag;
| | ^~~~~~~~~
| ../src/mesa/compat/c11/threads_posix.h:94:1: error: conflicting types for ‘call_once’; have ‘void(int *, void (*)(void))’
| 94 | call_once(once_flag *flag, void (*func)(void))
| | ^~~~~~~~~
| /usr/include/stdlib.h:1195:13: note: previous declaration of ‘call_once’ with type ‘void(once_flag *, void (*)(void))’
| 1195 | extern void call_once (once_flag *__flag, void (*__func)(void));
| | ^~~~~~~~~
| [6/132] cc -Isrc/mesa/libmesa.a.p -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -Werror=format -fvisibility=hidden -fno-strict-aliasing -imacros /build/reproducible-path/virglrenderer-1.2.0/obj-aarch64-linux-gnu/config.h -DHAVE_CONFIG_H=1 -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/virglrenderer-1.2.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -pthread -MD -MQ src/mesa/libmesa.a.p/util_u_cpu_detect.c.o -MF src/mesa/libmesa.a.p/util_u_cpu_detect.c.o.d -o src/mesa/libmesa.a.p/util_u_cpu_detect.c.o -c ../src/mesa/util/u_cpu_detect.c
| FAILED: [code=1] src/mesa/libmesa.a.p/util_u_cpu_detect.c.o
| cc -Isrc/mesa/libmesa.a.p -Isrc/mesa -I../src/mesa -I../src/mesa/compat -I../src/mesa/pipe -I../src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -Werror=format -fvisibility=hidden -fno-strict-aliasing -imacros /build/reproducible-path/virglrenderer-1.2.0/obj-aarch64-linux-gnu/config.h -DHAVE_CONFIG_H=1 -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/virglrenderer-1.2.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -pthread -MD -MQ src/mesa/libmesa.a.p/util_u_cpu_detect.c.o -MF src/mesa/libmesa.a.p/util_u_cpu_detect.c.o.d -o src/mesa/libmesa.a.p/util_u_cpu_detect.c.o -c ../src/mesa/util/u_cpu_detect.c
| In file included from ../src/mesa/compat/c11/threads.h:64,
| from ../src/mesa/util/u_thread.h:35,
| from ../src/mesa/util/u_cpu_detect.h:40,
| from ../src/mesa/util/u_cpu_detect.c:39:
| ../src/mesa/compat/c11/threads_posix.h:54:9: warning: ‘ONCE_FLAG_INIT’ redefined
| 54 | #define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
| | ^~~~~~~~~~~~~~
| In file included from /usr/include/stdlib.h:1191,
| from ../src/mesa/pipe/p_compiler.h:36,
| from ../src/mesa/util/u_cpu_detect.c:36:
| /usr/include/aarch64-linux-gnu/bits/types/once_flag.h:25:9: note: this is the location of the previous definition
| 25 | #define ONCE_FLAG_INIT __ONCE_FLAG_INIT
| | ^~~~~~~~~~~~~~
| ../src/mesa/compat/c11/threads_posix.h:69:25: error: conflicting types for ‘once_flag’; have ‘pthread_once_t’ {aka ‘int’}
| 69 | typedef pthread_once_t once_flag;
| | ^~~~~~~~~
| /usr/include/aarch64-linux-gnu/bits/types/once_flag.h:24:21: note: previous declaration of ‘once_flag’ with type ‘once_flag’
| 24 | typedef __once_flag once_flag;
| | ^~~~~~~~~
| ../src/mesa/compat/c11/threads_posix.h:94:1: error: conflicting types for ‘call_once’; have ‘void(int *, void (*)(void))’
| 94 | call_once(once_flag *flag, void (*func)(void))
| | ^~~~~~~~~
| /usr/include/stdlib.h:1195:13: note: previous declaration of ‘call_once’ with type ‘void(once_flag *, void (*)(void))’
| 1195 | extern void call_once (once_flag *__flag, void (*__func)(void));
| | ^~~~~~~~~
...
| ninja: build stopped: subcommand failed.
| dh_auto_build: error: cd obj-aarch64-linux-gnu && LC_ALL=C.UTF-8 ninja -j128 -v returned exit code 1
| make: *** [debian/rules:15: binary] Error 25
| dpkg-buildpackage: error: debian/rules binary subprocess failed with exit status 2
The full build log is available here [1].
The issue is due to the definition of ONCE_FLAG_INIT in stdlib.h in
addition to threads.h as part of ISO C23 [2]. I believe that the issue
is fixed upstream [3], but I haven't tested the patch.
I would like to thanks Emanuele Rocca for doing the archive rebuild on a
fast arm64 server.
Regards
Aurelien
[1] https://people.debian.org/~ema/glibc-2.43-rebuilds/output-1/virglrenderer_arm64.build
[2] https://sourceware.org/git/?p=glibc.git;a=commit;h=a7ddbf456d97ac8d1aa7afd735e196a1488bd874
[3] https://gitlab.freedesktop.org/virgl/virglrenderer/-/commit/3f0f775edb2df5ea54c37863286ad565ccddb276