php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60641 PECL install lua with lua5.1 packages
Submitted: 2012-01-03 10:50 UTC Modified: 2012-01-04 12:24 UTC
From: alexjarkey at gmail dot com Assigned: laruence (profile)
Status: Closed Package: lua (PECL)
PHP Version: 5.3.8 OS: Linux Mint x64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alexjarkey at gmail dot com
New email:
PHP Version: OS:

 

 [2012-01-03 10:50 UTC] alexjarkey at gmail dot com
Description:
------------
I'm unable to install the lua extension using PECL with lua5.1 packages.

The error message I receive when running "sudo pecl install lua-0.9.1" is:

...
checking for lua support... yes, shared
checking for lua in default path... found in /usr
checking for lua library in default path... not found
configure: error: Please reinstall the lua distribution - lua library should be 
in <lua-dir>/lib/

As far as I can tell, the packages have placed the lua header files in 
/usr/include/lua5.1 
(Note that I had to "ln -s /usr/include/lua5.1/lua.h /usr/include/lua/include.h" 
to get past the header check). And the lua library seems to be in 
/usr/lib/x86_64-linux-gnu/liblua5.1.a

After examining config.m4a, I'm not sure I will be able to do the same linking 
trick with the library path, since line 31 is checking for .../{LUA_LIB_DIR}.a, 
which hasn't been defined. Should it be .../{LUA_LIB_NAME}.a?

From config.m4a:

24	  LUA_LIB_NAME=lua
25	
26	  if test -r $PHP_LUA/$PHP_LIBDIR/lib${LUA_LIB_NAME}.a; then
27	    LUA_LIB_DIR=$PHP_LUA/$PHP_LIBDIR
28	  else
29	    AC_MSG_CHECKING(for lua library in default path)
30	    for i in /usr/lib /usr/lib64; do
31	      if test -r $i/$PHP_LIBDIR/${LUA_LIB_DIR}.a; then
32	        LUA_LIB_DIR=$i
33	        AC_MSG_RESULT(found in $i)
34	        break
35	      fi
36	    done
37	  fi

Apologies if this isn't a bug and I've just missed something. Thanks for your 
help, and thanks for the hard work in making this extension!

Test script:
---------------
sudo apt-get install lua5.1 liblua5.1-0 liblua5.1-0-dev
sudo apt-get install php5-cli php5-dev php-pear

sudo pecl install lua-0.9.1

Expected result:
----------------
...
checking for lua in default path... found in /usr
checking for lua library in default path... found in /usr/x86_64-linux-gnu

Actual result:
--------------
...
checking for lua library in default path... not found
configure: error: Please reinstall the lua distribution - lua library should be 
in <lua-dir>/lib/

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-03 12:14 UTC] laruence@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: laruence
 [2012-01-03 12:14 UTC] laruence@php.net
seems to be a typo, thanks very much, and btw, could check with build after change 
the LIB_DIR to LIB_NAME?
 [2012-01-04 11:39 UTC] alexjarkey at gmail dot com
-Status: Feedback +Status: Assigned
 [2012-01-04 11:39 UTC] alexjarkey at gmail dot com
Thanks, the change has made it possible to get past the installation stage using 
PECL.

However, I still had to create the following symlinks to get it to work:

ln -s /usr/include/lua5.1/lua.h /usr/include/lua/include.h
ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.a /usr/lib/lib/lua.a

This is a bit of a workaround, since I would expect that the configure should 
just check the default directories of the lua5.1 packages.

Here are some suggestions for anyone fixing the problem in the future (i.e. if 
the header and libraries are in different directories). You will need to 
download the .tar version of the source and then run "phpize" and "./configure" 
if you modify the config.m4a.

1) Figure out what your $PHP_LIBDIR is set to. It may be "lib" or "lib64", hence 
my need to put lua.a in /usr/lib/lib :S

2) Modify lines 10 and 11 in config.m4 file to search for the header file in 
/usr/include/lua5.1/. You will also need to change the name of the file it is 
looking for from "include.h" to "lua.h". 

3) Modify line 31 in config.m4 and remove $PHP_LIBDIR/ from the path. 

4) Then "ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.a /usr/lib/lua.a" (it's still 
a good idea to alias the library since the version may change).

Obviously you need to replace the paths with the locations of your lua.h and 
lua.a files.

It would be best if the bundled config.m4 file can be modified to search there 
by default, but other versions/packages/distros may change the installed 
location so try this if you can't get it working.
 [2012-01-04 12:24 UTC] alexjarkey at gmail dot com
I just ran "make test" and all appears to be working. Thanks!






=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   45
---------------------------------------------------------------------

Number of tests :   11                11
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    0 (  0.0%) (  0.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :   11 (100.0%) (100.0%)
---------------------------------------------------------------------
Time taken      :    0 seconds
=====================================================================
 [2012-01-04 12:24 UTC] alexjarkey at gmail dot com
-Status: Assigned +Status: Closed
 [2012-01-05 17:23 UTC] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=321796
Log: Fix bug #60641	PECL install lua with lua5.1 packages
 [2013-12-05 19:16 UTC] mgraham at etsy dot com
I hit this same problem on Fedora. I tried setting LUA_DIR=/usr when running pecl install and that seemed to have no effect.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC