WerWolv / ImHex

šŸ” A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
43.98k stars 1.92k forks source link

[Bug] Can't launch on wayland #1788

Closed Yopaman closed 2 months ago

Yopaman commented 3 months ago

Operating System

Linux

What's the issue you encountered?

ImHex doesn't start on a Hyprland, a Wayland based compositor.

The logs are :

[17:57:42] [INFO]  [main | Main]               Welcome to ImHex 1.33.2!
[17:57:42] [INFO]  [main | Main]               Compiled using commit Unknown@Unknown
[17:57:42] [INFO]  [main | Main]               Running on Linux 6.6.36 #1-NixOS SMP PREEMPT_DYNAMIC Thu Jun 27 11:49:15 UTC 2024 (x86_64)
[17:57:42] [ERROR] [main | Main]               GLFW Error [65548] : Wayland: The platform does not support setting the window opacity
[17:57:42] [INFO]  [main | Main]               Native scaling set to: 1.0
[17:57:42] [FATAL] [main | Main]               ImHex crashed during initial setup!
Error: Received signal 'SIGSEGV' (11)
[17:57:42] [FATAL] [main | Main]                 imhex(_ZN3hex10stacktrace13getStackTraceEv+0x5a) [0x433dda]
[17:57:42] [FATAL] [main | Main]                 imhex(_ZN3hex5crash11handleCrashERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x2c) [0x42669c]
[17:57:42] [FATAL] [main | Main]                 imhex() [0x426d41]
[17:57:42] [FATAL] [main | Main]                 imhex() [0x426fe4]
[17:57:42] [FATAL] [main | Main]                 /nix/store/dbwp0scbb0rk78m636sb7cvycz8xzgyh-glibc-2.39-52/lib/libc.so.6(+0x3ff40) [0x7fcb9e051f40]
[17:57:42] [INFO]  [main | Main]               Exit task 'Saving settings' finished successfully
[17:57:42] [INFO]  [main | Main]               Exit task 'Prepare exit' finished successfully
[17:57:42] [INFO]  [main | Main]               Exit task 'Unloading plugins' finished successfully
[17:57:42] [INFO]  [main | Main]               Exit task 'Deleting old files' finished successfully

How can the issue be reproduced?

Launch ImHex.

ImHex Version

1.33.2

ImHex Build Type

Installation type

NixOS package

Additional context?

No response

jumanji144 commented 3 months ago

Please try on the newest 1.35.3

derefd commented 2 months ago

Fixed after following this.

Working overlay until the upstream changes propagated:

{
  nixpkgs,
  system,
  ...
}: let
  pkgs = import nixpkgs {
    inherit system;
    overlays = [
      (self: super: {
        glfw = super.glfw.overrideAttrs (finalAttrs: previousAttrs:
          with super; {
            postPatch = lib.optionalString stdenv.isLinux ''
              substituteInPlace src/wl_init.c \
                --replace-fail "libxkbcommon.so.0" "${lib.getLib libxkbcommon}/lib/libxkbcommon.so.0" \
                --replace-fail "libdecor-0.so.0" "${lib.getLib libdecor}/lib/libdecor-0.so.0" \
                --replace-fail "libwayland-client.so.0" "${lib.getLib wayland}/lib/libwayland-client.so.0" \
                --replace-fail "libwayland-cursor.so.0" "${lib.getLib wayland}/lib/libwayland-cursor.so.0" \
                --replace-fail "libwayland-egl.so.1" "${lib.getLib wayland}/lib/libwayland-egl.so.1"
            '';
          });
        imhex = super.imhex.overrideAttrs (finalAttrs: previousAttrs: let
          patterns_version = "1.35.3";
          patterns_src = super.fetchFromGitHub {
            owner = "WerWolv";
            repo = "ImHex-Patterns";
            rev = "ImHex-v${patterns_version}";
            hash = "sha256-h86qoFMSP9ehsXJXOccUK9Mfqe+DVObfSRT4TCtK0rY=";
          };
        in rec {
          version = "1.35.3";
          src = super.fetchFromGitHub {
            fetchSubmodules = true;
            owner = "WerWolv";
            repo = previousAttrs.pname;
            rev = "v${version}";
            hash = "sha256-8vhOOHfg4D9B9yYgnGZBpcjAjuL4M4oHHax9ad5PJtA=";
          };
          nativeBuildInputs = with super; [
            autoPatchelfHook
            cmake
            llvm
            python3
            perl
            pkg-config
            rsync
          ];
          autoPatchelfIgnoreMissingDeps = ["*.hexpluglib"];
          appendRunpaths = [
            (super.lib.makeLibraryPath [super.libGL])
            "${placeholder "out"}/lib/imhex/plugins"
          ];
          postInstall = ''
            mkdir -p $out/share/imhex
            rsync -av --exclude="*_schema.json" ${patterns_src}/{constants,encodings,includes,magic,patterns} $out/share/imhex
          '';
        });
      })
    ];
  };
in {
  home = {
    packages = with pkgs; [imhex];
  };
}
WerWolv commented 2 months ago

Glad it worked. I'll close this since we don't officially support NixOS