For reference, I have not worked with .NET before in any capacity. When trying to run an existing .NET project that uses SFML I get the following error:
> dotnet runUnhandled exception. System.DllNotFoundException: Unable to load shared library ‘csfml-graphics’ or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you’re using glibc, consider setting the LD_DEBUG environment variable:/home/apple/repos/Bathtub/bin/Debug/net10.0/runtimes/linux-x64/native/csfml-graphics.so: cannot open shared object file: No such file or directory/nix/store/cv2ngsd4lxhd7v5whbigfp52y13s0y95-dotnet-sdk-10.0.201/share/dotnet/shared/Microsoft.NETCore.App/10.0.5/csfml-graphics.so: cannot open shared object file: No such file or directory/home/apple/repos/Bathtub/bin/Debug/net10.0/csfml-graphics.so: cannot open shared object file: No such file or directorylibX11.so.6: cannot open shared object file: No such file or directory/nix/store/cv2ngsd4lxhd7v5whbigfp52y13s0y95-dotnet-sdk-10.0.201/share/dotnet/shared/Microsoft.NETCore.App/10.0.5/libcsfml-graphics.so: cannot open shared object file: No such file or directory/home/apple/repos/Bathtub/bin/Debug/net10.0/libcsfml-graphics.so: cannot open shared object file: No such file or directory/home/apple/repos/Bathtub/bin/Debug/net10.0/runtimes/linux-x64/native/csfml-graphics: cannot open shared object file: No such file or directory/nix/store/cv2ngsd4lxhd7v5whbigfp52y13s0y95-dotnet-sdk-10.0.201/share/dotnet/shared/Microsoft.NETCore.App/10.0.5/csfml-graphics: cannot open shared object file: No such file or directory/home/apple/repos/Bathtub/bin/Debug/net10.0/csfml-graphics: cannot open shared object file: No such file or directory/home/apple/repos/Bathtub/bin/Debug/net10.0/runtimes/linux-x64/native/libcsfml-graphics: cannot open shared object file: No such file or directory/nix/store/cv2ngsd4lxhd7v5whbigfp52y13s0y95-dotnet-sdk-10.0.201/share/dotnet/shared/Microsoft.NETCore.App/10.0.5/libcsfml-graphics: cannot open shared object file: No such file or directory/home/apple/repos/Bathtub/bin/Debug/net10.0/libcsfml-graphics: cannot open shared object file: No such file or directory
at SFML.Graphics.RenderWindow.sfRenderWindow_createUnicode(VideoMode mode, IntPtr title, Styles style, State state, ContextSettings& settings)at SFML.Graphics.RenderWindow..ctor(VideoMode mode, String title, Styles style, State state, ContextSettings settings)at SFML.Graphics.RenderWindow..ctor(VideoMode mode, String title)at Program.$(String args) in /home/apple/repos/Bathtub/Main.cs:line 6
Here is my shell.nix, which has CSFML installed:
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
mkShell rec {
nativeBuildInputs = [
dotnetCorePackages.sdk_10_0-bin
sfml
];
buildInputs = [
csfml
flac
freetype
glew
libjpeg
libvorbis
openal
udev
xorg.libXi
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXrender
xorg.xcbutilimage
];
}
And here is the .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SFML.Net" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<None Update="FreeMono.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Any help would be appreciated. It looks like the main issue is that having csfml installed in my shell.nix, isn’t actually exposing it to .NET.