PECL and lua

Problems with the Linux version of XAMPP, questions, comments, and anything related.

PECL and lua

Postby elegos » 24. April 2012 15:02

Hello!

I'm having troubles trying to install the lua extension for PHP via PECL. I've installed lua via yaourt (AUR archlinux repository) and it's installed under "/usr/include/lua/5.2/*" and "/usr/lib/liblua5.2*".

This is the output of pecl:
Code: Select all
$ which pecl
/opt/lampp/bin/pecl

$sudo pecl install lua-beta
downloading lua-0.9.4.tgz ...
Starting to download lua-0.9.4.tgz (12,617 bytes)
.....done: 12,617 bytes
8 source files, building
running: phpize
grep: /opt/lampp/include/php/main/php.h: File o directory non esistente
grep: /opt/lampp/include/php/Zend/zend_modules.h: File o directory non esistente
grep: /opt/lampp/include/php/Zend/zend_extensions.h: File o directory non esistente
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
building in /tmp/pear/temp/pear-build-rootlhSxFD/lua-0.9.4
running: /tmp/pear/temp/lua/configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/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-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /opt/lampp
checking for PHP includes... -I/opt/lampp/include/php -I/opt/lampp/include/php/main -I/opt/lampp/include/php/TSRM -I/opt/lampp/include/php/Zend -I/opt/lampp/include/php/ext -I/opt/lampp/include/php/ext/date/lib
checking for PHP extension directory... /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626
checking for PHP installed headers prefix... /opt/lampp/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for lua support... yes, shared
checking for lua in default path... not found
configure: error: Please reinstall the lua distribution - lua.h should be in <lua-dir>/include/
ERROR: `/tmp/pear/temp/lua/configure' failed


Where is exactly <lua-dir>? I tried linking the header to /usr/lib/lua.h or /usr/lib/lua/lua.h with no difference at all. I suspect that I'm missing some include dirs? But from the configure file I have to set the $PHP_LIBDIR, but it's actually void, so I suspect PECL is going to fill it runtime...

Any idea?

Thanks :)

EDIT:
Installed xampp-dev, created some symbolic links (/usr/include/lua/* -> /usr/include/lua/5.2/* and /usr/lib/liblua.a -> /usr/lib/liblua5.2.a), now I get another error:
Code: Select all
downloading lua-0.9.4.tgz ...
Starting to download lua-0.9.4.tgz (12,617 bytes)
.....done: 12,617 bytes
8 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
building in /tmp/pear/temp/pear-build-rootHgOkvF/lua-0.9.4
running: /tmp/pear/temp/lua/configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/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-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /opt/lampp
checking for PHP includes... -I/opt/lampp/include/php -I/opt/lampp/include/php/main -I/opt/lampp/include/php/TSRM -I/opt/lampp/include/php/Zend -I/opt/lampp/include/php/ext -I/opt/lampp/include/php/ext/date/lib
checking for PHP extension directory... /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626
checking for PHP installed headers prefix... /opt/lampp/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking for lua support... yes, shared
checking for lua in default path... found in /usr
checking for lua library in default path... found in /usr/lib
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
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 dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... 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

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /tmp/pear/temp/pear-build-rootHgOkvF/lua-0.9.4/libtool --mode=compile cc  -I. -I/tmp/pear/temp/lua -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootHgOkvF/lua-0.9.4/include -I/tmp/pear/temp/pear-build-rootHgOkvF/lua-0.9.4/main -I/tmp/pear/temp/lua -I/opt/lampp/include/php -I/opt/lampp/include/php/main -I/opt/lampp/include/php/TSRM -I/opt/lampp/include/php/Zend -I/opt/lampp/include/php/ext -I/opt/lampp/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/lua/lua.c -o lua.lo
mkdir .libs
 cc -I. -I/tmp/pear/temp/lua -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootHgOkvF/lua-0.9.4/include -I/tmp/pear/temp/pear-build-rootHgOkvF/lua-0.9.4/main -I/tmp/pear/temp/lua -I/opt/lampp/include/php -I/opt/lampp/include/php/main -I/opt/lampp/include/php/TSRM -I/opt/lampp/include/php/Zend -I/opt/lampp/include/php/ext -I/opt/lampp/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/lua/lua.c  -fPIC -DPIC -o .libs/lua.o
In file included from /tmp/pear/temp/lua/lua.c:28:0:
/tmp/pear/temp/lua/php_lua.h:23:17: fatal error: lua.h: File o directory non esistente
compilation terminated.
make: *** [lua.lo] Errore 1
ERROR: `make' failed



EDIT2:
After setting CFLAGS="-I/usr/include/lua" it compiled and installed:
Code: Select all
Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-rootAWSqUh/install-lua-0.9.4" install
Installing shared extensions:     /tmp/pear/temp/pear-build-rootAWSqUh/install-lua-0.9.4/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/
running: find "/tmp/pear/temp/pear-build-rootAWSqUh/install-lua-0.9.4" | xargs ls -dils
74434  0 drwxr-xr-x 3 root root    60 24 apr 16.43 /tmp/pear/temp/pear-build-rootAWSqUh/install-lua-0.9.4
74733  0 drwxr-xr-x 3 root root    60 24 apr 16.43 /tmp/pear/temp/pear-build-rootAWSqUh/install-lua-0.9.4/opt
75773  0 drwxr-xr-x 3 root root    60 24 apr 16.43 /tmp/pear/temp/pear-build-rootAWSqUh/install-lua-0.9.4/opt/lampp
77393  0 drwxr-xr-x 3 root root    60 24 apr 16.43 /tmp/pear/temp/pear-build-rootAWSqUh/install-lua-0.9.4/opt/lampp/lib
74734  0 drwxr-xr-x 3 root root    60 24 apr 16.43 /tmp/pear/temp/pear-build-rootAWSqUh/install-lua-0.9.4/opt/lampp/lib/php
76761  0 drwxr-xr-x 3 root root    60 24 apr 16.43 /tmp/pear/temp/pear-build-rootAWSqUh/install-lua-0.9.4/opt/lampp/lib/php/extensions
77394  0 drwxr-xr-x 2 root root    60 24 apr 16.43 /tmp/pear/temp/pear-build-rootAWSqUh/install-lua-0.9.4/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626
76767 44 -rwxr-xr-x 1 root root 41500 24 apr 16.43 /tmp/pear/temp/pear-build-rootAWSqUh/install-lua-0.9.4/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/lua.so

Build process completed successfully
Installing '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/lua.so'
install ok: channel://pecl.php.net/lua-0.9.4
configuration option "php_ini" is not set to php.ini location
You should add "extension=lua.so" to php.ini

I've added the line (extension=lua.so) to the php.ini file, but restarting XAMPP now I get this error:

Code: Select all
Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/lua.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/lua.so: wrong ELF class: ELFCLASS64 in Unknown on line 0


Any idea? Thanks :)

EDIT: RESOLVED!
Had to download the package, open it and change the line where it was searching the lib. I've got a 64bit version of ArchLinux and 64bit libs are stored in /usr/lib, 32bits ones in /usr/lib32. The script was looking for /usr/lib and /usr/lib64. My suggestion would be to signal the maintainer to add the LDFLAGS -L directive to search in custom folders too, or to simply add /usr/lib32 to the search string.
elegos
 
Posts: 5
Joined: 24. April 2012 14:54
XAMPP Version: 5.6.3
Operating System: Linux

Re: PECL and lua

Postby JonB » 27. April 2012 16:54

Thanks for posting the resolution. You are clearly a patient and careful debugger...

:lol:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
XAMPP Version: 1.8.3-2
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 7 guests