MisterDA / love-release

:love_letter: Lua script that makes LÖVE game release easier
MIT License
449 stars 27 forks source link

Error loading module 'lfs' from file #48

Closed egordorichev closed 7 years ago

egordorichev commented 7 years ago

I've reinstalled love-release, with lua 5.1.5-r4 and luarocks-2.2.0:

$ /usr/lib64/lua/luarocks/bin/love-release -W 64
{
  title = 'cga',
  package = 'cga',
  loveVersion = '0.10.2',
  version = '0.1',
  author = 'Egor Dorichev and team',
  email = 'egordorichev@gmail.com',
  description = 'Small game, made for CGA jam in 10 days',
  homepage = nil,
  identifier = 'cga',
  excludeFileList = { ''} ,
  compile = false,
  projectDirectory = '/home/egor/cga',
  releaseDirectory = '/home/egor/cga/releases',
}
/usr/bin/lua: /usr/share/lua/5.1/luarocks/loader.lua:117: error loading module 'lfs' from file '/usr/lib64/lua/luarocks/lib/lua/5.1/lfs.so':
    /usr/lib64/lua/luarocks/lib/lua/5.1/lfs.so: undefined symbol: luaL_setfuncs
stack traceback:
    [C]: in function 'a_loader'
    /usr/share/lua/5.1/luarocks/loader.lua:117: in function </usr/share/lua/5.1/luarocks/loader.lua:114>
    (tail call): ?
    [C]: in function 'require'
    ...4/lua/luarocks/share/lua/5.1/love-release/script.lua:6: in main chunk
    [C]: in function 'require'
    ...luarocks/share/lua/5.1/love-release/scripts/love.lua:5: in main chunk
    [C]: in function 'require'
    ...a/luarocks/share/lua/5.1/love-release/pipes/args.lua:103: in function 'args'
    ...b/luarocks/rocks/love-release/scm-1/bin/love-release:11: in main chunk
    [C]: ?

Script is searching for lua file system? I've manualy installed it with:

sudo luarocks install luafilesystem

Nothing changed.

$ uname -a
Linux localhost 3.18.9-gentoo #22 SMP Mon Apr 10 08:26:46 MSK 2017 x86_64 AMD A10-5700 APU with Radeon(tm) HD Graphics AuthenticAMD GNU/Linux
pablomayobre commented 7 years ago

Issue

Can you access lfs from the CLI? Enter the interactive mode by opening Lua/LuaJIT and try:

local lfs = require "lfs"
print(lfs._VERSION)

If this doesn't work then the problem is with your luarocks setup... for some reason it compiled LFS against an erroneous Lua version.

luaL_setfuncs is available in Lua 5.2 and Lua 5.3 but not in Lua 5.1, so LuaRocks may be configured with the old version of Lua you had installed and it's pointing LFS to the wrong header files.

You probably screwed your configuration by not unistalling the old Lua version properly (common mistake, since LuaRocks sucks at handling multiple Lua versions).

Fix

I recommend you uninstall ALL your Lua versions and LuaRocks versions, clear any leftover environment variable prefixed with LUA and then install Lua 5.1, LuaRocks and love-release.

As an alternative I recommend you checkout Hererocks which is the BEST way to install Lua and LuaRocks (and even multiple versions of Lua)

EDIT: Sorry I hadn't read your question right, so I edited my answer to guide you in what the problem probably is and how you could fix it.

love-release

This is not a problem with love-release but a configuration problem on the user side. This issue should be closed and probably marked as invalid.

