Page 1 of 1

Having an issue with share dobject files.

Posted: Wed Mar 23, 2022 9:24 am
by DOMINOSRULZ
Hello,

I am working on a simple Love2D game, and I am using a library called tove. It implements SVG graphics for Love2D. However, when I try to run the game after converting everything into a love file, I get an error saying the I cannot open the shared object file, because it is not a directory.

I have already tried doing some techniques with love.filesystem, but to no avail. I am at my wits end. I have attached my love file, and image of the error so someone can figure out why it's spitting at me.

I will also link the library I used: https://poke1024.github.io/tove2d/tutor ... stallation

Re: Having an issue with share dobject files.

Posted: Wed Mar 23, 2022 8:33 pm
by zorg
so and dll files can't be included from inside the .love file; either copy them over to the save directory, and load them from there, or if you package your project (into an exe), you can also mount the sourceBaseDirectory, where said exe file is, and have the so/dll file next to them; i believe that might work too; in any case, the first solution's probably simpler.

Re: Having an issue with share dobject files.

Posted: Thu Mar 24, 2022 1:52 am
by DOMINOSRULZ
Is there a psuedocode or code example you could give? I have actually tried doing the first solution, but to no avail.

Re: Having an issue with share dobject files.

Posted: Thu Mar 24, 2022 5:22 am
by ReFreezed
Something like this:

Code: Select all

local contents = love.filesystem.read("thefile.so") -- Read from the .love file.
love.filesystem.write("thecopy.so", contents) -- Write to save directory.
local library = require("thecopy") -- Will try to load the module from the save directory, among other places.

Re: Having an issue with share dobject files.

Posted: Thu Mar 24, 2022 6:55 am
by DOMINOSRULZ
I tried to do that, but still gives me errors:

I did it like this:

Before love.load()

Code: Select all

local c = love.filesystem.read('tove/libTove.so')
local c2 = love.filesystem.read('tove/libTove.dll')
local c3 = love.filesystem.read('tove/libTove.dylib')
local c4 = love.filesystem.read('tove/init.lua')
love.filesystem.write('lib.so',c)
love.filesystem.write('lib.dll',c2)
love.filesystem.write('lib.dylib',c3)
love.filesystem.write('startTove.lua',c4)
local tove = require('startTove') -- Local variable to get the tove folder to implement the aforementioned svg library.
In love.load():

Code: Select all

love.filesystem.setIdentity('writeDir')
Honestly, maybe the problem might be with the init,lua of the library I am using. The error mentions line 586 of init.lua, and it's this:

Code: Select all

libPath = love.filesystem.getSource() .. "/tove/" .. libName[love.system.getOS()] -- line 586
local lib = ffi.load(libPath) -- line 587

Re: Having an issue with share dobject files.

Posted: Thu Mar 24, 2022 9:00 am
by ReFreezed
Oh, yeah. That explains things. :d It looks like libTove.so isn't a Lua module, just a normal dynamic library, so that init.lua file is using ffi.load to load it instead of require(). Anyway, changing libPath to the correct path ought to solve the problem (i.e. point to love.filesystem.getSaveDirectory()).

Also, you could leave the init.lua file in the .love file together with all other Lua files. It's only the binary library file that needs to be its own file so the OS knows what's going on.

Re: Having an issue with share dobject files.

Posted: Mon Apr 18, 2022 7:28 am
by DOMINOSRULZ
Thanks! I have fixed the issue at hand, and everything is working perfectly.

i have a question. I am thinking about porting the game over to the 3DS using the lovebrew tool: https://lovebrew.org/#/

I assume that the .so shard object files will be a significant issue in the process. Is there a way to remedy this, by recompiling the source library to be compatible with the 3DS's ARM chips, or is there something more to be done?