Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sockets extension compilation errors #7978

Closed
devsibwarra opened this issue Jan 21, 2022 · 21 comments
Closed

sockets extension compilation errors #7978

devsibwarra opened this issue Jan 21, 2022 · 21 comments

Comments

@devsibwarra
Copy link

devsibwarra commented Jan 21, 2022

Description

Building PHP with sockets extension

Related PHP change: 51647eb

Resulted in this output:

$ docker run --rm php:8.0.15-fpm-bullseye docker-php-ext-install sockets
Configuring for:
PHP Api Version:         20200930
Zend Module Api No:      20200930
Zend Extension Api No:   420200930
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20200930
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable sockets support... yes, shared
checking for hstrerror... yes
checking for if_nametoindex... yes
checking for if_indextoname... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking netinet/tcp.h usability... yes
checking netinet/tcp.h presence... yes
checking for netinet/tcp.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking sys/sockio.h usability... no
checking sys/sockio.h presence... no
checking for sys/sockio.h... no
checking for field ss_family in struct sockaddr_storage... yes
checking if getaddrinfo supports AI_V4MAPPED... yes
checking if getaddrinfo supports AI_ALL... yes
checking if getaddrinfo supports AI_IDN... no
checking if ancillary credentials uses ucred... no
checking if ancillary credentials uses cmsgcred... no
checking for a sed that does not truncate output... /bin/sed
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
/bin/bash /usr/src/php/ext/sockets/libtool --mode=compile cc -I. -I/usr/src/php/ext/sockets -I/usr/src/php/ext/sockets/include -I/usr/src/php/ext/sockets/main -I/usr/src/php/ext/sockets -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/sockets/sockets.c -o sockets.lo
mkdir .libs
 cc -I. -I/usr/src/php/ext/sockets -I/usr/src/php/ext/sockets/include -I/usr/src/php/ext/sockets/main -I/usr/src/php/ext/sockets -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/sockets/sockets.c  -fPIC -DPIC -o .libs/sockets.o
/bin/bash /usr/src/php/ext/sockets/libtool --mode=compile cc -I. -I/usr/src/php/ext/sockets -I/usr/src/php/ext/sockets/include -I/usr/src/php/ext/sockets/main -I/usr/src/php/ext/sockets -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/sockets/multicast.c -o multicast.lo
 cc -I. -I/usr/src/php/ext/sockets -I/usr/src/php/ext/sockets/include -I/usr/src/php/ext/sockets/main -I/usr/src/php/ext/sockets -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/sockets/multicast.c  -fPIC -DPIC -o .libs/multicast.o
/bin/bash /usr/src/php/ext/sockets/libtool --mode=compile cc -I. -I/usr/src/php/ext/sockets -I/usr/src/php/ext/sockets/include -I/usr/src/php/ext/sockets/main -I/usr/src/php/ext/sockets -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/sockets/conversions.c -o conversions.lo
 cc -I. -I/usr/src/php/ext/sockets -I/usr/src/php/ext/sockets/include -I/usr/src/php/ext/sockets/main -I/usr/src/php/ext/sockets -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/sockets/conversions.c  -fPIC -DPIC -o .libs/conversions.o
/bin/bash /usr/src/php/ext/sockets/libtool --mode=compile cc -I. -I/usr/src/php/ext/sockets -I/usr/src/php/ext/sockets/include -I/usr/src/php/ext/sockets/main -I/usr/src/php/ext/sockets -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/sockets/sockaddr_conv.c -o sockaddr_conv.lo
 cc -I. -I/usr/src/php/ext/sockets -I/usr/src/php/ext/sockets/include -I/usr/src/php/ext/sockets/main -I/usr/src/php/ext/sockets -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/sockets/sockaddr_conv.c  -fPIC -DPIC -o .libs/sockaddr_conv.o
