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

2023-02-03 Thread thebluepandabear via Digitalmars-d-learn


I have tested on arch linux and everything works fine, i'll try 
to setup a linux mint / ubuntu VM tomorrow


Thanks.

It seems like an issue with my system then. I've been stuck on it 
for a week or so, but haven't been able to find the root cause of 
the issue.





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

2023-02-03 Thread ryuukk_ via Digitalmars-d-learn

On Saturday, 4 February 2023 at 04:42:04 UTC, ryuukk_ wrote:

Are you sure you have installed the version 2.5 in your system?

Can you check in y our library folder if it's there?


Nvm, i saw your github issue, looks like you have the proper 
version


I have tested on arch linux and everything works fine, i'll try 
to setup a linux mint / ubuntu VM tomorrow


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

2023-02-03 Thread ryuukk_ via Digitalmars-d-learn

Are you sure you have installed the version 2.5 in your system?

Can you check in y our library folder if it's there?


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

2023-02-03 Thread thebluepandabear via Digitalmars-d-learn
Could someone (that uses Linux) perhaps try and emulate my bug to 
see if it's an issue with the bindings or on my system? That 
would be greatly appreciated!


Steps:

1. Open up the terminal and type in `sudo apt-get install 
libcsfml-dev`


2. Create a new D project and add the following to `dub.json`:

```
"dependencies": {
"bindbc-sfml": "~>1.0.2",
"bindbc-loader": "~>1.0.1"
},
"versions": [
"SFML_Audio",
"SFML_Graphics",
"SFML_250"
],
```

3. Add the following code to `app.d`:

```D
import std.stdio;
import bindbc.sfml;
import std.string;
import std.exception;
import bindbc.loader;
import std.conv;

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_display();
}
}
```

It should only take around 2-3 minutes.

Regards,
thebluepandabear




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

2023-02-03 Thread thebluepandabear via Digitalmars-d-learn

On Friday, 3 February 2023 at 19:44:07 UTC, bachmeier wrote:
On Friday, 3 February 2023 at 12:23:40 UTC, thebluepandabear 
wrote:
On Friday, 3 February 2023 at 11:43:46 UTC, thebluepandabear 
wrote:

On Friday, 3 February 2023 at 11:37:43 UTC, bachmeier wrote:
On Friday, 3 February 2023 at 10:15:37 UTC, thebluepandabear 
wrote:
I recently did a fresh install of CSFML and I am getting 
this errors when running my csfml D bindings program:


```
object.Exception@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"]

```


We don't have the full compilation and loading details, but 
this part of the message seems unusual:



"Error: libcsfml-system.so, Message: libsfml-system.so.2.5


One is `libcsfml` and the other is `libsfml`.


Hi,

It seems like it has changed since then, I am _no longer_ 
getting those conflicting errors, it's just 'libcsfml' for 
both instances.


I am thinking of compiling CSFML from scratch to see if it 
will help, but I'd rather not since it seems complex.


Furthermore, I would like to thank you for bringing up the 
compilation/loading details up. I'll send a snippet of that 
if I can figure out how to do so.


nvm, im getting that error again


It might be a bug in bindbc-sfml. The code is here: 
https://github.com/BindBC/bindbc-sfml/blob/master/source/bindbc/sfml/system.d#L231 Unbuntu stores the file in /usr/lib/x86_64-linux-gnu/libcsfml-system.so.2.5. Maybe the compiler doesn't know to look in /usr/lib/x86_64-linux-gnu.


I sent an issue request to bindbc-sfml and they could not 
reproduce my bug or figure out why it was happening, but I 
wouldn't be surprised if it is a bug.


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

2023-02-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 February 2023 at 12:23:40 UTC, thebluepandabear 
wrote:
On Friday, 3 February 2023 at 11:43:46 UTC, thebluepandabear 
wrote:

On Friday, 3 February 2023 at 11:37:43 UTC, bachmeier wrote:
On Friday, 3 February 2023 at 10:15:37 UTC, thebluepandabear 
wrote:
I recently did a fresh install of CSFML and I am getting 
this errors when running my csfml D bindings program:


```
object.Exception@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"]

```


We don't have the full compilation and loading details, but 
this part of the message seems unusual:



"Error: libcsfml-system.so, Message: libsfml-system.so.2.5


One is `libcsfml` and the other is `libsfml`.


Hi,

It seems like it has changed since then, I am _no longer_ 
getting those conflicting errors, it's just 'libcsfml' for 
both instances.


I am thinking of compiling CSFML from scratch to see if it 
will help, but I'd rather not since it seems complex.


