## Having an issue with share dobject files.

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.
DOMINOSRULZ
Prole
Posts: 5
Joined: Mon Jul 27, 2020 3:18 am

### Having an issue with share dobject files.

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
Attachments
bot_touchscreen_demo.love
My love file
(2.45 MiB) Downloaded 87 times
Image of error
Screenshot from 2022-03-12 15-53-59.png (30.46 KiB) Viewed 2939 times
zorg
Party member
Posts: 3282
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

### Re: Having an issue with share dobject files.

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.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
DOMINOSRULZ
Prole
Posts: 5
Joined: Mon Jul 27, 2020 3:18 am

### Re: Having an issue with share dobject files.

Is there a psuedocode or code example you could give? I have actually tried doing the first solution, but to no avail.
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

### Re: Having an issue with share dobject files.

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.

Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
DOMINOSRULZ
Prole
Posts: 5
Joined: Mon Jul 27, 2020 3:18 am

### Re: Having an issue with share dobject files.

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

ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

### Re: Having an issue with share dobject files.

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.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
DOMINOSRULZ
Prole
Posts: 5
Joined: Mon Jul 27, 2020 3:18 am

### Re: Having an issue with share dobject files.

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?

### Who is online

Users browsing this forum: No registered users and 125 guests