SFML.Net icon indicating copy to clipboard operation
SFML.Net copied to clipboard

Library Loading Issues

Open Haltroy opened this issue 1 year ago • 2 comments

Hi, I just started using this library and I already loved it but it has some issues on my end:

  • System.DLLNotFoundException on native libraries because the NuGet package's native libraries start with "lib" and it is trying to load those libraries without the "lib" part (trying to load 'csfml-audio' instead of 'libcsfml-audio'). I worked around it by renaming each library.
  • It is not detecting the system's libFLAC installation (libFLAC.so.12.1.0 in my case) and asks for libFLAC.so.8: instead. Resulting another DLLNotFoundException. I worked around this one as well by just copying my libFLAC to the runtimes/linux-x64/native folder and naming it accordingly. The NuGet package is missing the libFLAC.so.8 file (also on every system). I don't use FLAC audio but it is required by SFML so it creates problems.

NOTE: Installing the SFML and CSFML packages from distribution packages does fix both issues.

More Information:

  • System: Arch Linux
  • FLAC version 1.4.3
  • .NET 8.0 project
  • Using NuGet Package SFML.Audio (I only need audio for now) version 2.6.0

Haltroy avatar Jul 12 '24 14:07 Haltroy

On Linux we usually require users to install their dependencies. It seems that libFLAC.so.8 refers to FLAC 1.3.

Currently, I wouldn't want to change this, but maybe we can further document the requirements.

eXpl0it3r avatar Jul 12 '24 14:07 eXpl0it3r

I can copy the libFLAC.so file to the SFML native binaries folder on end product with no issues but the first "trying to load csfml-audio instead of libcsfml-audio" requires more changes.

My recommendations:

  • Tell the build system that builds those libraries for Linux to not put "lib" in front of them. (CMake ex.: set(CMAKE_STATIC_LIBRARY_PREFIX ""))
  • Check if OS is Linux then put "lib" in front of the library name on the this file.

Haltroy avatar Jul 17 '24 07:07 Haltroy

With SFML 3 building dependencies from source and linking them statically, I did actually change my mind.

See also #291 and https://github.com/SFML/CSFML/pull/406

eXpl0it3r avatar Sep 04 '25 11:09 eXpl0it3r