weltling / parle

Parser and lexer for PHP
Other
82 stars 9 forks source link

0.8.3-beta: compiling error #34

Closed someson closed 1 year ago

someson commented 1 year ago

OS: Debian (docker php:8.1-fpm)

pecl or from source resulting the same:

...
#0 2.928 /bin/bash /var/www/html/parle/libtool --mode=compile g++ -I. -I/var/www/html/parle -I/var/www/html/parle/include -I/var/www/html/parle/main -I/var/www/html/parle -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/var/www/html/parle/lib/lexertl14 -I/var/www/html/parle/lib/parsertl14 -I/var/www/html/parle/lib/parle -I/var/www/html/parle/lib  -DHAVE_CONFIG_H  -g -O2   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -DZEND_COMPILE_DL_EXT=1 -c /var/www/html/parle/parle.cpp -o parle.lo  -MMD -MF parle.dep -MT parle.lo
#0 3.024 mkdir .libs
#0 3.026  g++ -I. -I/var/www/html/parle -I/var/www/html/parle/include -I/var/www/html/parle/main -I/var/www/html/parle -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/var/www/html/parle/lib/lexertl14 -I/var/www/html/parle/lib/parsertl14 -I/var/www/html/parle/lib/parle -I/var/www/html/parle/lib -DHAVE_CONFIG_H -g -O2 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -DZEND_COMPILE_DL_EXT=1 -c /var/www/html/parle/parle.cpp -MMD -MF parle.dep -MT parle.lo  -fPIC -DPIC -o .libs/parle.o
#0 3.311 In file included from /var/www/html/parle/lib/parsertl14/parsertl/rules.hpp:10,
#0 3.311                  from /var/www/html/parle/lib/parsertl14/parsertl/generator.hpp:12,
#0 3.311                  from /var/www/html/parle/parle.cpp:46:
#0 3.311 /var/www/html/parle/lib/parsertl14/parsertl/ebnf_tables.hpp:83:9: error: narrowing conversion of '-1' from 'int' to 'char' [-Wnarrowing]
#0 3.311    83 |         };
#0 3.311       |         ^
#0 3.311 /var/www/html/parle/lib/parsertl14/parsertl/ebnf_tables.hpp:89:9: error: narrowing conversion of '-3' from 'int' to 'char' [-Wnarrowing]
#0 3.311    89 |         };
#0 3.311       |         ^
#0 3.311 /var/www/html/parle/lib/parsertl14/parsertl/ebnf_tables.hpp:93:9: error: narrowing conversion of '-7' from 'int' to 'char' [-Wnarrowing]
#0 3.311    93 |         };
#0 3.311       |         ^
#0 3.311 /var/www/html/parle/lib/parsertl14/parsertl/ebnf_tables.hpp:107:9: error: narrowing conversion of '-1' from 'int' to 'char' [-Wnarrowing]
#0 3.311   107 |         };
#0 3.311       |         ^
#0 4.318 make: *** [Makefile:209: parle.lo] Error 1
BenHanson commented 1 year ago

This is already fixed with the latest parsertl14 (I switched to int8_t and uint8_t a couple of months ago).

You can fetch the new files from https://github.com/BenHanson/parsertl14/tree/master/include/parsertl

@remicollet Are you able to merge in the latest parsertl14 Remi? Anatol seems to have gone very quiet.

BenHanson commented 1 year ago

I have forked parle and updated to the latest libraries: https://github.com/BenHanson/parle

I followed the instructions at: https://pear.php.net/manual/en/pyrus.commands.build.php to build, so it should all be OK (some interfaces had changed slightly)

Let me know if this builds OK for you now.

someson commented 1 year ago

Let me know if this builds OK for you now.

Thank you! I was struggling to build it myself (even installed CLion) and got lost in errors. I'm not a CPP dev. However, there's an error in your build:


#0 3.724 In file included from /var/www/html/parle/lib/lexertl14/lexertl/parser/tokeniser/re_tokeniser.hpp:14,
#0 3.724                  from /var/www/html/parle/lib/lexertl14/lexertl/parser/parser.hpp:15,
#0 3.724                  from /var/www/html/parle/lib/lexertl14/lexertl/generator.hpp:15,
#0 3.724                  from /var/www/html/parle/parle.cpp:39:
#0 3.724 /var/www/html/parle/lib/lexertl14/lexertl/parser/tokeniser/re_tokeniser_helper.hpp:243:10: fatal error: fold2.inc: No such file or directory
#0 3.724   243 | #include "fold2.inc"
#0 3.724       |          ^~~~~~~~~~~
#0 3.724 compilation terminated.
#0 3.728 make: *** [Makefile:209: parle.lo] Error 1

trying to build in docker:

FROM php:8.1-fpm
RUN apt-get update && apt-get install -y --no-install-recommends \
    sudo git curl gcc libtool libicu-dev libonig-dev libpng-dev libxml2-dev libxslt1-dev libzip-dev zip unzip gnupg wget
RUN git clone https://github.com/BenHanson/parle.git && cd parle && phpize && ./configure && make
# ...
BenHanson commented 1 year ago

I have added the missing files.

someson commented 1 year ago

I think there are now some #include path mismatches:

#0 3.602  g++ -I. -I/var/www/html/parle -I/var/www/html/parle/include -I/var/www/html/parle/main -I/var/www/html/parle -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/var/www/html/parle/lib/lexertl14 -I/var/www/html/parle/lib/parsertl14 -I/var/www/html/parle/lib/parle -I/var/www/html/parle/lib -DHAVE_CONFIG_H -g -O2 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -DZEND_COMPILE_DL_EXT=1 -c /var/www/html/parle/parle.cpp -MMD -MF parle.dep -MT parle.lo  -fPIC -DPIC -o .libs/parle.o
#0 3.657 In file included from /var/www/html/parle/lib/parsertl14/parsertl/generator.hpp:12,
#0 3.657                  from /var/www/html/parle/parle.cpp:46:
#0 3.657 /var/www/html/parle/lib/parsertl14/parsertl/rules.hpp:12:10: fatal error: ../../../lexertl14/include/lexertl/generator.hpp: No such file or directory
#0 3.657    12 | #include "../../../lexertl14/include/lexertl/generator.hpp"
#0 3.657       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#0 3.657 compilation terminated.
#0 3.661 make: *** [Makefile:209: parle.lo] Error 1
------
failed to solve: executor failed running [/bin/sh -c git clone https://github.com/BenHanson/parle.git && cd parle && phpize --clean && phpize && ./configure && make]: exit code: 2

i think it should be

#include "../../lexertl14/lexertl/generator.hpp"

instead of


#include "../../../lexertl14/include/lexertl/generator.hpp"

3 files affected: lib/parsertl14/parsertl/rules.hpp lib/parsertl14/parsertl/match.hpp lib/parsertl14/parsertl/search.hpp

i had this start already from path fixinig as i tried to do it myself :D

BenHanson commented 1 year ago

Aha, yes the relative paths have changed.

Anatol has given me push access to the main repository, so I have merged in the latest fixes.

I'm also planning to address at least some of the other issues.

someson commented 1 year ago

it is nice to see that the package will be moving forward, thank you!