-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on wayland #1393
Comments
Also set the environment variable SDL_VIDEODRIVER=wayland, with SDL_VIDEODRIVER=x11 this does not happen. |
What fix do you propose? I don't use Wayland, and in fact this is my first time hearing about it. There's nothing in my use or compilation of SDL2 that should explicitly cause problems with Wayland. |
It might be that you are bundling an old sdl version? I see some binary blobs here in the arc package. (Maybe they aren't even used, I just skimmed through the repo) |
No, I'm using the latest version (2.0.10). Why do you need to use Wayland? |
Hmm, then by looking at https://bugzilla.libsdl.org/buglist.cgi?no_redirect=0&quicksearch=wayland+backend it may be the use of one of those functions, but this is just a guess. Edit: nope, it seems to crash on SDL_Init, before any other call... weird
I don't really use it that often. The main reason I opened this issue is because I'm the current maintainer of the NixOS' mindustry package, and the issue popped up during a review (see link in OP). So you'd have to ask the actual users, but I guess the usual reasons for Wayland vs X apply (I'm not gonna list them here, just search it on the web, there are a lot of resources). Actually, as @petabyteboy mentioned, the issue only manifests when using SDL's Wayland backend (not default for now), so it's fairly low priority. |
There are many advantages to wayland, like improved security, performance and power efficiency, and fixes to long-standing issues like screen tearing. Please research for a bit before making such a statement.
I don't need to use wayland, but it would be nice to be able to remove the Xwayland compatibility layer from my system at some point.
I don't know the solution for now, but if you like you can assign this issue to me and I will take a closer look as I'm interested in improving wayland support in Mindustry. |
Sure, but keep in mind that working on SDL issues through Java may be... difficult. |
Closing due to inactivity. |
Not sure if I should create a new issue. I guess that would depend on your personal preference. Based on the discussion in the following thread: ValveSoftware/Dota-2#999
I would assume that all we need to do is provide an libSDL.so built with wayland support. If you can point me to the correct spot to run Mindustry using another version of libSDL.so I'll gladly test that for you. |
Replace |
Couldn't get it running using either static or dynamic loading of wayland modules. If I get to it I'll try writing a small c program to see if it works in general. |
SDL with wayland works fine in general. I've used multiple SDL-based applications that "just worked", for example the fps game xonotic. |
@petabyteboy I agree. What I'm not sure about is if the version I compiled works with wayland. SDL in general seems to work. Playing sounds is no issue. I'm not able to create a window - but that is likely unrelated as we fail on init which in turn (assuming 1 to 1 mapping) works without error in c. (linked against either system, my version SDL or the one provided by arc.) At this point I'm out of my depths. Not sure where to look next. Sorry =/ |
Are you sure this file gets loaded? I can remove it from the jar file and the game still starts up (with Xorg). I think libsdl-arc64.so is the one that needs to be replaced. |
The SDL shared library was needed at some point; that may not be the case anymore. Recompiling |
Thanks, I'm already experimenting with it. I was able to build a new libsdl-arc64 that dynamically links everything, but I could not start mindustry with it:
I will next try to build a static libSDL2 with wayland support (and then the jni binary), but this will need some more time. |
Your version of Arc/Mindustry is outdated; pull from the repo. |
Thanks, that was indeed an issue, I was using an old release jar as a base for my experiments, but built the natives from Arc master. Now I can start the game using dynamically linked libraries from my distribution when the videodriver is x11. With the wayland videodriver it still fails. First I got a NullPointerException when initializing wayland, I had to add a line to print the full stacktrace:
That's definitely some progress! |
The |
I've had issues with glew and wayland already. Namely blender archlinux and glew-wayland don't play nice atm. I didn't have time to follow it up but may help at this point: There are some points of references on the subject. For example: nigels-com/glew#172 On my system (archlinux) there exist two package: glew and glew-wayland and trying to initialize glew results in just that error : I'm guessing |
Oh I see, I will link it against a glew built with SYSTEM=linux-egl (that's the difference between the Arch packages glew and glew-wayland). Aaaand: It works! (You can see that xeyes could not detect the mouse cursor once I moved it into the mindustry window) Now let's talk about how we can make this work for everyone. There are several options:
|
For NixOS users I packaged something here: |
My personal preference is to always link against system libraries. But you're right that might generate a lot of tickets due to system incompatibilities. A nice solution would be different gradle build paths which allow static or dynamic linking? For the jar release I would for the moment stay with static libraries until we've tested a bit more using dynamic linking. |
Nice work @petabyteboy got it up and running on my system as well with the help of your patch! I have no experience building with gradle thus I can not provide a full patch. lin64.cFlags = lin64.cFlags + " " + execCmd("pkg-config --cflags glew glu gl sdl2 openal");
lin64.cppFlags = lin64.cFlags;
lin64.linkerFlags = "-shared -m64" + " " + execCmd("pkg-config --libs glew glu gl sdl2 openal");
// used by? works without for me.
// lin64.libraries = execCmd("pkg-config --libs glew glu gl sdl2 openal"); In my experience @petabyteboy could you test that? I had troubles with the configuration of the windows build path as well. So I commented these as well. @Anuken Can we split windows and linux builds as well as static and dynamic link paths? I honestly would like to provide something more substantial but without understanding gradle it seems difficult :/ |
Anuken/Arc@775feb6 makes builds only occur for the current platform by default - on Linux, only the Linux natives will be built, unless you specify
What needs to be done in order for that to happen? |
Thanks your new commits contain all the information I need, I'm preparing a PR. |
When Anuken/Arc#15 is merged, the output binaries will be statically linked by default, but with One final step would be an option to build a mindustry.jar with those dynamically linked binaries, no idea how to achieve that though. |
Thanks @petabyteboy, now I don't have to switch to X for high-resolution mindustry anymore ♥ |
close issue? |
Mostly an FYI, I still get this when running the flatpak package on archlinux in wayland without SDL_VIDEODRIVER=x11. However, I think this is an issue with the org.freedesktop.Platform runtime in flatpak. |
Hmm, looking some more, maybe not. Could it be a problem with the flatpak package itself? |
Aaand, I just tried running the 6.0 build 123.1 Jar from the release page directly with java, and still have this issue... Looking at Anuken/Arc#15 maybe I have to create a custom build? |
All we did here is linking against the system version of SDL instead of the static library provided with Arc. I don't think this ever made it into the an official release and I don't think there's a runtime switch either. Meaning that yes you have to create a custom build. |
I think we should wrap the mindustry/mindustry-wayland to set the |
Are there instruction on how to do so anywhere? |
|
Possible workaround (summarizing information above). Copy .desktop file to ~/.local/applications cp /usr/share/applications/mindustry.desktop ~/.local/share/applications Replace |
Platform: Linux (with wayland)
Build: 102
Issue:
See NixOS/nixpkgs#72306 (review) for more info
Steps to reproduce:
The text was updated successfully, but these errors were encountered: