I created a docker container about 7 years ago using Ubuntu 16.04 and gcc 5.4 to build an application that requires a very stable build environment. The container is currently hosted from an Ubuntu 16.04 host and has worked flawlessly over the last 7 years.
Recently we started the process of replacing the Ubuntu 16.04 host with a newer Ubuntu 22.04 host. I ran the same build process that works for the U16 host and ran into an issue with gcc.
The error reported for gcc is a syntax error inside the /usr/include/x86_64-linux/gnu/sys/select.h related to the following declaration:
#ifndef __USE_TIME_BITS64
102 extern int select (int __nfds, fd_set *__restrict __readfds,
103 fd_set *__restrict __writefds,
104 fd_set *__restrict __exceptfds,
105 struct timeval *__restrict __timeout);
The syntax error is due to the use of the __restrict qualifier in front of the __readfds, __writefds, and __exceptfds.
The same error is reported by every other system include file that is added which uses the __restrict qualifier.
I looked at the file where this qualifier is defined /usr/include/x86_64-linux/gnu/sys/cdefs.h and found the following definition:
/* __restrict is known in EGCS 1.2 and above, and in clang.
It works also in C++ mode (outside of arrays), but only when spelled
as '__restrict', not 'restrict'. */
#if !(__GNUC_PREREQ (2,92) || __clang_major__ >= 3)
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
# define __restrict restrict
# else
# define __restrict /* Ignore */
# endif
#endif
I used the following command to determine which STDC_VERSION was the compiler using and the result was identical for the container running in both the U16 and U22 hosts.
gcc -dM -E - < /dev/null | grep 'STDC_VERSION'
#define __STDC_VERSION__ 201112L
My question is what gives here? The main reason for containerizing this build environment was to protect it against host environment changes but seems to me that is not true here.
TIA