Inside dockerfile:
docker-php-ext-install sockets
Gives these errors, on docker build (I used same dockerfile for days but today it appears this new error):
/usr/src/php/ext/sockets/sendrecvmsg.c: In function 'init_ancillary_registry':
/usr/src/php/ext/sockets/sendrecvmsg.c:128:19: error: invalid application of 'sizeof' to incomplete type 'struct cmsgcred'
128 | PUT_ENTRY(sizeof(struct cmsgcred), 0, 0, from_zval_write_ucred,
| ^~~~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:99:17: note: in definition of macro 'PUT_ENTRY'
99 | entry.size = sizev;
| ^~~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:129:36: error: 'SCM_CREDS' undeclared (first use in this function)
129 | to_zval_read_ucred, SOL_SOCKET, SCM_CREDS);
| ^~~~~~~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:105:19: note: in definition of macro 'PUT_ENTRY'
105 | key.cmsg_type = type;
| ^~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:129:36: note: each undeclared identifier is reported only once for each function it appears in
129 | to_zval_read_ucred, SOL_SOCKET, SCM_CREDS);
| ^~~~~~~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:105:19: note: in definition of macro 'PUT_ENTRY'
105 | key.cmsg_type = type;
| ^~~~
make: *** [Makefile:213: sendrecvmsg.lo] Error 1
make: *** Waiting for unfinished jobs....
2
Answers
It’s a bug in docker images php:8.0.15 and php:8.1.2 for alpine & bullseye.
The fix is pending merge, in my case i’ve stick with a previous version in order to build.
It’s being tracked here:
https://github.com/php/php-src/issues/7978
Adding to the answer posted by @user8998926
You can find several workarounds in the docker-library issue posted here: https://github.com/docker-library/php/issues/1245
The easiest being