libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.38k stars 1.84k forks source link

Retroarch AppImage does not start with video driver set to vulkan on Linux/mesa/RADV #13714

Open ghost opened 2 years ago

ghost commented 2 years ago

Description

With video_driver = "vulkan" set Retroarch immediately crashes, it does not even start.

Vulkan works with literally everything else on my system.

Expected behavior

Retroarch starts.

Actual behavior

It crashes.

Steps to reproduce the bug

  1. Be running a Linux system, possibly specific to AMD GPUs and mesa
  2. Run the AppImage
  3. Set video driver to vulkan
  4. Try running Retroarch again

Bisect Results

Version/Commit

This happens on latest 2022-03-08 nightly and 1.9.14 stable, I have not tried any older.

Environment information

[INFO] RetroArch 1.10.1 (Git 9bcee06)
[INFO] === Build =======================================
[INFO] CPU Model Name: AMD Ryzen 5 3600 6-Core Processor              
[INFO] Capabilities:  MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE4.2 AES AVX
[INFO] Built: Mar  8 2022
[INFO] Version: 1.10.1
[INFO] Git: 9bcee06
[INFO] =================================================
[INFO] [Input]: Found input driver: "x".
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Set video size to: 960x720.
[ERROR] [Wayland/Vulkan]: Failed to connect to Wayland server.
[INFO] [Vulkan]: Vulkan dynamic library loaded.
[ERROR] [Vulkan]: Could not find instance extensions. Will attempt without them.
[ERROR] Failed to create Vulkan instance (-9).
[INFO] [Vulkan]: Vulkan dynamic library loaded.
[ERROR] [Vulkan]: Could not find instance extensions. Will attempt without them.
[ERROR] Failed to create Vulkan instance (-9).
[ERROR] [Vulkan]: Failed to create Vulkan context.
[WARN] Failed to bind API (#9, version 1.0) on context driver "wayland".
[WARN] Failed to bind API (#9, version 1.0) on context driver "x".
[WARN] Failed to bind API (#9, version 1.0) on context driver "egl_x".
[WARN] Failed to bind API (#9, version 1.0) on context driver "kms".
[WARN] Failed to bind API (#9, version 1.0) on context driver "gl_sdl".
[INFO] [Vulkan]: Found vulkan context: "null".
[INFO] [Vulkan]: Detecting screen resolution: 320x240.
[INFO] [Vulkan]: Using resolution 320x240.
[ERROR] [Vulkan]: Failed to get context data.
[ERROR] [Video]: Cannot open video driver ... Exiting ...
[ERROR] Fatal error received in: "video_driver_init_internal()"
[INFO] [Core]: Content ran for a total of: 00 hours, 00 minutes, 00 seconds.
[INFO] [Core]: Unloading core..
[INFO] [Core]: Unloading core symbols..
ghost commented 2 years ago

Also retroarch works fine with video_driver = "vulkan" by simply compiling and running it myself, also works in Steam version.

ndarilek commented 2 years ago

I hit either this or a similar issue packaging a vulkan-based game, and found this issue when searching for a solution.

One of my players figured out that removing libwayland-client.so.0 from the appimage for my game got it working. I can't easily test this myself, but if there is in fact a libwayland-client.so.0 in this RetroArch build, and if removing/repacking the image fixes this, it might be worth following https://github.com/AppImage/pkg2appimage/issues/510.

stuken commented 2 years ago

I've extracted the appimage, dumped the binary into the lib dir and removed libwayland-client.so.0 and retroarch boots correctly under vulkan just as it does from the flatpack and steam builds.

ruanformigoni commented 2 years ago

Here is a script to re-create the AppImage without the problematic file:

#!/usr/bin/env bash

set -e

mkdir -p workdir

cd workdir

# Get AppImage of retroarch
wget -q --show-progress --progress=bar:noscroll -O retroarch.AppImage "https://github.com/hizzlekizzle/RetroArch-AppImage/releases/download/Linux_LTS_Nightlies/RetroArch-Linux-x86_64-Nightly.AppImage"

chmod +x ./retroarch.AppImage

# Extract
./retroarch.AppImage --appimage-extract

# Erase downloaded appimage
rm retroarch.AppImage

# Erase problematic file
rm squashfs-root/usr/lib/libwayland-client.so.0

# Create AppDir
mv squashfs-root AppDir

# Get appimagetool
wget -q --show-progress --progress=bar:noscroll -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage

chmod +x appimagetool

# Create new fixed appimage
./appimagetool AppDir

mv ./*.AppImage ..

cd ..

rm -rf workdir
ghost commented 2 years ago

wget -q --show-progress --progress=bar:noscroll -O retroarch.AppImage "https://github.com/hizzlekizzle/RetroArch-AppImage/releases/download/Linux_LTS_Nightlies/RetroArch-Linux-x86_64-Nightly.AppImage"

Sus, why are you getting this old AppImage from some random person.

Official is https://buildbot.libretro.com/nightly/linux/x86_64/RetroArch.7z

Sanaki commented 2 years ago

That random person is the guy who set up the appimage builds in the first place.

ruanformigoni commented 2 years ago

wget -q --show-progress --progress=bar:noscroll -O retroarch.AppImage "https://github.com/hizzlekizzle/RetroArch-AppImage/releases/download/Linux_LTS_Nightlies/RetroArch-Linux-x86_64-Nightly.AppImage"

Sus, why are you getting this old AppImage from some random person.

Official is https://buildbot.libretro.com/nightly/linux/x86_64/RetroArch.7z

Hi, this is the first link that appears when you search for retroarch appimages, I didn't know that there were more recent builds. Thanks for pointing this out :)

casasfernando commented 1 year ago

This is still a problem with version 1.14.0.

Thanks

gytdoo commented 10 months ago

Here is a script to re-create the AppImage without the problematic file:

Still experiencing this issue specifically on the steam deck, so I updated the script to work with the latest nightly build. For some reason this doesn't work with the QT version, but the regular download works fine on vulkan after libwayland-client.so.0 is removed.

#!/usr/bin/env bash

set -e

mkdir -p workdir

cd workdir

# Get AppImage of retroarch
wget -q --show-progress --progress=bar:noscroll "https://buildbot.libretro.com/nightly/linux/x86_64/RetroArch.7z"

7z x RetroArch.7z

mv RetroArch-Linux-x86_64/RetroArch-Linux-x86_64.AppImage RetroArch-Linux-x86_64/RetroArch-Linux-x86_64.AppImage.home/ .

chmod +x ./RetroArch-Linux-x86_64.AppImage

# Extract
./RetroArch-Linux-x86_64.AppImage --appimage-extract

# Erase downloaded appimage
rm RetroArch-Linux-x86_64.AppImage

# Erase problematic file
rm squashfs-root/usr/lib/libwayland-client.so.0

# Create AppDir
mv squashfs-root AppDir

# Get appimagetool
wget -q --show-progress --progress=bar:noscroll -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage

chmod +x appimagetool

# Create new fixed appimage
./appimagetool AppDir

mv RetroArch-Linux-x86_64.AppImage.home RetroArch-x86_64.AppImage.home

mv ./*.AppImage RetroArch-x86_64.AppImage.home ..

cd ..

rm -rf workdir

And I've been using the lower script to update. Just run it from the same directory the AppImage is in. Conveniently they have an update 7z file available, so this doesn't overwrite any configs. All it does is extract the archive, patch the new AppImage, and overwrite it on top of old files in the retroarch directory with any new ones.

#!/usr/bin/env bash

set -e

mkdir -p workdir

cd workdir

# Get AppImage of retroarch
wget -q --show-progress --progress=bar:noscroll "https://buildbot.libretro.com/nightly/linux/x86_64/RetroArch_update.7z"

7z x RetroArch_update.7z

mv RetroArch-Linux-x86_64/RetroArch-Linux-x86_64.AppImage RetroArch-Linux-x86_64/RetroArch-Linux-x86_64.AppImage.home/ .

chmod +x ./RetroArch-Linux-x86_64.AppImage

# Extract
./RetroArch-Linux-x86_64.AppImage --appimage-extract

# Erase downloaded appimage
rm RetroArch-Linux-x86_64.AppImage

# Erase problematic file
rm squashfs-root/usr/lib/libwayland-client.so.0

# Create AppDir
mv squashfs-root AppDir

# Get appimagetool
wget -q --show-progress --progress=bar:noscroll -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage

chmod +x appimagetool

# Create new fixed appimage
./appimagetool AppDir

mv RetroArch-Linux-x86_64.AppImage.home RetroArch-x86_64.AppImage.home

cd ..

cp -R workdir/RetroArch-x86_64.AppImage.home/ .

mv workdir/*.AppImage .

rm -rf workdir
trotsky40 commented 9 months ago

The scripts work for me on the Steam Deck.

@hizzlekizzle Any possibility that this can be done upstream so the user doesn't have to?

hizzlekizzle commented 9 months ago

I believe the problem is that without that file, the appimage won't work on other distros/devices.

odditude42 commented 6 months ago

is it worth simply building two appimages (one with the file, one without), and on the download page indicate which distros each is known to work with?

miwagner1 commented 6 months ago

This is still an issue with the beta steamOS 3.6 for Steam Deck.

new-penguin commented 4 months ago

Do you have both amdvlk and vulkan-radeon packages installed? That caused issue with me on Arch, even though the Steam version worked, so I had to uninstall amdvlk for RA to work with vulkan enabled.

Ketrel commented 1 month ago

An appimage (I built it) that worked on the Steamdeck in July stopped working in this manner after I updated my Steamdeck. That would lead me to believe it's some conflict with a newer version of the wayland file on the host, even if wayland isn't being used.

Modifying as said here https://github.com/libretro/RetroArch/issues/13714#issuecomment-1873517309 allows the appimage to work in my case.

trotsky40 commented 2 weeks ago

From the 11/6 Nightly (with this commit https://github.com/libretro/RetroArch/commit/ae202515f6fc6a6cf461a53b33e59377bab51bd7) onwards, I am now able to use the build straight from buildbot on the Steam Deck with vulkan.