diff mbox series

[bug#64213] gnu: imgui-1.86: Fix build for mangohud.

Message ID 87legcfgqm.fsf@protonmail.com
State New
Headers show
Series [bug#64213] gnu: imgui-1.86: Fix build for mangohud. | expand

Commit Message

John Kehayias June 22, 2023, 1:06 a.m. UTC
Hi guix,

The mangohud package was broken (corrupted display) with commit <https://git.savannah.gnu.org/cgit/guix.git/commit/?id=0d5746ee7ca337dcc82553ca6dd794b04bb6563d> I'm not sure why that change in build option does it, but trying to run "mangohud glxgears" exits immediately with

--8<---------------cut here---------------start------------->8---
❯ guix time-machine --commit=0d5746ee7ca337dcc82553ca6dd794b04bb6563d -- shell mesa-utils mangohud -- mangohud glxgears
amdgpu: unknown (family_id, chip_external_rev): (145, 1)
libGL error: failed to create dri screen
libGL error: failed to load driver: radeonsi
amdgpu: unknown (family_id, chip_external_rev): (145, 1)
libGL error: failed to create dri screen
libGL error: failed to load driver: radeonsi
[2023-06-21 Wed 21:01]  [MANGOHUD] [info] [config.cpp:118] skipping config: '/gnu/store/25y85hj066crw9kqd4c1jlg6yifd2wiv-mesa-utils-8.4.0/bin/MangoHud.conf' [ not found ]
[2023-06-21 Wed 21:01]  [MANGOHUD] [info] [config.cpp:118] skipping config: '/home/john/.config/MangoHud/glxgears.conf' [ not found ]
[2023-06-21 Wed 21:01]  [MANGOHUD] [info] [config.cpp:118] skipping config: '/home/john/.config/MangoHud/MangoHud.conf' [ not found ]
amdgpu: unknown (family_id, chip_external_rev): (145, 1)
libGL error: failed to create dri screen
libGL error: failed to load driver: radeonsi
amdgpu: unknown (family_id, chip_external_rev): (145, 1)
libGL error: failed to create dri screen
libGL error: failed to load driver: radeonsi
[2023-06-21 Wed 21:01]  [MANGOHUD] [error] [loader_nvml.cpp:42] Failed to open 64bit libnvidia-ml.so.1: libnvidia-ml.so.1: cannot open shared object file: No such file or directory
[2023-06-21 Wed 21:01]  [MANGOHUD] [error] [nvml.cpp:43] Failed to load NVML
[2023-06-21 Wed 21:01]  [MANGOHUD] [info] [overlay.cpp:768] Uploading is disabled (permit_upload = 0)
glxgears: imgui.cpp:7475: bool ImGui::DebugCheckVersionAndDataLayout(const char*, size_t, size_t, size_t, size_t, size_t, size_t): Assertion `sz_idx == sizeof(unsigned int) && "Mismatched struct layout!"' failed.
--8<---------------cut here---------------end--------------->8---

The last line usually indicated a mismatch in imgui versions somewhere, but for some reason it comes from this build option. I guess mangohud somewhere assumes a different type. (All the previous lines are present when working correctly.)

I've tested this builds and fixes the problem, I just didn't push it directly as I wasn't sure if there was a better way to do this change in a package inheritance. Anything clever? I would guess not since it is a custom build phase with 'invoke', but thought I'd give it a chance for any quick comments in case there's something cleaner.

Thanks!
John

Comments

John Kehayias June 29, 2023, 2:59 p.m. UTC | #1
Pushed as 15056f47c217d87bf0914735fb52833a5457dc37 and 2b25bc03a11e1c6a473bbb000c35e94233120346

thanks
diff mbox series

Patch

From a33c263d256dd3a1a99e41fa56ca6bc48976fa00 Mon Sep 17 00:00:00 2001
Message-Id: <a33c263d256dd3a1a99e41fa56ca6bc48976fa00.1687395567.git.john.kehayias@protonmail.com>
From: John Kehayias <john.kehayias@protonmail.com>
Date: Wed, 21 Jun 2023 20:57:10 -0400
Subject: [PATCH] gnu: imgui-1.86: Fix build for mangohud.

* gnu/packages/toolkits.scm (imgui-1.86)[phases]{build}: Inherit from imgui
but remove "-DImDrawIdx=unsigned int" as this breaks mangohud, the only user
of this package.
---
 gnu/packages/toolkits.scm | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/toolkits.scm b/gnu/packages/toolkits.scm
index aee6c22e2d..aab9b93e52 100644
--- a/gnu/packages/toolkits.scm
+++ b/gnu/packages/toolkits.scm
@@ -164,4 +164,34 @@  (define-public imgui-1.86
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "02a7b05zrka20jhzag2jb4jl624i1m456bsv69jb9zgys2p9dv1n"))))))
+                "02a7b05zrka20jhzag2jb4jl624i1m456bsv69jb9zgys2p9dv1n"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments imgui)
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            ;; Same build phase as for imgui just without
+            ;; "-DImDrawIdx=unsigned int" as this breaks mangohud,
+            ;; the only user of this version.
+            (replace 'build
+              (lambda* (#:key inputs #:allow-other-keys)
+                ;; Build main library.
+                (apply invoke #$(cc-for-target)
+                       "-I" (getcwd)
+                       "-I" (search-input-directory inputs "include/freetype2")
+                       "-g" "-O2" "-fPIC" "-shared"
+                       "-lGL" "-lSDL2" "-lglfw"
+                       "-o" "libimgui.so"
+                       "imgui.cpp"
+                       "imgui_draw.cpp"
+                       "imgui_tables.cpp"
+                       "imgui_widgets.cpp"
+                       ;; Include the supported backends.
+                       "backends/imgui_impl_glfw.cpp"
+                       (if (file-exists? "backends/imgui_impl_sdl2.cpp")
+                           "backends/imgui_impl_sdl2.cpp"
+                           "backends/imgui_impl_sdl.cpp")
+                       "backends/imgui_impl_opengl2.cpp"
+                       "backends/imgui_impl_opengl3.cpp"
+                       ;; Include wrappers for C++ standard library (STL) and
+                       ;; fontconfig.
+                       (find-files "misc" "\\.cpp$"))))))))))

base-commit: dcca13ed7340f17a33a4c0907c13b64d5da66a8e
-- 
2.40.1