/bin/bash /usr/src/php/ext/sockets/libtool --mode=compile cc -I. -I/usr/src/php/ext/sockets -I/usr/src/php/ext/sockets/include -I/usr/src/php/ext/sockets/main -I/usr/src/php/ext/sockets -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/sockets/sendrecvmsg.c -o sendrecvmsg.lo
 cc -I. -I/usr/src/php/ext/sockets -I/usr/src/php/ext/sockets/include -I/usr/src/php/ext/sockets/main -I/usr/src/php/ext/sockets -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/sockets/sendrecvmsg.c  -fPIC -DPIC -o .libs/sendrecvmsg.o
/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:216: sendrecvmsg.lo] Error 1

Reported initially at docker-library/php#1245

PHP Version

PHP 8.0.15 / PHP 8.1.2

Operating System

Debian Bullseye / Buster, Alpine Linux 3.15

@devnexen
Copy link
Member

devnexen commented Jan 21, 2022

from the linked error report, if ucred is not detected it might be because it needs _GNU_SOURCE beforehand but the config.log message would be helpful.

@cmb69
Copy link
Member

cmb69 commented Jan 21, 2022

[…] but the config.log message would be helpful.

Indeed. Can you please provide it, @devsibwarra?

@fbaligant
Copy link

config.log file from official Docker image php:8.0.15 and docker-php-ext-install sockets

config.log

@devnexen
Copy link
Member

thanks

conftest.c:34:8: error: variable 'u' has initializer but incomplete type 34 | struct ucred u = {.gid = 0}; | ^~~~~ conftest.c:34:20: error: 'struct ucred' has no member named 'gid' 34 | struct ucred u = {.gid = 0}; | ^~~ conftest.c:34:26: warning: excess elements in struct initializer 34 | struct ucred u = {.gid = 0}; | ^ conftest.c:34:26: note: (near initialization for 'u') conftest.c:34:14: error: storage size of 'u' isn't known 34 | struct ucred u = {.gid = 0};

seems to be what I expected.

@mvorisek
Copy link
Contributor

I confirm this issue on both Alpine & Debian linux.

see https://github.com/mvorisek/image-php/runs/4899353809

DockerFile https://github.com/mvorisek/image-php/blob/2a17ab5c202704d69197310d0c6d658e410aa837/data/8.0-debian/Dockerfile

it seems it can be reproduced with very basic configuration, I wonder how this passed release testing

@devsibwarra
Copy link
Author

devsibwarra commented Jan 21, 2022

Looks like this also impacts the newly released PHP 8.1.2

php-8.1.2-config.log

@cmb69
Copy link
Member

cmb69 commented Jan 21, 2022

Could any of you please check #7981?

@zarikx
Copy link

zarikx commented Jan 21, 2022

For me it works now with patch from #7981 with php:8.0-cli-alpine and php:8.0-cli images.

@fbaligant
Copy link

Patched config.m4 from #7981 confirmed working on Docker image php:8.0.15

cmb69 added a commit that referenced this issue Jan 21, 2022
* PHP-8.0:
  Fix GH-7978: sockets extension compilation errors
@cmb69 cmb69 closed this as completed in 07aaa34 Jan 21, 2022
cmb69 added a commit that referenced this issue Jan 21, 2022
* PHP-8.1:
  Fix GH-7978: sockets extension compilation errors
@nikic
Copy link
Member

nikic commented Jan 22, 2022

We should probably set up a nightly CI job that builds on alpine. We don't pass tests with musl, but we can at least make sure it builds.

@ramsey
Copy link
Member

ramsey commented Jan 23, 2022

Also, how this passed testing, when noone can build the socket ext on at least Debian & Alpine?

Apparently, nobody cared about testing the RCs and reporting this issue.

This is why we do RCs. 😁

We need volunteers to help us test the RCs on all sorts of platforms. We don't have the resources or people to do it all.

@ramsey
Copy link
Member

ramsey commented Jan 23, 2022

