lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I recently wanted to use LuaSocket in an Amazon EC2 instance running their (recommended) distro. It didn't take long to discover that it wasn't already installed, although Lua 5.1.4 was included out of the box. Neither is luarocks, nor is there a pre-built package for it available through yum at the default repositories. So I decided to just build it from source. I easily got a zipball for the tip of master (aka 3.0-rc1 I think), added the missing Lua development headers and libraries with yum, and set out to figure out how to actually build LuaSocket.

Building it was nearly trivial, once I noticed the example make invocations in the various files named *.cmd. Following the example of linux.cmd, I used:

$ make PLAT=linux DEBUG=DEBUG LUAPREFIX_linux=/usr

It built without error. Cool. So on to installation, without which apparently make test cannot work.

$ sudo make PLAT=linux DEBUG=DEBUG LUAPREFIX_linux=/usr install-unix

That copied the needed handful of files. So all should be well, right?

$ make PLAT=linux DEBUG=DEBUG LUAPREFIX_linux=/usr test
lua: module 'socket.core' not found:
        no field package.preload['socket.core']
        no file './socket/core.lua'
        no file '/usr/share/lua/5.1/socket/core.lua'
        no file '/usr/share/lua/5.1/socket/core/init.lua'
        no file '/usr/lib64/lua/5.1/socket/core.lua'
        no file '/usr/lib64/lua/5.1/socket/core/init.lua'
        no file './socket/core.so'
        no file '/usr/lib64/lua/5.1/socket/core.so'
        no file '/usr/lib64/lua/5.1/loadall.so'
        no file './socket.so'
        no file '/usr/lib64/lua/5.1/socket.so'
        no file '/usr/lib64/lua/5.1/loadall.so'

After a little head scratching, I noticed that make install had used /usr/lib not /usr/lib64 as the destination for the .so files. I fixed that by moving them to the right spot, and it all works.

So what should I have specified to make install to get them in the right spot?

It doesn't look like the makefile as currently structured has a way to specify /usr as the root of the tree, with binaries in /usr/lib64 instead of /usr/lib.

The system is Amazon's custom distro for their EC2 instances. It identifies itself as:

$ uname -srm
Linux 3.14.48-33.39.amzn1.x86_64 x86_64

and is indeed a 64-bit platform.

--
Ross Berteig                               Ross@CheshireEng.com
Cheshire Engineering Corp.           http://www.CheshireEng.com/
+1 626 303 1602