weltling / parle

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

Compile error using 0.8.1 #15

Closed brzuchal closed 3 years ago

brzuchal commented 6 years ago

I've got compile error while trying to install using pecl version 0.8.1. I'm on Ubuntu 16.04.04 LTS

$ sudo pecl install --ignore-errors parle-0.8.1
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading parle-0.8.1.tgz ...
Starting to download parle-0.8.1.tgz (112,744 bytes)
.........................done: 112,744 bytes
58 source files, building
running: phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
building in /tmp/pear/temp/pear-build-rootkcR7qE/parle-0.8.1
running: /tmp/pear/temp/parle/configure --with-php-config=/usr/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20170718
checking for PHP installed headers prefix... /usr/include/php/20170718
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.16 (ok)
checking for gawk... gawk
checking whether to enable parle support... yes, shared
checking whether to enable internal UTF-32 support in parle... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
/tmp/pear/temp/parle/configure: line 4800: cd: ./lib: No such file or directory
/tmp/pear/temp/parle/configure: line 4862: cd: ./lib: No such file or directory
/tmp/pear/temp/parle/configure: line 4924: cd: ./lib: No such file or directory
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/bash /tmp/pear/temp/pear-build-rootkcR7qE/parle-0.8.1/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -I. -I/tmp/pear/temp/parle -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootkcR7qE/parle-0.8.1/include -I/tmp/pear/temp/pear-build-rootkcR7qE/parle-0.8.1/main -I/tmp/pear/temp/parle -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib -I/tmp/pear/temp/parle/lib/lexertl14 -I/lexertl14 -I/tmp/pear/temp/parle/lib/parsertl14 -I/parsertl14 -I/tmp/pear/temp/parle/lib/parle -I/parle -I/tmp/pear/temp/parle/lib -I/tmp/pear/temp/pear-build-rootkcR7qE/parle-0.8.1/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/parle/parle.cpp -o parle.lo
libtool: compile:  g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -I. -I/tmp/pear/temp/parle -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootkcR7qE/parle-0.8.1/include -I/tmp/pear/temp/pear-build-rootkcR7qE/parle-0.8.1/main -I/tmp/pear/temp/parle -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib -I/tmp/pear/temp/parle/lib/lexertl14 -I/lexertl14 -I/tmp/pear/temp/parle/lib/parsertl14 -I/parsertl14 -I/tmp/pear/temp/parle/lib/parle -I/parle -I/tmp/pear/temp/parle/lib -I/tmp/pear/temp/pear-build-rootkcR7qE/parle-0.8.1/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/parle/parle.cpp  -fPIC -DPIC -o .libs/parle.o
In file included from /usr/include/php/20170718/Zend/zend_types.h:27:0,
                 from /usr/include/php/20170718/Zend/zend.h:29,
                 from /usr/include/php/20170718/main/php.h:36,
                 from /tmp/pear/temp/parle/parle.cpp:54:
/usr/include/php/20170718/Zend/zend_operators.h: In function ‘zend_long zend_dval_to_lval(double)’:
/usr/include/php/20170718/main/php_config.h:2626:34: error: ‘isfinite’ was not declared in this scope
 #define zend_finite(a) isfinite(a)
                                  ^
/usr/include/php/20170718/Zend/zend_portability.h:312:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/20170718/Zend/zend_operators.h:114:18: note: in expansion of macro ‘zend_finite’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                  ^
/usr/include/php/20170718/main/php_config.h:2626:34: note: suggested alternative:
 #define zend_finite(a) isfinite(a)
                                  ^
/usr/include/php/20170718/Zend/zend_portability.h:312:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/20170718/Zend/zend_operators.h:114:18: note: in expansion of macro ‘zend_finite’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                  ^
In file included from /usr/include/c++/5/random:38:0,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /tmp/pear/temp/parle/lib/lexertl14/lexertl/generator.hpp:9,
                 from /tmp/pear/temp/parle/parle.cpp:39:
/usr/include/c++/5/cmath:601:5: note:   ‘std::isfinite’
     isfinite(_Tp __x)
     ^
In file included from /usr/include/php/20170718/Zend/zend_types.h:27:0,
                 from /usr/include/php/20170718/Zend/zend.h:29,
                 from /usr/include/php/20170718/main/php.h:36,
                 from /tmp/pear/temp/parle/parle.cpp:54:
/usr/include/php/20170718/main/php_config.h:2606:30: error: ‘isnan’ was not declared in this scope
 #define zend_isnan(a) isnan(a)
                              ^
/usr/include/php/20170718/Zend/zend_portability.h:312:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/20170718/Zend/zend_operators.h:114:48: note: in expansion of macro ‘zend_isnan’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                                                ^
/usr/include/php/20170718/main/php_config.h:2606:30: note: suggested alternative:
 #define zend_isnan(a) isnan(a)
                              ^
/usr/include/php/20170718/Zend/zend_portability.h:312:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/20170718/Zend/zend_operators.h:114:48: note: in expansion of macro ‘zend_isnan’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                                                ^
In file included from /usr/include/c++/5/random:38:0,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /tmp/pear/temp/parle/lib/lexertl14/lexertl/generator.hpp:9,
                 from /tmp/pear/temp/parle/parle.cpp:39:
