Project

Profile

Help

Bug #5856

closed

Compilation/build issue PHP 8

Added by Youri Lefers almost 2 years ago. Updated almost 2 years 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.

Actions #1

Updated by O'Neil Delpratt almost 2 years ago

  • Status changed from New to Resolved

Thank you for reporting this issue. I have applied the fix to the method name and also added the setRelocatable, setFastCompilation, setXsltCompilation and setFastCompilation to the set of available methods for the Xslt30Processor class.

We will add a note in the documentation regarding libc6 requirement for some systems.

Actions #2

Updated by Anton Davidsen almost 2 years ago

I experience the exact same issue. When are you planning a release?

Actions #3

Updated by O'Neil Delpratt almost 2 years ago

We are getting close. We will discuss release dates next week.

Actions #4

Updated by Martin Honnen almost 2 years ago

Any more concrete plans now about a 12.1 release (date)?

Actions #5

Updated by O'Neil Delpratt almost 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 12.1

Bug fixed applied in the SaxonC 12.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF