goodspb / pdlib

PHP extension for Dlib.
MIT License
70 stars 19 forks source link

Php 8.2 support #57

Open AIMBOT312 opened 1 year ago

AIMBOT312 commented 1 year ago

I tried to compile and install for nextcloud on Php8.2 and it didn't work properly. Please add support as the latest nextcloud betas allow using php8.2

mrmuminov commented 1 year ago

@AIMBOT312 have any news?

engels0n commented 1 year ago

That would be awesome ... I think a lot of people are waiting for that with Debian 12 now ....

andypost commented 1 year ago

I just pushed php82-pdlib package to testing Alpinelinux repo for few arches https://pkgs.alpinelinux.org/packages?name=php*pdlib&branch=edge

There's few warnings while building but it passing all tests (except online one which is skipped)

 g++ -I. -I/mnt/testing/php82-pdlib/src/pdlib-1.1.0 -I/mnt/testing/php82-pdlib/src/pdlib-1.1.0/include -I/mnt/testing/php82-pdlib/src/pdlib-1.1.0/main -I/mnt/testing/php82-pdlib/src/pdlib-1.1.0 -I/usr/include/php82 -I/usr/include/php82/main -I/usr/include/php82/TSRM -I/usr/include/php82/Zend -I/usr/include/php82/ext -I/usr/include/php82/ext/date/lib -DHAVE_CONFIG_H -Os -fstack-clash-protection -Wformat -Werror=format-security -D_GLIBCXX_ASSERTIONS=1 -fno-plt -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -DZEND_COMPILE_DL_EXT=1 -c /mnt/testing/php82-pdlib/src/pdlib-1.1.0/src/face_recognition.cc -MMD -MF src/face_recognition.dep -MT src/face_recognition.lo  -fPIC -DPIC -o src/.libs/face_recognition.o
In file included from /usr/include/php82/Zend/zend_portability.h:58,
                 from /usr/include/php82/Zend/zend_types.h:25,
                 from /usr/include/php82/Zend/zend.h:27,
                 from /usr/include/php82/main/php.h:31,
                 from /mnt/testing/php82-pdlib/src/pdlib-1.1.0/pdlib.cc:26:
/mnt/testing/php82-pdlib/src/pdlib-1.1.0/pdlib.cc: In function 'void php_face_recognition_free(zend_object*)':
/mnt/testing/php82-pdlib/src/pdlib-1.1.0/pdlib.cc:139:79: warning: 'offsetof' within non-standard-layout type 'face_recognition' {aka '_face_recognition'} is conditionally-supported [-Winvalid-offsetof]
  139 |         face_recognition *fr = (face_recognition*)((char*)object - XtOffsetOf(face_recognition, std));
/mnt/testing/php82-pdlib/src/pdlib-1.1.0/pdlib.cc:139:68: note: in expansion of macro 'XtOffsetOf'
  139 |         face_recognition *fr = (face_recognition*)((char*)object - XtOffsetOf(face_recognition, std));
      |                                                                    ^~~~~~~~~~
/mnt/testing/php82-pdlib/src/pdlib-1.1.0/pdlib.cc: In function 'zend_result zm_startup_pdlib(int, int)':
/mnt/testing/php82-pdlib/src/pdlib-1.1.0/pdlib.cc:173:59: warning: 'offsetof' within non-standard-layout type 'face_recognition' {aka '_face_recognition'} is conditionally-supported [-Winvalid-offsetof]
  173 |         face_recognition_obj_handlers.offset = XtOffsetOf(face_recognition, std);
/mnt/testing/php82-pdlib/src/pdlib-1.1.0/pdlib.cc:173:48: note: in expansion of macro 'XtOffsetOf'
  173 |         face_recognition_obj_handlers.offset = XtOffsetOf(face_recognition, std);
      |                                                ^~~~~~~~~~
In file included from /usr/include/php82/Zend/zend_portability.h:58,
                 from /usr/include/php82/Zend/zend_types.h:25,
                 from /usr/include/php82/Zend/zend.h:27,
                 from /usr/include/php82/main/php.h:31,
                 from /mnt/testing/php82-pdlib/src/pdlib-1.1.0/src/../php_pdlib.h:25,
                 from /mnt/testing/php82-pdlib/src/pdlib-1.1.0/src/face_recognition.cc:1:
/mnt/testing/php82-pdlib/src/pdlib-1.1.0/src/face_recognition.cc: In function 'face_recognition* php_face_recognition_from_obj(zend_object*)':
/mnt/testing/php82-pdlib/src/pdlib-1.1.0/src/face_recognition.cc:12:58: warning: 'offsetof' within non-standard-layout type 'face_recognition' {aka '_face_recognition'} is conditionally-supported [-Winvalid-offsetof]
   12 |     return (face_recognition*)((char*)(obj) - XtOffsetOf(face_recognition, std));
/mnt/testing/php82-pdlib/src/pdlib-1.1.0/src/face_recognition.cc:12:47: note: in expansion of macro 'XtOffsetOf'
   12 |     return (face_recognition*)((char*)(obj) - XtOffsetOf(face_recognition, std));
      |                                               ^~~~~~~~~~
loranger commented 3 months ago

@andypost I got a working pdlib thanks to you 👍🏻

For the curious, here is my dockerfile

FROM php:8.2-alpine

RUN apk add php82-pdlib --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing

WORKDIR /app
EXPOSE 80

my docker-compose

services:

  php: &php
    build:
      context: .
      dockerfile: .docker/php/Dockerfile
    env_file:
      - .env
    volumes:
      - ./:/app
      - .docker/php/conf.d:/usr/local/etc/php/conf.d
    user: "${UID:-1000}:${GID:-1000}"
    command: "php -S 0.0.0.0:80 -t /app"

and my conf.d/pdlib.ini

[pdlib]
extension="/usr/lib/php82/modules/pdlib.so"