steinm / ps

Other
0 stars 2 forks source link

Will this still compile in php 8.2? #10

Closed pscheit closed 3 weeks ago

pscheit commented 4 weeks ago

Hey,

I tried to install ps in a Dockerfile, but got this error:

19.38 running: /tmp/pear/temp/ps/configure --with-php-config=/usr/local/bin/php-config --with-ps=
19.44 checking for grep that handles long lines and -e... /usr/bin/grep
19.44 checking for egrep... /usr/bin/grep -E
19.44 checking for a sed that does not truncate output... /usr/bin/sed
19.44 checking for pkg-config... /usr/bin/pkg-config
19.44 checking pkg-config is at least version 0.9.0... yes
19.44 checking for cc... cc
19.48 checking whether the C compiler works... yes
19.48 checking for C compiler default output file name... a.out
19.50 checking for suffix of executables...
19.52 checking whether we are cross compiling... no
19.53 checking for suffix of object files... o
19.54 checking whether the compiler supports GNU C... yes
19.55 checking whether cc accepts -g... yes
19.58 checking for cc option to enable C11 features... none needed
19.59 checking how to run the C preprocessor... cc -E
19.61 checking for icc... no
19.62 checking for suncc... no
19.62 checking for system library directory... lib
19.64 checking if compiler supports -Wl,-rpath,... yes
19.66 checking build system type... x86_64-pc-linux-gnu
19.66 checking host system type... x86_64-pc-linux-gnu
19.66 checking target system type... x86_64-pc-linux-gnu
19.68 checking for PHP prefix... /usr/local
19.68 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
19.68 checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20220829
19.68 checking for PHP installed headers prefix... /usr/local/include/php
19.69 checking if debug is enabled... no
19.70 checking if zts is enabled... no
19.70 checking for gawk... no
19.70 checking for nawk... nawk
19.70 checking if nawk is broken... no
19.70 checking for ps support... yes, shared
19.70 checking for pkg-config... /usr/bin/pkg-config
19.70 checking for libps... version 0.4.7
19.70 checking for GD support... yes, shared
19.71 checking for libgd... version 2.3.3
19.72 checking for a sed that does not truncate output... /usr/bin/sed
19.72 checking for ld used by cc... /usr/bin/ld
19.72 checking if the linker (/usr/bin/ld) is GNU ld... yes
19.72 checking for /usr/bin/ld option to reload object files... -r
19.72 checking for BSD-compatible nm... /usr/bin/nm -B
19.72 checking whether ln -s works... yes
19.72 checking how to recognize dependent libraries... pass_all
19.74 checking for stdio.h... yes
19.75 checking for stdlib.h... yes
19.76 checking for string.h... yes
19.77 checking for inttypes.h... yes
19.79 checking for stdint.h... yes
19.80 checking for strings.h... yes
19.82 checking for sys/stat.h... yes
19.83 checking for sys/types.h... yes
19.84 checking for unistd.h... yes
19.86 checking for dlfcn.h... yes
19.86 checking the maximum length of command line arguments... 1572864
19.89 checking command to parse /usr/bin/nm -B output from cc object... ok
19.89 checking for objdir... .libs
19.89 checking for ar... ar
19.89 checking for ranlib... ranlib
19.89 checking for strip... strip
19.93 checking if cc supports -fno-rtti -fno-exceptions... no
19.93 checking for cc option to produce PIC... -fPIC
19.94 checking if cc PIC flag -fPIC works... yes
19.97 checking if cc static flag -static works... yes
19.99 checking if cc supports -c -o file.o... yes
19.99 checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
20.00 checking whether -lc should be explicitly linked in... no
20.01 checking dynamic linker characteristics... GNU/Linux ld.so
20.01 checking how to hardcode library paths into programs... immediate
20.01 checking whether stripping libraries is possible... yes
20.01 checking if libtool supports shared libraries... yes
20.01 checking whether to build shared libraries... yes
20.01 checking whether to build static libraries... no
20.09
20.09 creating libtool
20.10 appending configuration tag "CXX" to libtool
20.13 configure: patching config.h.in
20.13 configure: creating ./config.status
20.16 config.status: creating config.h
20.17 running: make
20.18 /bin/bash /tmp/pear/temp/pear-build-defaultuser83wvJq/ps-1.4.4/libtool --tag=CC --mode=compile cc -I. -I/tmp/pear/temp/ps -I/tmp/pear/temp/pear-build-defaultuser83wvJq/ps-1.4.4/include -I/tmp/pear/temp/pear-build-defaultuser83wvJq/ps-1.4.4/main -I/tmp/pear/temp/ps -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 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/x86_64-linux-gnu  -DHAVE_CONFIG_H  -g -O2 -D_GNU_SOURCE    -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/ps/ps.c -o ps.lo  -MMD -MF ps.dep -MT ps.lo
20.22 mkdir .libs
20.22  cc -I. -I/tmp/pear/temp/ps -I/tmp/pear/temp/pear-build-defaultuser83wvJq/ps-1.4.4/include -I/tmp/pear/temp/pear-build-defaultuser83wvJq/ps-1.4.4/main -I/tmp/pear/temp/ps -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 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/x86_64-linux-gnu -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/ps/ps.c -MMD -MF ps.dep -MT ps.lo  -fPIC -DPIC -o .libs/ps.o
20.29 /tmp/pear/temp/ps/ps.c:33:10: fatal error: ext/gd/php_gd.h: No such file or directory
20.29    33 | #include "ext/gd/php_gd.h"
20.29       |          ^~~~~~~~~~~~~~~~~
20.29 compilation terminated.
20.29 make: *** [Makefile:210: ps.lo] Error 1
20.29 ERROR: `make' failed
------
failed to solve: process "/bin/sh -c pecl install -o -f redis ps && docker-php-ext-enable redis   && docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype   && docker-php-ext-install pdo pdo_mysql intl sockets gd zip" did not complete successfully: exit code: 1

My Dockerfile in a nutshell

FROM php:8.2-fpm AS phpbase

RUN docker-php-ext-install pdo pdo_mysql intl sockets gd zip

RUN apt-get install pslib-dev RUN pecl install -o -f ps

RUN docker-php-ext-configure ps --disable-gd

RUN docker-php-ext-install ps

steinm commented 3 weeks ago

Yes it still works on all recent versions of php. On debian php-dev should have the missing file.

pscheit commented 3 weeks ago

Okay, figured it out. It seems to be that I need to install gd before, so that it compiles. So need to arrange the commands a bit different:

RUN docker-php-ext-configure gd --with-freetype --with-jpeg && docker-php-ext-install pdo pdo_mysql intl sockets zip gd \
  && pecl install -o -f redis ps && docker-php-ext-enable redis ps

so do pecl install ps after docker-php-ext-install gd