love-release will support other Lua versions in the future but that is a separate issue ( #46 )

egordorichev commented 7 years ago

Ah, i've just solved other issue with lua, by installing lua 5.3.. Any way:

Same error.

pablomayobre commented 7 years ago

You probably are messing something up or missing something when uninstalling Lua. Probably you haven't erased all the header files, or there are still environment variables saying that you have Lua 5.3 installed.

I don't really know but it's most likely your fault. The issue doesn't belong to this repository so you should close it.

I don't know how to help you, you haven't posted any information on your setup, like what lua --version prints and what luarocks help prints in the VARIABLES and CONFIGURATION sections. You could also post LUA related environment variables, and path to common files like headers

Also even if you fix the issue now, you will probably need to uninstall love-release, LFS and luarocks and install them again, since they were installed with a wrong configuration.

Again Hererocks could fix ALL this issues! It's way simpler and it's easy to use

egordorichev commented 7 years ago

Lua:

lua -v Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio

LuaRocks:

CONFIGURATION Lua version: 5.1 Configuration files: System: /usr/local/etc/luarocks/config-5.1.lua (ok) User : /home/egor/.luarocks/config-5.1.lua (not found) VARIABLES Variables from the "variables" table of the configuration file can be overriden with VAR=VALUE assignments.

ENV:

printenv | grep LUA total: 0

pablomayobre commented 7 years ago

Can you uninstall LFS and install it again? (and probably put here the command output)

Also try to search for the header files luaconf.h lua.hpp and lauxlib.h and put the path to them over here. (Should be /usr/local/include or at LUA_INC)

Same for lua51.lib which should be at /usr/local/lib/lua/5.1 or at LUA_LIBDIR

egordorichev commented 7 years ago
sudo luarocks install luafilesystem
Installing https://rocks.moonscript.org/luafilesystem-1.6.3-2.src.rock...
Using https://rocks.moonscript.org/luafilesystem-1.6.3-2.src.rock... switching to 'build' mode
gcc -O2 -fPIC -I/usr/include -c src/lfs.c -o src/lfs.o
gcc -shared -o lfs.so -L/usr/lib64 src/lfs.o
Updating manifest for /usr/lib64/lua/luarocks/lib/luarocks/rocks
luafilesystem 1.6.3-2 is now built and installed in /usr/lib64/lua/luarocks (license: MIT/X11)
pablomayobre commented 7 years ago

Are the Lua header files in /usr/include? Does lauxlib.h expose luaL_setfuncs? Does lua.h have a LUA_VERSION field set to Lua 5.1?

Also I have no clue on why the gcc -shared -o command has a flag -L/usr/lib64 is that the directory where lua51.lib is? I'm pretty sure that the flag should be used like -L/usr/lib64/lua51.lib

egordorichev commented 7 years ago

Are the Lua header files in /usr/include?


ls -l /usr/include | grep lua

-rw-r--r-- 1 root root 1529 Jun 11 08:20 luaconf.h -rw-r--r-- 1 root root 11688 Jan 14 2012 lua.h -rw-r--r-- 1 root root 191 Dec 23 2004 lua.hpp drwxr-xr-x 2 root root 4096 Jun 11 16:40 luajit-2.0 -rw-r--r-- 1 root root 1026 Dec 27 2007 lualib.h drwxr-xr-x 2 root root 4096 Apr 12 15:15 texlua52 drwxr-xr-x 2 root root 4096 Apr 12 15:15 texluajit

> Does lauxlib.h expose luaL_setfuncs?

cat /usr/local/include/lauxlib.h | grep luaL_setfuncs

LUALIB_API void (luaL_setfuncs) (lua_State L, const luaL_Reg l, int nup); (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))

> Does lua.h have a LUA_VERSION field set to Lua 5.1?

define LUA_VERSION_MAJOR "5"

define LUA_VERSION_MINOR "3"

define LUA_VERSION_NUM 503

define LUA_VERSION_RELEASE "4"



Oops. Will fix that.
pablomayobre commented 7 years ago

You should replace all the header files with the Lua 5.1 provided ones, same with the lua51.lib file in /usr/lib64, replace it with the one you generate when compiling Lua.

egordorichev commented 7 years ago

I've isntalled it in VirtualBox onto a new machine. All works fine. That's my system problem. Thanks.