I wonder if PHP 8.0 and 8.1 patch releases can be made or we need to wait 2 weeks for another standard releases.

That would rather be 4 weeks, though. Anyhow, @carusogabriel, @sgolemon, @krakjoe, @ramsey, @patrickallaert, would do you think about a patch release?

What's our protocol for this? The RC in 2 weeks is the next patch release, but I guess we could do a hotfix for 8.0.15 and 8.1.2. Would they be tagged at 8.0.16 and 8.1.3, respectively? If so, we'd need to make sure we branch from PHP-8.0.15 and PHP-8.1.2 and merge only the patch, so that the hotfix doesn't contain everything else that's been merged into PHP-8.0 or PHP-8.1.

@cmb69
Copy link
Member

cmb69 commented Jan 23, 2022

@ramsey, right. We could do 8.0.16/8.1.3 or 8.0.15pl1/8.1.3pl1 (although the latter is probably a legacy variant now). We could tag on Tuesday and release on Thursday. The question is if it is really necessary; I mean the were no security fixes, so people could stick with 8.0.14/8.1.2 for a while, if they face these build issues.

@EtienneBruines
Copy link

Also, how this passed testing, when noone can build the socket ext on at least Debian & Alpine?

Apparently, nobody cared about testing the RCs and reporting this issue.

This is why we do RCs. grin

We need volunteers to help us test the RCs on all sorts of platforms. We don't have the resources or people to do it all.

If there was an RC for those minor releases, it would be easier to do so. We are currently using the php:8.0-rc-fpm docker tag, but for the 8.0.15 release there has been no RC (at least not as a docker tag).

Which docker tag should we use to test out the latest RCs, to filter out and detect issues like these? Both 8.0-rc-fpm and rc-fpm have not been updated in a while and I could imagine that the 8.1-rc-fpm also did not include this issue?

(Can this be improved, such that the community can be a better help?)

@cmb69
Copy link
Member

cmb69 commented Jan 26, 2022

php.net does not offer Docket images; these are provided by somebody else, so please ask them to also provide images of the pre-releases.

@ramsey
Copy link
Member

ramsey commented Jan 26, 2022

As @cmb69 said, the PHP project doesn't maintain the official Docker images. They are "official" in that they are provided by Docker.

However, the PHP project does release RCs of its patch releases. These are not pushed through normal distribution channels, but it's possible to detect their releases through the feed located here: https://qa.php.net/api.php?type=qa-releases&format=json

In that feed, there are currently no RCs for any supported versions ("active": true) of PHP, so they list number as 0 in the release property for each.

We also announce patch-level RCs on the internals mailing list:

@ramsey
Copy link
Member

ramsey commented Jan 27, 2022

The docker-library/php project has merged a PR to generate images of PHP RCs, so some folks should keep an eye on that and test it out when our next RCs are tagged.

docker-library/php#1249

@julianschreiner
Copy link

Is there a temp. fix for this?

@waghanza
Copy link

docker-library/php#1245 (comment) @rlated1337

@Girgias Girgias unpinned this issue Jan 30, 2022
jakubboucek added a commit to jakubboucek/docker-lamp-devstack that referenced this issue Feb 2, 2022
jakubboucek added a commit to jakubboucek/docker-lamp-devstack that referenced this issue Feb 2, 2022
jakubboucek added a commit to jakubboucek/docker-lamp-devstack that referenced this issue Feb 12, 2022
jakubboucek added a commit to jakubboucek/docker-lamp-devstack that referenced this issue Feb 12, 2022
adam-dej added a commit to devinsolutions/docker-osticket that referenced this issue Feb 16, 2022
This can be reverted when PHP Docker image tag 8.0-fpm-alpine3.15
includes PHP >= 8.0.16.
adam-dej added a commit to devinsolutions/docker-osticket that referenced this issue Feb 21, 2022
wilfriedwolf added a commit to sandstein/docker-dev-images that referenced this issue Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

12 participants