SFML D bindings: libsfml-system.so.2.5: cannot open shared object file:

thebluepandabear therealbluepandabear at protonmail.com
Fri Feb 3 10:15:37 UTC 2023


I recently did a fresh install of CSFML and I am getting this 
errors when running my csfml D bindings program:

```
object.Exception at source/app.d(38): Fatal error(s) encountered 
whilst calling `loadSFML()` function:
  ["Error: libcsfml-system.so, Message: libsfml-system.so.2.5: 
cannot open shared object file: No such file or directory",
  "Error: libcsfml-system.so.2, Message: libcsfml-system.so.2: 
cannot open shared object file: No such file or directory",
"Error: libcsfml-system.so.2.0, Message: libcsfml-system.so.2.0: 
cannot open shared object file: No such file or directory"]
```

I am using SFML D bindings 
(https://github.com/BindBC/bindbc-sfml):

```D
void loadDyn() {
	if (!loadSFML()) {
		string[] messages;

		foreach (const(ErrorInfo) err; errors) {
			string errorStr = to!string(err.error);
			string messageStr = to!string(err.message);

			messages ~= format("Error: %s, Message: %s", errorStr, 
messageStr);
		}

		throw new Exception(format("Fatal error(s) encountered whilst 
calling `loadSFML()` function: %s", messages));
	}
}

void main() {
	loadDyn();

	sfRenderWindow* renderWindow = 
sfRenderWindow_create(sfVideoMode(500, 500), "Snake Smooth 
Dynamics", sfWindowStyle.sfDefaultStyle, null);
	sfEvent event;

	while (renderWindow.sfRenderWindow_isOpen()) {
		while (renderWindow.sfRenderWindow_pollEvent(&event)) {
			if (event.type == sfEventType.sfEvtClosed) {
				renderWindow.sfRenderWindow_close();
			}
		}

		renderWindow.sfRenderWindow_clear(sfYellow);
		renderWindow.sfRenderWindow_drawSprite(snakeHeadSprite, null);
		renderWindow.sfRenderWindow_display();
	}
}
```

Things I've tried:

- I found someone with a similar question: 
https://stackoverflow.com/questions/41516065/linux-sfml-cannot-open-shared-object-file, tried out some answers but to no avail

- I tried to `sudo apt purge` every CSFML dependency (graphics, 
audo, etc) and reinstall each component (`csfml-audio`, 
`csfml-graphics`) manually etc, to no avail.

- I tried to run `sudo ldconfig`... didn't work

- As a last ditch effort I tried to manually move the shared 
object files to the `/usr/local/lib` directory (to try and 
perhaps trick the compiler to run the program?) but to no avail.

- I tried to run on a new VM and still didn't work

- I tried to set `LD_LIBRARY_PATH` environment variable

The amount of layers I depend on make it impossible to find where 
the bug is from, there are a lot of separate things going on and 
it's very multilayered, I don't know where the issue is 
specifically coming from as it used to work just fine I ran the 
exact same commands to install CSFML previously,  now when I do 
it it just refuses to run.
The weird thing is when I ran a brand new virtual machine, 
installed those packages, still same issue.

I am running Linux Mint 21.1, Ubuntu based. Relatively new PC.

Help would be appreciated.



More information about the Digitalmars-d-learn mailing list