External library on Mac OS X

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
giann
Prole
Posts: 42
Joined: Fri Jun 28, 2013 11:38 am

External library on Mac OS X

Post by giann »

I'm trying to load lrexlib into love. I put the rex_posix.so in the same folder as the main.lua.
When I launch the game I get:

Code: Select all

  Referenced from: ./rex_posix.so
  Expected in: dynamic lookup

stack traceback:
	[C]: at 0x7fff04caa140
	[C]: in function 'require'
	main.lua:2: in function 'load'
	[string "boot.lua"]:418: in function <[string "boot.lua"]:413>
	[C]: in function 'xpcall'
Any idea why ?
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: External library on Mac OS X

Post by Positive07 »

Basically your .so is not in the search directory, LÖVE expects to find binary modules in two locations, the AppData folder, or next to the love binary (I'm not sure how this is done in MacOSX, you may need to open the love.app and find the correct location, not sure)
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: External library on Mac OS X

Post by Positive07 »

Basically your .so is not in the search directory, LÖVE expects to find binary modules in two locations, the Save Directory folder, or next to the love binary (I'm not sure how this is done in MacOSX, you may need to open the love.app and find the correct location, not sure)

So you could do:

Code: Select all

love.load = function ()
    if not love.filesystem.isFile("rex_posix.so") then
         --Note that I moved the file to a folder called lib next to your main.lua
         local orig = love.filesystem.newFile("lib/rex_posix.so", "r") 
         local copy = love.filesystem.newFile("rex_posix.so", "w")

         copy:write(orig:read())
    end
end
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
giann
Prole
Posts: 42
Joined: Fri Jun 28, 2013 11:38 am

Re: External library on Mac OS X

Post by giann »

I don't think it is the problem here, since I launched loved whith the --fused option.

This is the error I get if the .so is not found:

Code: Select all

Error: main.lua:2: module 'rex_posix' not found:
	no field package.preload['rex_posix']
	no file 'rex_posix.lua' in LOVE game directories.
	no file 'rex_posix/init.lua' in LOVE game directories.
	no file 'rex_posix.so' in LOVE paths.
	no file './rex_posix.lua'
	no file '/usr/local/share/luajit-2.0.3/rex_posix.lua'
	no file '/usr/local/share/lua/5.1/rex_posix.lua'
	no file '/usr/local/share/lua/5.1/rex_posix/init.lua'
	no file './rex_posix.so'
	no file '/usr/local/lib/lua/5.1/rex_posix.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
	[C]: in function 'require'
	main.lua:2: in function 'load'
	[string "boot.lua"]:418: in function <[string "boot.lua"]:413>
	[C]: in function 'xpcall'
And the error I get otherwise (I didn't paste the whole error earlier):

Code: Select all

Error: error loading module 'lib/rex_posix' from file './lib/rex_posix.so':
	dlopen(./lib/rex_posix.so, 6): Symbol not found: _luaL_len
  Referenced from: ./lib/rex_posix.so
  Expected in: dynamic lookup

stack traceback:
	[C]: at 0x7fff04caa140
	[C]: in function 'require'
	main.lua:2: in function 'load'
	[string "boot.lua"]:418: in function <[string "boot.lua"]:413>
	[C]: in function 'xpcall'
Note that if I launch the lua interpreter and require('lib/rex_posix'), it works.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: External library on Mac OS X

Post by bartbes »

And only now did you finally post the full error, leading to a very clear solution. This library you're using is not compatible with lua 5.1/luajit. Note that this doesn't mean it can't be compiled to be compatible, it just isn't right now.
giann
Prole
Posts: 42
Joined: Fri Jun 28, 2013 11:38 am

Re: External library on Mac OS X

Post by giann »

bartbes wrote:And only now did you finally post the full error, leading to a very clear solution. This library you're using is not compatible with lua 5.1/luajit. Note that this doesn't mean it can't be compiled to be compatible, it just isn't right now.
Yeah sorry, I messed up the copy-past in my first post :(
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests