Silk.NET icon indicating copy to clipboard operation
Silk.NET copied to clipboard

Silk.NET.WebGPU can't load native library on linux-x64

Open ScottKane opened this issue 6 months ago • 0 comments

    <ItemGroup>
      <PackageReference Include="Silk.NET.WebGPU" Version="2.22.0" />
      <PackageReference Include="Silk.NET.WebGPU.Native.WGPU" Version="2.22.0" />
      <PackageReference Include="Silk.NET.Windowing.Glfw" Version="2.22.0" />
      <PackageReference Include="SixLabors.ImageSharp" Version="3.1.10" />
    </ItemGroup>
Unhandled exception. System.IO.FileNotFoundException: Could not load from any of the possible library names! Please make sure that the library is installed and in the right place!
   at Silk.NET.WebGPU.WebGPU.CreateDefaultContext(String[] n)
   at Silk.NET.WebGPU.WebGPU.GetApi()

libglfw.so.3 and libwgpu_native.so are in the output under runtimes/linux-x64/native

If I manually copy those libraries to the root it works:

<Target Name="CopyNativeLibraries" AfterTargets="Build">
        <ItemGroup>
            <NativeLibs Include="@(RuntimeTargetsCopyLocalItems)" Condition="'%(RuntimeTargetsCopyLocalItems.AssetType)' == 'native'" />
        </ItemGroup>
        <Copy SourceFiles="@(NativeLibs)" DestinationFolder="$(OutputPath)" />
    </Target>

Why is Silk trying to load the native library from the root executable path instead of the relative runtimes directory it sets up?

ScottKane avatar Jun 28 '25 12:06 ScottKane