docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.81k stars 2k forks source link

ext-sockets won't compile in official Docker image 8.3.3-fpm-alpine3.19 #1500

Closed egege closed 7 months ago

egege commented 7 months ago

Description

  1. Try creating a Docker image FROM 8.3.3-fpm-alpine3.19
  2. Include there a RUN command docker-php-ext-install sockets

Dockerfile:

FROM php:8.3.3-fpm-alpine3.19

RUN docker-php-ext-install sockets

ErrorLog:

91.24 checking whether to build shared libraries... yes
91.24 checking whether to build static libraries... no
91.26 
91.26 creating libtool
91.28 appending configuration tag "CXX" to libtool
91.30 configure: patching config.h.in
91.31 configure: creating ./config.status
91.32 config.status: creating config.h
91.33 /bin/sh /usr/src/php/ext/sockets/libtool --tag=CC --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 -D_GNU_SOURCE   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /usr/src/php/ext/sockets/sockets.c -o sockets.lo  -MMD -MF sockets.dep -MT sockets.lo
91.35 mkdir .libs
91.35  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 -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /usr/src/php/ext/sockets/sockets.c -MMD -MF sockets.dep -MT sockets.lo  -fPIC -DPIC -o .libs/sockets.o
91.55 /usr/src/php/ext/sockets/sockets.c:59:12: fatal error: linux/sock_diag.h: No such file or directory
91.55    59 | #  include <linux/sock_diag.h>
91.55       |            ^~~~~~~~~~~~~~~~~~~
91.55 compilation terminated.
91.55 make: *** [Makefile:209: sockets.lo] Error 1

PHP Version

8.3

Operating System

Alpine

egege commented 7 months ago

related links: https://github.com/php/php-src/issues/8899
https://github.com/php/php-src/issues/8681 https://github.com/php/php-src/issues/13532

tianon commented 7 months ago

See https://hub.docker.com/_/php#:~:text=Remember%2C%20you%20must%20install%20dependencies%20for%20your%20extensions%20manually. (https://github.com/docker-library/docs/tree/master/php#how-to-install-more-php-extensions):

Remember, you must install dependencies for your extensions manually.

FROM php:8.3-alpine3.19
RUN apk add --no-cache linux-headers
RUN docker-php-ext-install sockets