Project

Profile

Help

Bug #5856

closed

Compilation/build issue PHP 8

Added by Youri Lefers almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Low
Category:
PHP Build
Start date:
2023-01-26
Due date:
% Done:

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
12.0
Fixed in version:
12.1
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

Description

Hi all, I'm very excited to see a new SaxonC version for PHP 8! I wanted immediately to give it a try, but ran into a small issue.

I used Docker to prepare a full build file for you guys to reproduce the issue (and maybe to give others a working example eventually). So here is the full Dockerfile that will fail to build in the make step:

# Take the latest PHP 8.1 version
FROM php:8.1-fpm

# Install additional build tools
RUN apt-get update && apt-get install -y unzip g++ make

# We need a higher GLIBC version, so install libc6
RUN echo "deb https://ftp.debian.org/debian sid main" >> /etc/apt/sources.list \
	&& apt-get update \
	&& apt-get -t sid install -y libc6 libc6-dev libc6-dbg libcrypt1

# Saxon lib envs
ENV LIBSAXON_VERSION "12.0"
ENV LIBSAXON_ARCHITECTURE "linux"
ENV LIBSAXON_DOWNLOAD_FILE_NAME "libsaxon-HEC-${LIBSAXON_ARCHITECTURE}-v${LIBSAXON_VERSION}"
ENV LD_LIBRARY_PATH "$LD_LIBRARY_PATH:/usr/lib"

# Download the setup zip, unzip it and cleanup
WORKDIR /tmp
RUN curl --insecure -sS -o libsaxon-setup.zip https://www.saxonica.com/download/$LIBSAXON_DOWNLOAD_FILE_NAME.zip \
    && unzip libsaxon-setup.zip \
    && rm libsaxon-setup.zip

# Copy the "saxon.so" to the lib dir
WORKDIR /tmp/$LIBSAXON_DOWNLOAD_FILE_NAME
RUN cp libs/nix/* /usr/lib/

# Build PHP extension, enable it and do cleanup
RUN phpize \
    && ./configure --enable-saxon \
    && make -j$(nproc) \
    && make install \
    && docker-php-ext-enable saxon \
    && rm -rf /tmp/$LIBSAXON_DOWNLOAD_FILE_NAME

WORKDIR /var/www/html

The build has a couple warnings like these:

#0 5.283 /tmp/libsaxon-HEC-linux-v12.0/Saxon.C.API/php8_XsltExecutable.cpp:773:29: warning: NULL used in arithmetic [-Wpointer-arith]
#0 5.283   773 |         if(Z_TYPE_P(val) != NULL) {
#0 5.283       |                             ^~~~

But eventually fails with the following error:

#0 5.260 In file included from /tmp/libsaxon-HEC-linux-v12.0/Saxon.C.API/php8_saxon.cpp:48:
#0 5.260 /tmp/libsaxon-HEC-linux-v12.0/Saxon.C.API/php8_Xslt30Processor.cpp: In function 'void zim_Xslt30Processor_setRelocate(zend_execute_data*, zval*)':
#0 5.260 /tmp/libsaxon-HEC-linux-v12.0/Saxon.C.API/php8_Xslt30Processor.cpp:479:26: error: 'class Xslt30Processor' has no member named 'setRelocate'; did you mean 'setRelocatable'?
#0 5.260   479 |         xslt30Processor->setRelocate(relocate);
#0 5.260       |                          ^~~~~~~~~~~
#0 5.260       |                          setRelocatable

So, it seems it is only a rename, which I fixed in the Dockerfile by renaming it:

RUN sed -i 's/setRelocate/setRelocatable/' php8_Xslt30Processor.cpp

I want to add that I had to install libc6 because it needed GLIBC_2.32 instead of the default version provided by Debian. You can see that through the second apt-get install.

Please register to edit this issue

Also available in: Atom PDF