flathub / com.mojang.Minecraft

https://flathub.org/apps/details/com.mojang.Minecraft
34 stars 13 forks source link

Launch failure "basic_string::_M_construct null not valid" #25

Closed PureTryOut closed 1 year ago

PureTryOut commented 4 years ago
▶ flatpak run com.mojang.Minecraft
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid

This error appears on my laptop running Alpine Linux. However, on my desktop running Gentoo Linux it works fine. And here I was thinking Flatpak made applications work on all the distros without additional effort... It seems to be a launcher bug?

AsciiWolf commented 4 years ago

Hmm, seems to be a bug in the launcher code. Let's see if the launcher update fixes it.

PureTryOut commented 4 years ago

Sadly it did not :cry:

I just don't understand why it would happen on one system and not on the other. Yeah the distros are entirely different, but on both systems it runs inside Flatpak. Isn't the point that it should just work?

AsciiWolf commented 4 years ago

Yep, it should work on both systems. :-/

PureTryOut commented 4 years ago

I've made a bug report upstream https://bugs.mojang.com/browse/MCL-12281

peterix commented 4 years ago

Cease doing this. You have no right to redistribute the launcher this way.

AsciiWolf commented 4 years ago

@peterix Huh? There is nothing distributed directly in the Minecraft Flatpak, it's using extra-data (the launcher is downloaded and unpacked from Mojang's source during the Flatpak installation) + there is clearly said in the AppData file that this package is unofficial.

PureTryOut commented 4 years ago

Well, it seems he realized he was in the wrong as he corrected himself on the Mojang bug tracker (on which he also said it was illegal at first).

Anyways he calls Flatpak weird and wouldn't recommend it to anyone, so we can forget getting any serious help from Mojang. I doubt he looked into it properly :man_shrugging: But this is getting offtopic.

It seems Flatpak currently isn't as distro agnostic as it advertises itself to be. I have some issues building some Flatpaks on my system as well while it works fine on my other system.

PureTryOut commented 4 years ago

Found the issue. I've compared environment variables between both systems and one the system with this issue, LC_ALL wasn't set. Running LC_ALL=C flatpak run com.mojang.Minecraft made the launcher start properly.

Is there a way to set fallback environment variables like these in the Flatpak itself?

AsciiWolf commented 4 years ago

Thanks for investigating the issue. It would probably be possible to set fallback environment variables in the game launcher script.

AsciiWolf commented 4 years ago

Similar issue as #6.

GustavoPeredo commented 4 years ago

Here is how I fixed the issue: flatpak override --user --env="LC_ALL=C" com.mojang.Minecraft Reference: https://unix.stackexchange.com/questions/559129/how-do-i-permanently-set-an-environment-variable-for-a-specific-flatpak-applicat

PureTryOut commented 4 years ago

That is good to know, thanks! However, I'd like a solution that works out of the box.

nanonyme commented 3 years ago

Note Steam app had these same issues. It's probably some specific LC_ value that helps. https://github.com/flathub/com.valvesoftware.Steam/blob/beta/com.valvesoftware.Steam.yml#L44-L50; setting LC_ALL is not a generic solution.

SystemlessDev commented 3 years ago

Note Steam app had these same issues. It's probably some specific LC_ value that helps. https://github.com/flathub/com.valvesoftware.Steam/blob/beta/com.valvesoftware.Steam.yml#L44-L50; setting LC_ALL is not a generic solution.

I don't see why we can't just set LC_ALL. In my testing it is a "generic solution".

nanonyme commented 3 years ago

If there's no localizations involved, it might be fine.

devurandom commented 3 years ago

Here is how I fixed the issue: flatpak override --user --env="LC_ALL=C" com.mojang.Minecraft Reference: https://unix.stackexchange.com/questions/559129/how-do-i-permanently-set-an-environment-variable-for-a-specific-flatpak-applicat

Thanks! This works.

Could this please be incorporated into the Flatpak itself?

AsciiWolf commented 3 years ago

Minecraft Launcher is localized and translated into many languages, the correct translation is automatically used based on environment variables, so I am not sure whether this is a good solution. @nanonyme What is your opinion about this?

nanonyme commented 3 years ago

I would suggest figuring out minimal set of LC_* to override to make a decision

erxbout commented 2 years ago

Seems like this problem still exists.. Had the same problem (running PopOs with KDE) If you do not want to start a terminal every time here is a summary of what I did:

official deb package

I use the deb package from the official website, installed it like normal and edited the .desktop file:

~/.local/share/applications/minecraft-launcher.desktop

if you replace the line

Exec=minecraft-launcher

with

Exec=export LC_ALL=C && minecraft-launcher

its working fine and you can start minecraft from your application launcher just like normal

flatpak

using flatpak the desktop file is located here:

~/.local/share/flatpak/exports/share/applications/com.mojang.Minecraft.desktop

and you can add --env="LC_ALL=C" to the Exec line like this

Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --env="LC_ALL=C" --command=minecraft com.mojang.Minecraft

hope that helped :D

SystemlessDev commented 1 year ago

I just did some testing here. The minecraft launcher doesn't seem to pick the language after what locale the system has set. I am at least not able to make it select norwegian bokmål automatically.

When it comes to the env variable it wants us to set. It doesn't care about any of the LC_* variables. It wants LANG to be set to something it knows. Setting it to nn_NO.UTF-8 (norwegian nynorsk) makes it crash, however with nb_NO (norwegian bokmål) it launches fine.

Considering how it doesn't care about the system locale after all I think it's the best to just set LC_ALL=C and call it a day.