/usr/include/c++/5/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /usr/include/php/20170718/Zend/zend_types.h:27:0,
                 from /usr/include/php/20170718/Zend/zend.h:29,
                 from /usr/include/php/20170718/main/php.h:36,
                 from /tmp/pear/temp/parle/parle.cpp:54:
/usr/include/php/20170718/Zend/zend_operators.h: In function ‘zend_long zend_dval_to_lval_cap(double)’:
/usr/include/php/20170718/main/php_config.h:2626:34: error: ‘isfinite’ was not declared in this scope
 #define zend_finite(a) isfinite(a)
                                  ^
/usr/include/php/20170718/Zend/zend_portability.h:312:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/20170718/Zend/zend_operators.h:125:18: note: in expansion of macro ‘zend_finite’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                  ^
/usr/include/php/20170718/main/php_config.h:2626:34: note: suggested alternative:
 #define zend_finite(a) isfinite(a)
                                  ^
/usr/include/php/20170718/Zend/zend_portability.h:312:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/20170718/Zend/zend_operators.h:125:18: note: in expansion of macro ‘zend_finite’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                  ^
In file included from /usr/include/c++/5/random:38:0,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /tmp/pear/temp/parle/lib/lexertl14/lexertl/generator.hpp:9,
                 from /tmp/pear/temp/parle/parle.cpp:39:
/usr/include/c++/5/cmath:601:5: note:   ‘std::isfinite’
     isfinite(_Tp __x)
     ^
In file included from /usr/include/php/20170718/Zend/zend_types.h:27:0,
                 from /usr/include/php/20170718/Zend/zend.h:29,
                 from /usr/include/php/20170718/main/php.h:36,
                 from /tmp/pear/temp/parle/parle.cpp:54:
/usr/include/php/20170718/main/php_config.h:2606:30: error: ‘isnan’ was not declared in this scope
 #define zend_isnan(a) isnan(a)
                              ^
/usr/include/php/20170718/Zend/zend_portability.h:312:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/20170718/Zend/zend_operators.h:125:48: note: in expansion of macro ‘zend_isnan’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                                                ^
/usr/include/php/20170718/main/php_config.h:2606:30: note: suggested alternative:
 #define zend_isnan(a) isnan(a)
                              ^
/usr/include/php/20170718/Zend/zend_portability.h:312:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^
/usr/include/php/20170718/Zend/zend_operators.h:125:48: note: in expansion of macro ‘zend_isnan’
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                                                ^
In file included from /usr/include/c++/5/random:38:0,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /tmp/pear/temp/parle/lib/lexertl14/lexertl/generator.hpp:9,
                 from /tmp/pear/temp/parle/parle.cpp:39:
/usr/include/c++/5/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
Makefile:194: polecenia dla obiektu 'parle.lo' nie powiodły się
make: *** [parle.lo] Błąd 1
ERROR: `make' failed
weltling commented 6 years ago

Thanks for the report. Seems to be a core bug with C++, see https://bugs.php.net/bug.php?id=74904

I'm working on a core fix, stay tuned.

Thanks

weltling commented 6 years ago

Hmm. The compilation doesn't fail with at least g++-5, where Travis passes. The dev goes with at least GCC 7. Which compiler is used on your side? It might be nice to fix the compilation with an older compiler, especially as the bug is in the core, but more info wouldn't be a waste.

Thanks.

gablem commented 6 years ago

I was having the same issue with PHP 7.0 under Ubuntu 16.04 using gcc 5.4.0 20160609. I managed to compile parle by making these changes to /usr/include/php/20151012/main/php_config.h

define HAVE_DECL_ISFINITE 0

define HAVE_DECL_ISNAN 0

It's the first module that I trully need to compile myself so it took me forever figuring this out. As a reminder to myself, here is how I compiled and installed Parle (with the --enable-parle-utf32 flag because I was having issues with parsing unicode otherwise):

mkdir ~/parle
cd ~/parle
sudo pecl download parle-0.8.1
tar zxvf parle-0.8.1.tgz
cd parle-0.8.1/
phpize
./configure --with-php-config=/usr/bin/php-config --enable-parle-utf32
pico /usr/include/php/20151012/main/php_config.h

Modified these two lines:

#define HAVE_DECL_ISFINITE 0
#define HAVE_DECL_ISNAN 0

Compiled the code:

make
make test
sudo make install
sudo pico /etc/php/7.0/apache2/conf.d/80-parle.ini

Inserted this:

; priority=80
extension=parle.so

Restarted Apache:

sudo service apache2 restart
weltling commented 6 years ago

@gablem thanks for the further info. I've pushed a fix to the core https://github.com/php/php-src/commit/ad790bea2e4a8a25c79ceab964601f3785cd2bf1. I'm not sure it's released already, and it depends on whether distributions would pick it up. Building against vanilla PHP should be OK anyway. Otherwise probably one has to live with this core bug :(

Thanks.

weltling commented 3 years ago

Given we're far past the point and at least 7.3 that is out there should have this patch, considering this issue not relevant anymore.

Thanks!