Bug #64833 [Com]: ext/sockets/sendrecvmsg.c related compilation errors

From: Date: Mon, 24 Jan 2022 17:01:20 +0000
Subject: Bug #64833 [Com]: ext/sockets/sendrecvmsg.c related compilation errors
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-239279@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64833&edit=1

 ID:                 64833
 Comment by:         peter dot e dot lind at gmail dot com
 Reported by:        clicky at erebot dot net
 Summary:            ext/sockets/sendrecvmsg.c related compilation errors
 Status:             Closed
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Debian Stretch
 PHP Version:        7.1.0alpha3
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

I am hitting this issue repeatedly for php 8.x.

I can reproduce it pretty much without issue, when using docker buildx to build the extension.

Cmdline:
DOCKER_BUILDKIT=1 docker buildx build --platform linux/amd64 -t php8.0-sockets .

Dockerfile:
FROM php:8.0-fpm-buster AS php
RUN set -eux \
    && docker-php-ext-install  \
    sockets



Error output:
/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'
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'
  entry.size   = sizev; \
                 ^~~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:129:36: error: 'SCM_CREDS' undeclared (first use in
this function); did you mean 'SCM_SRCRT'?
    to_zval_read_ucred, SOL_SOCKET, SCM_CREDS);
                                    ^~~~~~~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:105:19: note: in definition of macro 'PUT_ENTRY'
  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
    to_zval_read_ucred, SOL_SOCKET, SCM_CREDS);
                                    ^~~~~~~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:105:19: note: in definition of macro 'PUT_ENTRY'
  key.cmsg_type  = type; \
                   ^~~~
make: *** [Makefile:216: sendrecvmsg.lo] Error 1


Previous Comments:
------------------------------------------------------------------------
[2020-03-23 17:41:55] clicky at erebot dot net

I haven't been able to reproduce this in any recent release.

------------------------------------------------------------------------
[2020-03-22 04:22:09] php-bugs at lists dot php dot net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.

------------------------------------------------------------------------
[2020-03-10 09:17:13] cmb@php.net

Is this still an issue for any of the actively supported PHP
versions[1]?

[1] <https://www.php.net/supported-versions.php>

------------------------------------------------------------------------
[2017-10-16 20:32:27] peterkokot at gmail dot com

Hello, I've tried compiling PHP 7.1.10 on Debian 9 and it goes through without any patches
required so far. Used procedure:
./configure --disable-all --enable-sockets=shared
make

I believe the compilation issues have been fixed in the mentioned problematic file and got into PHP
7.1.x release:
https://github.com/php/php-src/commits/master/ext/sockets/conversions.c

I believe we can close this issue since also according to some Docker images based on Debian 8 and 9
the compilation goes through ok. In case the issue is still relevant, you we can reopen this ticket
anytime anyway. Thanks.

------------------------------------------------------------------------
[2016-07-11 15:21:12] clicky at erebot dot net

Now I'm seeing errors like this one when compiling PHP 7.1.0alpha3:

In file included from /usr/include/rpc/netdb.h:42:0,
                 from /usr/include/netdb.h:32,
                 from .../phpfarm/src/php-7.1.0alpha3-debug/main/php_network.h:79,
                 from .../phpfarm/src/php-7.1.0alpha3-debug/ext/sockets/sockaddr_conv.h:4,
                 from .../phpfarm/src/php-7.1.0alpha3-debug/ext/sockets/conversions.c:1:
.../phpfarm/src/php-7.1.0alpha3-debug/ext/sockets/conversions.c:1291:47: error: invalid use of
undefined type ‘struct in6_pktinfo’
   {"addr", sizeof("addr"), 1, offsetof(struct in6_pktinfo, ipi6_addr),
from_zval_write_sin6_addr, to_zval_read_sin6_addr},

It seems some of the structures like in6_pktinfo (from netinet/in.h) and ucred (from bits/socket.h)
are not exposed in glibc headers anymore (at least with glibc 2.22) unless -D_GNU_SOURCE is used in
the CFLAGS.  That's because those structures are now guarded with the _USE_GNU preprocessor
macro.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=64833


--
Edit this bug report at https://bugs.php.net/bug.php?id=64833&edit=1


Thread (12 messages)

« previous php.bugs (#239279) next »