0

I need to build lua-redis. Lua-dedis depends on luasockets. Luasockets 2.0 fail to build : my question on sockets 2.0 and lua 5.3 I was proposed to use luasockets 3.0. I make them, but they are installed into lua 5.1 and lua 5.3 still doesn't see this library:

root@debian:/home/debian/luasocket-master# make install
make -C src install
make[1]: Entering directory `/home/debian/luasocket-master/src'
install -d /usr/local/share/lua/5.1
install -m644 ltn12.lua socket.lua mime.lua /usr/local/share/lua/5.1
install -d /usr/local/share/lua/5.1/socket
install -m644 http.lua url.lua tp.lua ftp.lua headers.lua smtp.lua /usr/local/share/lua/5.1/socket
install -d /usr/local/lib/lua/5.1/socket
install socket-3.0-rc1.so /usr/local/lib/lua/5.1/socket/core.so
install -d /usr/local/lib/lua/5.1/mime
install mime-1.0.3.so /usr/local/lib/lua/5.1/mime/core.so
make[1]: Leaving directory `/home/debian/luasocket-master/src'
root@debian:/home/debian/luasocket-master# lua
Lua 5.3.2  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> require('socket')
stdin:1: module 'socket' not found:
    no field package.preload['socket']
    no file '/usr/local/share/lua/5.3/socket.lua'
    no file '/usr/local/share/lua/5.3/socket/init.lua'

How can I change target lua version?

This is not duplicate of my question regarding sockets 2.0, because it is different codebase and different problem. Sockets 2.0 fail to compile and sockets 3.0 fail to install.

Community
  • 1
  • 1
Stepan Yakovenko
  • 8,670
  • 28
  • 113
  • 206
  • 1
    Possible duplicate of [How to build luasockets for lua 5.3](http://stackoverflow.com/questions/34308217/how-to-build-luasockets-for-lua-5-3) – Kamiccolo Dec 16 '15 at 18:27
  • Trouble shooting a C build system for some random project is not usually on-topic on stackoverflow. Did you try reporting a bug with the maintainers? Or reviewing their install instructions? Glancing at the repository, they have a rockspec file, so it should be possible to install it with luarocks. – Chris Beck Dec 16 '15 at 19:15
  • Did you look at the makefile? It seems `make clean all install LUAV=5.3` or something along those lines should work. – nobody Dec 16 '15 at 19:16
  • @nobody, this solves the issue! Please put it as an answer so I can accept it! – Stepan Yakovenko Dec 16 '15 at 19:30

1 Answers1

2

A look at the Makefile reveals the following:

install-both:
    $(MAKE) clean
    @cd src; $(MAKE) $(PLAT) LUAV=5.1
    @cd src; $(MAKE) install LUAV=5.1
    $(MAKE) clean
    @cd src; $(MAKE) $(PLAT) LUAV=5.2
    @cd src; $(MAKE) install LUAV=5.2
    $(MAKE) clean
    @cd src; $(MAKE) $(PLAT) LUAV=5.3
    @cd src; $(MAKE) install LUAV=5.3

The src/Makefile uses the variable LUAV to select the include files / install paths / ….

Which means that you can also call this directly for the version you're interested in (and combine all make invocations into one):

make clean all install LUAV=5.3
nobody
  • 4,074
  • 1
  • 23
  • 33