Furthermore, I would like to thank you for bringing up the 
compilation/loading details up. I'll send a snippet of that if 
I can figure out how to do so.


nvm, im getting that error again


It might be a bug in bindbc-sfml. The code is here: 
https://github.com/BindBC/bindbc-sfml/blob/master/source/bindbc/sfml/system.d#L231 Unbuntu stores the file in /usr/lib/x86_64-linux-gnu/libcsfml-system.so.2.5. Maybe the compiler doesn't know to look in /usr/lib/x86_64-linux-gnu.


Re: Logging logs in Windows

2023-02-03 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn

On 04/02/2023 6:55 AM, Alexander Zhirov wrote:
On Friday, 3 February 2023 at 16:00:55 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
Yes syslog is not available on Windows as that is a Posix API. All of 
your calls to syslog should be guarded by a version for Posix.


Is there an analogue for Windows? And is it possible to implement it 
with the similarity of directives, as in C?


The analogue is the Windows Event Log and its not 1:1.

Here is a starting point that I myself have used in the past:

https://github.com/php/php-src/blob/master/win32/wsyslog.c


Re: Logging logs in Windows

2023-02-03 Thread Alexander Zhirov via Digitalmars-d-learn
On Friday, 3 February 2023 at 16:00:55 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
Yes syslog is not available on Windows as that is a Posix API. 
All of your calls to syslog should be guarded by a version for 
Posix.


Is there an analogue for Windows? And is it possible to implement 
it with the similarity of directives, as in C?


Re: Are there some helpers in Phobos equivalent to std::set_difference of ugly c++

2023-02-03 Thread Ali Çehreli via Digitalmars-d-learn

On 2/3/23 09:11, Ali Çehreli wrote:


'fold' is


Ha ha! :) Make that 'reduce' of course.

Ali



Re: Are there some helpers in Phobos equivalent to std::set_difference of ugly c++

2023-02-03 Thread Ali Çehreli via Digitalmars-d-learn

On 2/3/23 08:01, Richard (Rikki) Andrew Cattermole wrote:

All good, I'm glad it'll work for you :)

I used the word difference to search the phobos docs with.


'fold' is doing much better in that department because it mentions other 
names: "Implements the homonym function (also known as accumulate, 
compress, inject, or foldl) present in various programming languages of 
functional flavor."


  https://dlang.org/library/std/algorithm/iteration/reduce.html

Ali



Re: Are there some helpers in Phobos equivalent to std::set_difference of ugly c++

2023-02-03 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn

All good, I'm glad it'll work for you :)

I used the word difference to search the phobos docs with.


Re: Logging logs in Windows

2023-02-03 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Yes syslog is not available on Windows as that is a Posix API. All of 
your calls to syslog should be guarded by a version for Posix.


The Windows Event Log which is comparable, isn't 1:1 so its a bit of a 
task to replace it.


Re: Are there some helpers in Phobos equivalent to std::set_difference of ugly c++

2023-02-03 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 3 February 2023 at 15:53:35 UTC, Richard (Rikki) 
Andrew Cattermole wrote:

```d
import std.stdio, std.algorithm.setops, std.array;

void main() {
int[] v1 = [1, 2, 5, 5, 5, 9];
int[] v2 = [2, 5, 7];
int[] v3 = setDifference(v1, v2).array;

writefln!"%s \\ %s = %s"(v1, v2, v3);
}
```

[1, 2, 5, 5, 5, 9] \ [2, 5, 7] = [1, 5, 5, 9]


Thank you very much. I am surprised that I couldn't find it using 
many keywords on the site and google.


Re: Are there some helpers in Phobos equivalent to std::set_difference of ugly c++

2023-02-03 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn

```d
import std.stdio, std.algorithm.setops, std.array;

void main() {
int[] v1 = [1, 2, 5, 5, 5, 9];
int[] v2 = [2, 5, 7];
int[] v3 = setDifference(v1, v2).array;

writefln!"%s \\ %s = %s"(v1, v2, v3);
}
```

[1, 2, 5, 5, 5, 9] \ [2, 5, 7] = [1, 5, 5, 9]


Logging logs in Windows

2023-02-03 Thread Alexander Zhirov via Digitalmars-d-learn
I wrote a small utility in Linux. I want to build it for Windows. 
He swears at some parts of the code like this:


