helloSystem / launch

Command line tool to launch applications, will search for .app bundles and .AppDir directories in various directories, and will show launch errors in the GUI
BSD 2-Clause "Simplified" License
16 stars 6 forks source link

Add error handler for ld-linux-x86-64.so.2 not found #17

Open probonopd opened 2 years ago

probonopd commented 2 years ago

This happens when the user is trying to run a Linux application, linux64.ko is loaded but no /compat is mounted and we don't have a fully self-contained bundle:

Currently no error dialog is shown at all.

FreeBSD% launch '/home/user/Applications/Linuxulator/Spotify.AppDir' 
# Found "/home/user/Applications/Linuxulator/Spotify.AppDir"
ELF interpreter /lib64/ld-linux-x86-64.so.2 not found, error 2
Process is not running anymore and exit code was not 0
FreeBSD% launch '/home/user/Applications/Linuxulator/Discord.app' 
# Found "/home/user/Applications/Linuxulator/Discord.app"
ELF interpreter /lib64/ld-linux-x86-64.so.2 not found, error 2
Process is not running anymore and exit code was not 0

Maybe we should point the user toward a download link for the Linux userland/runtime.

probonopd commented 2 years ago

Similarly, when linux64.ko is not loaded:

FreeBSD% launch '/home/user/Applications/Linuxulator/Discord.app' 
# Found "/home/user/Applications/Linuxulator/Discord.app"
ELF binary type "0" not known.
Process is not running anymore and exit code was not 0
"exec: /usr/home/user/Applications/Linuxulator/Discord.app/Discord.bin: Exec format error\n"

Currently this is shown:

exec: /usr/home/user/Applications/Linuxulator/Discord.app/Discord.bin: Exec format error

We should make it more concrete.

probonopd commented 2 years ago

Complication is that whenever we see "Could not launch...", then the payload application could not even be started, and I don't know how to get at the console output in this case, becasue apparently the console output is not produced by the playload application but by some other system component.

This does not work:

    if (p.state() == 0 and p.exitCode() != 0) {
        qDebug("Process is not running anymore and exit code was not 0");
        const QString error = p.readAllStandardError();
        if (!error.isEmpty()) {
            qDebug() << error;
            handleError(&p, error);
        } else {
            // If the exit code was not 0 but stderr is empty, we use stdout...
            const QString stdout = p.readAllStandardOutput();
            handleError(&p, stdout);
        }
        return(p.exitCode());
    }