laruence / php-lua

This extension embeds the lua interpreter and offers an OO-API to lua variables and functions.
http://pecl.php.net/package/lua
Other
149 stars 50 forks source link

Installation fails on Ubuntu #21

Closed mickaelvieira closed 8 years ago

mickaelvieira commented 8 years ago

Hi,

I'm trying to install the extension on Ubuntu Trusty 64 and I'm getting the following error:

$ pecl install pecl/lua-1.1.0
downloading lua-1.1.0.tgz ...
Starting to download lua-1.1.0.tgz (14,896 bytes)
.....done: 14,896 bytes
9 source files, building
running: phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
building in /tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0
running: /tmp/pear/temp/lua/configure
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-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... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
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... found in /usr/local
checking for lua library in default path... found in /usr/lib
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 whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-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 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
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/bash /tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/libtool --mode=compile cc  -I. -I/tmp/pear/temp/lua -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/include -I/tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/main -I/tmp/pear/temp/lua -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/lua/lua.c -o lua.lo
libtool: compile:  cc -I. -I/tmp/pear/temp/lua -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/include -I/tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/main -I/tmp/pear/temp/lua -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/lua/lua.c  -fPIC -DPIC -o .libs/lua.o
/bin/bash /tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/libtool --mode=compile cc  -I. -I/tmp/pear/temp/lua -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/include -I/tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/main -I/tmp/pear/temp/lua -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/lua/lua_closure.c -o lua_closure.lo
libtool: compile:  cc -I. -I/tmp/pear/temp/lua -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/include -I/tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/main -I/tmp/pear/temp/lua -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/lua/lua_closure.c  -fPIC -DPIC -o .libs/lua_closure.o
/bin/bash /tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/libtool --mode=link cc -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/include -I/tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/main -I/tmp/pear/temp/lua -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -o lua.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/pear/temp/pear-build-roota89ZpL/lua-1.1.0/modules  lua.lo lua_closure.lo -llua
libtool: link: cc -shared  -fPIC -DPIC  .libs/lua.o .libs/lua_closure.o   -llua  -O2   -Wl,-soname -Wl,lua.so -o .libs/lua.so
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/liblua.a(lapi.o): relocation R_X86_64_32 against `luaO_nilobject_' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/liblua.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [lua.la] Error 1
ERROR: `make' failed

This is my current configuration:

$ lua -v
Lua 5.3.2  Copyright (C) 1994-2015 Lua.org, PUC-Rio
$ php -v
PHP 5.5.9-1ubuntu4.16 (cli) (built: Apr 20 2016 14:31:27)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

I installed lua from source as explained on the official page, run make linux install and symlinked the files in /usr/local/lib and /usr/local/include since the install script could not find the lua libraries.

Am I doing anything wrong?

Thanks for your help

laruence commented 8 years ago
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/liblua.a(lapi.o): relocation R_X86_64_32 against ````

you should recompile your lua with -fPIC thanks 
mickaelvieira commented 8 years ago

Thank you very much for your answer, this was exactly the problem.