rive-unity icon indicating copy to clipboard operation
rive-unity copied to clipboard

DllNotFoundException on .riv import under Linux

Open Faulo opened this issue 8 months ago • 10 comments

Using Unity 6000.0,47f1 in a headless Linux environment, rive version 0.3.6.

Opening this Unity project (containing an empty .riv asset): Rive Test Project.zip

During asset import, Unity logs:

Start importing Assets/empty.riv using Guid(b7e55e8308b1b8a4ba6ced37f57e1356) (ScriptedImporter)DllNotFoundException: rive assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) Rive.EmbeddedAssetDataLoader.loadEmbeddedAssetList(byte[],uintptr)
  at Rive.EmbeddedAssetDataLoader+<LoadEmbeddedAssetDataFromRiveFileBytes>d__2.MoveNext () [0x00059] in ./Library/PackageCache/app.rive.rive-unity@e17cb4de3253/Runtime/EmbeddedAssetDataLoader.cs:40 
  at Rive.AssetImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) [0x001be] in ./Library/PackageCache/app.rive.rive-unity@e17cb4de3253/Editor/AssetImporter.cs:107 
  at UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) [0x00001] in /home/bokken/build/output/unity/unity/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:25 

(Filename: ./Library/PackageCache/app.rive.rive-unity@e17cb4de3253/Runtime/EmbeddedAssetDataLoader.cs Line: 40)

The project also contains these tests to reproduce:

using NUnit.Framework;
using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;

[TestFixture("Assets/empty.riv")]
public class RiveTests {
    private readonly string path;

    public RiveTests(string path) {
        this.path = path;
    }

    [Test]
    public void TestImporterExists() {
        AssetImporter importer = AssetImporter.GetAtPath(path);

        Assert.That(importer, Is.InstanceOf<Rive.AssetImporter>(), $"Failed to load rive importer at '{path}'.");
    }

    [Test]
    public void TestImportDoesNotThrow() {
        AssetImporter.GetAtPath(path).SaveAndReimport();

        LogAssert.NoUnexpectedReceived();
    }

    [Test]
    public void TestAssetExists() {
        Object asset = AssetDatabase.LoadMainAssetAtPath(path);

        Assert.That(asset, Is.InstanceOf<Rive.Asset>(), $"Failed to load rive asset at '{path}'.");
    }
}

On Windows, all 3 tests pass, while on Linux, the first test passes, while the latter two fail with:

Unhandled log message: '[Exception] DllNotFoundException: rive assembly:<unknown assembly> type:<unknown type> member:(null)'. Use UnityEngine.TestTools.LogAssert.Expect

and

  Failed to load rive asset at 'Assets/empty.riv'.
  Expected: instance of <Rive.Asset>
  But was:  <UnityEditor.DefaultAsset>

The tests are executed with something like:

./Unity -batchmode -projectPath "Rive Test Project" -runTests -testPlatform EditMode

Stuff I tried:

  • Using Rive v0.3.7-canary.17.
  • Forcing librive.so to load via the "Load on startup" inspector flag.
  • Running Unity with the -nographics flag.
  • Other .riv assets, with more content.

Faulo avatar May 12 '25 12:05 Faulo

We recently added support for Linux when used with Vulkan. But this is happening because Rive requires a machine with a GPU. We'll need to update the Linux library to support environments without GPUs.

damzobridge avatar May 12 '25 16:05 damzobridge

I’ve run into the same issue. Based on the comment from damzobridge, I disabled the integrated GPU on my notebook and forced it to use the dedicated NVIDIA GPU. That solved the missing DLL problem — thanks for that hint!

However, the import is still not working correctly. There’s no error message, but the asset appears broken (the icon shows a corrupted graphic). I also tested with an eGPU – same result.

Just trying to narrow this down: under what conditions does the import actually work? Has this been tested on notebooks specifically?

I’m trying to avoid a last-minute fallback to UI Toolkit, so any insight would be much appreciated.

derblaettgen avatar May 13 '25 10:05 derblaettgen

Are there considerations to allow just the asset import process to work without a GPU? Such that builds could be made under headless Linux, and only required Vulkan to play?

Faulo avatar May 13 '25 10:05 Faulo

@derblaettgen are you building/working with Linux? If not, the issue you're running into might be different from this. You can also try reimporting and if that doesn't work, remove the file from the project and add it back.

Are there considerations to allow just the asset import process to work without a GPU? Such that builds could be made under headless Linux, and only required Vulkan to play?

