Problem porting SFML.jl to Julia 1.1

I was very interested in porting SFML.jl (from nice work of zyedidia,
https://github.com/zyedidia/SFML.jl)
to current Julia, because it is not working for Julia 0.7 (and I like to use SFML in my programming introductory courses). I have ported all code in


(I will do a PR when it is finished).

However, while it install the package without problem, at least in my computer (after many changes), I have problem when library was loaded. I know there was a change in usage of Libdl.dlopen (https://github.com/JuliaLang/julia/issues/26557) and I think it is related but I have not idea how I could fix it. When I run the dlopen manually “julia SFML.jl”
(or do Libdl.dlopen(“libcsfml-graphics”, Libdl.RTLD_GLOBAL) in the REPL)
it is loaded nicely, however, when I try to run an example, it said:

ErrorException(“could not load library “libcsfml-system”\nlibsfml-system.so.2: cannot open shared object file: No such file or directory”)
ERROR: LoadError: error compiling Type: error compiling Type: could not load library “libcsfml-graphics”

My version of SFML is working with my previously installed SFML.
I can compiling and running programs in C++ and even Rust without problem, so the libraries are installed.

Any idea?

PS: If anyone is interested in porting it, you can say and work together :-). I think SFML.jl working could be a good example of using Julia as a general programming language.

1 Like

@scelles has already made a PR targeting Julia v0.7:

and here are some thoughts on upgrading the build system to BB2 which can provide an out of box installation experience.

Yes, I know. My changes are strongly based in scelles, and I already do more changes to the continuous integration and better Linux support (the detection of the libraries, for instance). I have also made several more changes. Thanks for send me that talk, I did not see it. I will write there.

I also think there is a lot of interest in having SFML usable with recents Julia versions. Showing that small games can be written in Julia using such a wrapper could lead people outside of technical computing to Julia.
Unfortunately my bandwidth is currently a bit limited. I can only spend some time helping to test it under differents OS (Linux, OS X and Windows)

Yes, I agree. It could be useful for showing as a general programming language. Please, could you check if in Windows or Mac there is also problem linking with the library? Thanks in advance.

OK, making progress. Now both macOS and Windows versions are working very well with BB2, and I also regenerated CSFML bindings using Clang.jl:

As for Linux, I still can’t figure out how to build the following dependencies:

  • pthread
  • opengl
  • xlib
  • xrandr
  • udev
  • freetype
  • openal
  • flac
  • vorbis

It looks like building xlib is not a trivial task, so my plan is to try a hybrid solution – directly download SFML’s official binaries(will try this tomorrow).

1 Like

Great job! Curiously I was now watching a video about BinaryBuilder :-).
I always run in Linux, so I can check in Linux, I could help you if you need it.

@dmolina @scelles you could test it now:

on Linux, we still need to manually install those dependencies, especially libopenal-dev which is unlikely preinstalled in any dists.

It is working! I had only to previous install libopenal-dev (in my Ubuntu 18.04, x64 arquitecture) and then I could install CSFML without any problem!. Later, I could run the example without any problem in Julia 1.1.

Thanks a lot!

With CSFML working, maybe we could do a new SFML package using this CSFML package/module (I say mainly to offer a OO wrapper).

It would be nice if we could resurrect SFML.jl. Shall we ping the author and revisit this?

Yes, I agree that we should resurrect SFML.jl, actually I have just write an issue


in the Github repository. If in a few days there is not response, we could send a email. In the worst scenario, we could send a new package, like SFMLv2 or similar, but it is clearly more convenience to resurrect SFML.jl.

1 Like

The author is open to the idea:

Do you have a suggestion about how it could be the best way to doing that?

Recently, the author have add to both of us as collaborators, so meanwhile we could write in the SFML.jl Github repository :+1:.

OK, I just registered LibCSFML.

2 Likes

Hey all, I am also interested in getting SFML to work on Julia 1.1. It wasn’t clear to me whether you were resurrecting it, or starting fresh with LibCSFML (sorry if it’s a noob question, am just getting my feet wet coming over from C# and python)

Hi. My idea was resurrecting it, over the LibCSFML, but the many courses this semester have made me not having time for doing that. I hope to have more time in a few days to start working on it, and any help is welcome!

I understand, I’ve been working on a project in python for 3 months and barely have a prototype working because of being busy with work and life. In case you didn’t know, I found this binding that I got working on Lubuntu:

https://github.com/JuliaMultimedia/CSFML.jl

I never got the chance to work with the SFML.jl so I dont know if it was any better, but it worked for me without too much fuss.