Search code examples
lualuajitluarocks

LuaJIT not seeing rocks installed by LuaRocks


lua -e "print(package.path)"

./?.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua;/usr/lib/lua/5.1/?.lua;/usr/lib/lua/5.1/?/init.lua

luajit -e "print(package.path)"

./?.lua;/usr/local/share/luajit-2.0.0-beta8/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua

I've tried appending lua's package.path, no dice though. LuaJIT just can't seem to find any of the rocks, it's weird. What should I do here?


Solution

  • Two suggestions:

    1. Install rocks as root to get them in /usr/local
    2. Use ldconfig to update shared library cache
    

    Example:

    e@eSammy:~$ sudo luarocks install lsqlite3
    [sudo] password for e:
    Installing http://luarocks.org/repositories/rocks/lsqlite3-0.8-1.src.rock...
    ...
    lsqlite3 0.8-1 is now built and installed in /usr/local/ (license: MIT/X11)
    e@eSammy:~$ sudo /sbin/ldconfig
    [sudo] password for e:
    e@eSammy:~$ rlwrap luajit
    LuaJIT 2.0.0-beta8 -- Copyright (C) 2005-2011 Mike Pall. http://luajit.org/
    JIT: ON CMOV SSE2 SSE3 ATOM fold cse dce fwd dse narrow loop abc fuse
    > require 'lsqlite3'
    > =sqlite3.version()
    3.7.7.1
    > os.exit()
    e@eSammy:~$