godot_openvr icon indicating copy to clipboard operation
godot_openvr copied to clipboard

Segfault on Linux when creating an overlay

Open Frozenreflex opened this issue 3 months ago • 4 comments

Linux Mint 22.2, trying to create an overlay/use the overlay demo causes a segfault, occurs in both C# and non-C# 4.5. I've gotten someone else to run it on Windows and it works fine. Not sure if it's specific to overlays, I haven't tested using it normally.

Running the player in Rider in C# shows... something?

Godot Engine v4.5.stable.mono.official.876b29033 - https://godotengine.org
Vulkan 1.4.305 - Forward+ - Using Device #0: AMD - AMD Radeon RX 6600 (RADV NAVI23)

OpenVR: initialising OpenVR context

Application in overlay mode.
Main OpenVR interface has been initialized
Main render models interface has been initialized.
Found HMD 0 (generic_hmd)
Found tracker 1 ({htc}vr_tracker_vive_1_0)
Found base station 2 (lh_basestation_vive)
Found base station 3 (lh_basestation_vive)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.5.stable.mono.official (876b290332ec6f2e6d173d08162a02aa7e6ca46d)
Dumping the backtrace. Please include this when reporting the bug on: https://github.com/godotengine/godot/issues
[1] /usr/lib/dotnet/shared/Microsoft.NETCore.App/9.0.9/libcoreclr.so(+0x6689cc) [0x75c901e689cc] (??:0)
[2] /usr/lib/dotnet/shared/Microsoft.NETCore.App/9.0.9/libcoreclr.so(+0x667ed5) [0x75c901e67ed5] (??:0)
[3] /lib/x86_64-linux-gnu/libc.so.6(+0x45330) [0x75c984245330] (??:0)
-- END OF C++ BACKTRACE --
================================================================
using Godot;
using System;

public partial class Test : Node
{
    private XRInterface XrInterface;
    [Export] public Node Overlay;
    public override void _EnterTree()
    {
        base._EnterTree();

        Overlay.Call("set_tracked_device_relative_position",
            Transform3D.Identity.TranslatedLocal(Vector3.Forward));
        
        var global = GetNode("/root/OpenVRInterface");

        var xrInt = global.Call("get_interface").As<XRInterface>();
        xrInt.Call("set_application_type", 2);
        xrInt.Call("set_tracking_universe", 1);

        xrInt.Call("initialize");

        XrInterface = xrInt;
    }
}

I'm using builds from my fork, but all I've done is modified the Github Actions so that I can manually build it in debug mode with debug symbols, the segfault still happens with the release binary copied over the debug binary

Frozenreflex avatar Sep 19 '25 21:09 Frozenreflex

Last time I saw this, was on an incompatible (too old) libc. Might be worth trying an older Docker base image for building for Mint 22. If I remember correctly, it trails back quite a bit compared to Ubuntu.

One thing also: You might want to initialize XR somewhere central, and before calling any other OpenVR methods (like set_tracked_device_relative_position). Especially if you want to support more than one overlay.

If that doesn't help, we might need a bit more debug traces in the backtrace, maybe by getting a call stack with debug builds for the libraries being used.

beniwtv avatar Sep 20 '25 04:09 beniwtv

Last time I saw this, was on an incompatible (too old) libc. Might be worth trying an older Docker base image for building for Mint 22. If I remember correctly, it trails back quite a bit compared to Ubuntu.

Mint 22 is based on 24.04, the Github Action uses 22.04, Mint should have a new enough libc version

If that doesn't help, we might need a bit more debug traces in the backtrace, maybe by getting a call stack with debug builds for the libraries being used.

I've been struggling to get any backtrace of any kind, but I'm also not very familiar with debugging something like this. How would I do so?

Frozenreflex avatar Sep 21 '25 20:09 Frozenreflex

I can't tell from the backtrace whether this is the immediate cause of your issue, but even if something else is going on here, you're not going to be able to get overlays working in linux at the moment. An engine patch is required, because SteamVR on linux requests vulkan extensions which aren't currently part of the list that Godot initializes: https://github.com/GodotVR/godot_openvr/pull/155#issuecomment-2773224776

I made an initial attempt to reach out to the renderer team about how to deal with this, but didn't get any replies and I haven't had time to get back to it.

vilhalmer avatar Sep 22 '25 16:09 vilhalmer

Oh, true - forgot about that. If it's with 4.5, you might run into above issue.

beniwtv avatar Sep 22 '25 17:09 beniwtv