```powershell
C:\sources\pxe-restore>dub build -b release
Starting Performing "release" build using dmd for x86_64.
Building pxe-restore ~master: building configuration 
[application]
source\azh\log.d(3,8): Error: module `core.sys.posix.syslog` 
import `syslog` not found
source\azh\query.d(7,8): Error: module `core.sys.posix.syslog` 
import `LOG_NOTICE` not found
source\azh\query.d(7,8): Error: module `core.sys.posix.syslog` 
import `LOG_ERR` not found
source\azh\query.d(7,8): Error: module `core.sys.posix.syslog` 
import `LOG_INFO` not found
source\azh\query.d(7,8): Error: module `core.sys.posix.syslog` 
import `LOG_WARNING` not found
source\app.d(12,8): Error: module `core.sys.posix.syslog` import 
`LOG_NOTICE` not found
source\app.d(12,8): Error: module `core.sys.posix.syslog` import 
`LOG_ERR` not found
source\app.d(12,8): Error: module `core.sys.posix.syslog` import 
`LOG_INFO` not found
source\app.d(12,8): Error: module `core.sys.posix.syslog` import 
`LOG_WARNING` not found

Error dmd failed with exit code 1.
```

A small fragment of the code used:

```d
...
import core.sys.posix.syslog : LOG_NOTICE, LOG_ERR, LOG_INFO, 
LOG_WARNING;

import core.sys.posix.syslog : syslog;
...
void log(int priority, string message)
{
syslog(priority, (message ~ "\0").ptr);
}
...
```


Are there some helpers in Phobos equivalent to std::set_difference of ugly c++

2023-02-03 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
I could not find a thing doing this. And I don't want to write it 
from scratch. Getting a range as output is ok too. What I need is 
the following:


```c++
const std::vector v1{1, 2, 5, 5, 5, 9};
const std::vector v2{2, 5, 7};
std::vector diff;

std::set_difference(v1.begin(), v1.end(), v2.begin(), 
v2.end(),

std::inserter(diff, diff.begin()));
print(v1, "∖ ");
print(v2, "= ");
print(diff, "\n");

// yielding { 1 2 5 5 5 9 } ∖ { 2 5 7 } = { 1 5 5 9 }
```


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

2023-02-03 Thread thebluepandabear via Digitalmars-d-learn
On Friday, 3 February 2023 at 11:43:46 UTC, thebluepandabear 
wrote:

On Friday, 3 February 2023 at 11:37:43 UTC, bachmeier wrote:
On Friday, 3 February 2023 at 10:15:37 UTC, thebluepandabear 
wrote:
I recently did a fresh install of CSFML and I am getting this 
errors when running my csfml D bindings program:


```
object.Exception@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"]

```


We don't have the full compilation and loading details, but 
this part of the message seems unusual:



"Error: libcsfml-system.so, Message: libsfml-system.so.2.5


One is `libcsfml` and the other is `libsfml`.


Hi,

It seems like it has changed since then, I am _no longer_ 
getting those conflicting errors, it's just 'libcsfml' for both 
instances.


I am thinking of compiling CSFML from scratch to see if it will 
help, but I'd rather not since it seems complex.


Furthermore, I would like to thank you for bringing up the 
compilation/loading details up. I'll send a snippet of that if 
I can figure out how to do so.


nvm, im getting that error again


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

2023-02-03 Thread thebluepandabear via Digitalmars-d-learn

On Friday, 3 February 2023 at 11:37:43 UTC, bachmeier wrote:
On Friday, 3 February 2023 at 10:15:37 UTC, thebluepandabear 
wrote:
I recently did a fresh install of CSFML and I am getting this 
errors when running my csfml D bindings program:


```
object.Exception@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"]

```


We don't have the full compilation and loading details, but 
this part of the message seems unusual:



"Error: libcsfml-system.so, Message: libsfml-system.so.2.5


One is `libcsfml` and the other is `libsfml`.


Hi,

It seems like it has changed since then, I am _no longer_ getting 
those conflicting errors, it's just 'libcsfml' for both instances.


I am thinking of compiling CSFML from scratch to see if it will 
help, but I'd rather not since it seems complex.


Furthermore, I would like to thank you for bringing up the 
compilation/loading details up. I'll send a snippet of that if I 
can figure out how to do so.


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

2023-02-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 February 2023 at 10:15:37 UTC, thebluepandabear 
wrote:
I recently did a fresh install of CSFML and I am getting this 
errors when running my csfml D bindings program:


```
object.Exception@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"]

```


We don't have the full compilation and loading details, but this 
part of the message seems unusual:



"Error: libcsfml-system.so, Message: libsfml-system.so.2.5


One is `libcsfml` and the other is `libsfml`.


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

2023-02-03 Thread thebluepandabear via Digitalmars-d-learn
I recently did a fresh install of CSFML and I am getting this 
errors when running my csfml D bindings program:


```
object.Exception@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.