@Faulo Yes, but we would have to build a new library that does this. We had a version of this in the past, but it looks like it might have been removed accidentally with the vulkan update. We'll let you know when we've pushed a new version that you can try.

damzobridge avatar May 13 '25 18:05 damzobridge

@damzobridge Thanks – I’ll give the remove and add approach a shot, although I’m not too hopeful since reimporting didn’t change anything.

What I’m still unclear about is what kind of machine setup the Rive import is expected to work on. In your earlier comment, you mentioned that a GPU is required – does that mean only desktop PCs with dedicated graphics or should this also work on notebooks or systems with eGPUs?

For context: I’m working on macOS but testing and building for Linux (Ubuntu 22).

Just trying to figure out the expected environment to get the import process working correctly. Thanks again!

derblaettgen avatar May 13 '25 20:05 derblaettgen

For context: I’m working on macOS but testing and building for Linux (Ubuntu 22).

Thanks for providing more info @derblaettgen . Not sure if it helps clarify things, but the current Linux library is built for Ubuntu 24.04 (x86_64) machines with Vulkan-capable GPUs, and software rendering isn't supported. While I haven't tested with eGPUs, I believe they should work as well.

Could you provide more info about your graphics settings in Unity? If you have any logs that might also help.

damzobridge avatar May 14 '25 00:05 damzobridge

Quick update:

I tried the "remove and re-add" approach, and this time I did get the missing DLL error again. So even though I had previously worked around that by forcing NVIDIA via PrimeSelect, the issue seems to resurface after a fresh import.

Some more context:

  • The test system is an older Dell XPS 9570 with a GTX 1050 Ti Mobile.
  • I also tested with an external GPU (GTX 1070) – same result.
  • Ubuntu 22.04 is required on our side due to compatibility with the target device. Upgrading to 24.04 isn't an option for us at the moment.
  • Vulkan is enabled in Unity, and the GPU is recognized correctly.
  • The project uses the Universal Render Pipeline (URP).
  • I've shared the Editor logs privately with you via the Rive Community platform.

Thanks again @damzobridge – and let me know if there’s anything else I can provide to help!

derblaettgen avatar May 14 '25 07:05 derblaettgen

@Faulo, which version of Ubuntu are you using? If 24.04, could you try v0.3.7-canary.26 and let us know if this issue is still happening there?

damzobridge avatar May 16 '25 17:05 damzobridge

Just adding this here for visibility:

In my case, the issue was caused by the Ubuntu version. Everything worked flawlessly once I switched to Ubuntu 24.04. If you're seeing similar problems, give that a try.

derblaettgen avatar May 16 '25 17:05 derblaettgen

We're running inside a Debian 12 Docker container on a Ubuntu 22.04 host. Tried v0.3.7-canary.26 (and the current -canary.36 for good measure), with no luck. Same Errors as before:

Unhandled log message:
'[Exception] DllNotFoundException: rive assembly:<unknown assembly> type:<unknown type> member:(null)'. Use UnityEngine.TestTools.LogAssert.Expect

Stack Trace:
Rive.EmbeddedAssetDataLoader+<LoadEmbeddedAssetDataFromRiveFileBytes>d__2.MoveNext () (at ./Packages/app.rive.rive-unity/Runtime/EmbeddedAssetDataLoader.cs:40)
Rive.AssetImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at ./Packages/app.rive.rive-unity/Editor/AssetImporter.cs:107)
UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at /home/bokken/build/output/unity/unity/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:25)
UnityEditor.AssetImporter:SaveAndReimport()
RiveTests:TestImportDoesNotThrow() (at Assets/Tests/RiveTests.cs:23)
System.Reflection.MethodBase:Invoke(Object, Object[])
NUnit.Framework.Internal.Reflect:InvokeMethod(MethodInfo, Object, Object[])
NUnit.Framework.Internal.MethodWrapper:Invoke(Object, Object[])
NUnit.Framework.Internal.Commands.TestMethodCommand:RunNonAsyncTestMethod(ITestExecutionContext)
NUnit.Framework.Internal.Commands.TestMethodCommand:RunTestMethod(ITestExecutionContext)
NUnit.Framework.Internal.Commands.TestMethodCommand:Execute(ITestExecutionContext)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions() (at /home/bokken/build/output/unity/unity/Editor/Mono/EditorApplication.cs:384)

Is Ubuntu 24.04 gonna be a requirement going forward?

Faulo avatar May 19 '25 14:05 Faulo