unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#64213] [PATCH] gnu: imgui-1.86: Fix build for mangohud.
@ 2023-06-22  1:06 John Kehayias via Guix-patches via
  2023-06-28  0:58 ` [bug#64213] [PATCH v2 1/2] gnu: imgui: Use #:make-flags John Kehayias via Guix-patches via
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: John Kehayias via Guix-patches via @ 2023-06-22  1:06 UTC (permalink / raw)
  To: 64213

[-- Attachment #1: Type: text/plain, Size: 2752 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-imgui-1.86-Fix-build-for-mangohud.patch --]
[-- Type: text/x-patch; name=0001-gnu-imgui-1.86-Fix-build-for-mangohud.patch, Size: 2724 bytes --]

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#64213] [PATCH v2 1/2] gnu: imgui: Use #:make-flags.
  2023-06-22  1:06 [bug#64213] [PATCH] gnu: imgui-1.86: Fix build for mangohud John Kehayias via Guix-patches via
@ 2023-06-28  0:58 ` John Kehayias via Guix-patches via
  2023-06-28  0:59 ` [bug#64213] [PATCH v2 2/2] gnu: imgui-1.86: Adjust make-flags John Kehayias via Guix-patches via
  2023-06-29 14:59 ` bug#64213: " John Kehayias via Guix-patches via
  2 siblings, 0 replies; 4+ messages in thread
From: John Kehayias via Guix-patches via @ 2023-06-28  0:58 UTC (permalink / raw)
  To: 64213

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

With some help from #guix, a better way was found: employ #:make-flags (even though there is no make here, use them the same way in the custom 'build phase). Now there are two patches: first adjusts imgui to use #:make-flags and the second fixes the issue with mangohud from imgui-1.86 by adjusting these flags.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-imgui-Use-make-flags.patch --]
[-- Type: text/x-patch; name=0001-gnu-imgui-Use-make-flags.patch, Size: 4812 bytes --]

From 82f14241e45a4d56fdf26e7bc463407941ead4a7 Mon Sep 17 00:00:00 2001
Message-Id: <82f14241e45a4d56fdf26e7bc463407941ead4a7.1687913689.git.john.kehayias@protonmail.com>
From: John Kehayias <john.kehayias@protonmail.com>
Date: Tue, 27 Jun 2023 20:43:44 -0400
Subject: [PATCH 1/2] gnu: imgui: Use #:make-flags.

* gnu/packages/toolkits.scm (imgui)[arguments]: Add #:make-flags to replace
compiler arguments in the 'build phase.
---
 gnu/packages/toolkits.scm | 54 +++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/toolkits.scm b/gnu/packages/toolkits.scm
index aee6c22e2d..1af10d83f4 100644
--- a/gnu/packages/toolkits.scm
+++ b/gnu/packages/toolkits.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2020, 2022 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -55,6 +55,18 @@ (define-public imgui
                   (guix build utils)
                   (ice-9 ftw)
                   (srfi srfi-26))
+      ;; The build phase does not use make but we will use make-flags in a
+      ;; similar fashion to make inheritance for older imgui versions easier.
+      #:make-flags
+      ;; This first option is necessary at least for OpenBoardView, otherwise
+      ;; it would fail with the "Too many vertices in ImDrawList using 16-bit
+      ;; indices".
+      #~(list "-DImDrawIdx=unsigned int"
+              "-I" (string-append (getcwd) "/source")
+              "-I" (search-input-directory %build-inputs "include/freetype2")
+              "-g" "-O2" "-fPIC" "-shared"
+              "-lGL" "-lSDL2" "-lglfw"
+              "-o" "libimgui.so")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'adjust-includes
@@ -64,32 +76,24 @@ (define-public imgui
                  "#include <SDL2/SDL"))))
           (delete 'configure)
           (replace 'build
-            (lambda* (#:key inputs #:allow-other-keys)
+            (lambda* (#:key make-flags #:allow-other-keys)
               ;; Build main library.
               (apply invoke #$(cc-for-target)
-                     ;; This option is necessary at least for OpenBoardView,
-                     ;; otherwise it would fail with the "Too many vertices in
-                     ;; ImDrawList using 16-bit indices".
-                     "-DImDrawIdx=unsigned int"
-                     "-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$"))))
+                     (append make-flags
+                             `("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$"))))))
           (replace 'install
             (lambda _
               (let* ((header? (cut string-suffix? ".h" <>))

base-commit: 63660f0febb4aa0d5260791c82dfde15c0df4c79
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#64213] [PATCH v2 2/2] gnu: imgui-1.86: Adjust make-flags.
  2023-06-22  1:06 [bug#64213] [PATCH] gnu: imgui-1.86: Fix build for mangohud John Kehayias via Guix-patches via
  2023-06-28  0:58 ` [bug#64213] [PATCH v2 1/2] gnu: imgui: Use #:make-flags John Kehayias via Guix-patches via
@ 2023-06-28  0:59 ` John Kehayias via Guix-patches via
  2023-06-29 14:59 ` bug#64213: " John Kehayias via Guix-patches via
  2 siblings, 0 replies; 4+ messages in thread
From: John Kehayias via Guix-patches via @ 2023-06-28  0:59 UTC (permalink / raw)
  To: 64213

[-- Attachment #1: Type: text/plain, Size: 13 bytes --]

Empty Message

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-imgui-1.86-Adjust-make-flags.patch --]
[-- Type: text/x-patch; name=0002-gnu-imgui-1.86-Adjust-make-flags.patch, Size: 1586 bytes --]

From 07f13208564e4a5ee5d5509f6abdd09f18414ce4 Mon Sep 17 00:00:00 2001
Message-Id: <07f13208564e4a5ee5d5509f6abdd09f18414ce4.1687913689.git.john.kehayias@protonmail.com>
In-Reply-To: <82f14241e45a4d56fdf26e7bc463407941ead4a7.1687913689.git.john.kehayias@protonmail.com>
References: <82f14241e45a4d56fdf26e7bc463407941ead4a7.1687913689.git.john.kehayias@protonmail.com>
From: John Kehayias <john.kehayias@protonmail.com>
Date: Tue, 27 Jun 2023 20:49:34 -0400
Subject: [PATCH 2/2] gnu: imgui-1.86: Adjust make-flags.

* gnu/packages/toolkits.scm (imgui-1.86)[arguments]: Remove the
"-DImDrawIdx=unsigned int" make-flag which breaks the display of mangohud, the
only dependent.
---
 gnu/packages/toolkits.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/toolkits.scm b/gnu/packages/toolkits.scm
index 1af10d83f4..46b7fd2cd6 100644
--- a/gnu/packages/toolkits.scm
+++ b/gnu/packages/toolkits.scm
@@ -168,4 +168,10 @@ (define-public imgui-1.86
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "02a7b05zrka20jhzag2jb4jl624i1m456bsv69jb9zgys2p9dv1n"))))))
+                "02a7b05zrka20jhzag2jb4jl624i1m456bsv69jb9zgys2p9dv1n"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments imgui)
+       ((#:make-flags flags ''())
+        ;; Remove the "-DImDrawIdx=unsigned int" make-flag as this breaks
+        ;; mangohud, the only user of this version.
+        #~(delete "-DImDrawIdx=unsigned int" #$flags))))))
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#64213: [PATCH v2 2/2] gnu: imgui-1.86: Adjust make-flags.
  2023-06-22  1:06 [bug#64213] [PATCH] gnu: imgui-1.86: Fix build for mangohud John Kehayias via Guix-patches via
  2023-06-28  0:58 ` [bug#64213] [PATCH v2 1/2] gnu: imgui: Use #:make-flags John Kehayias via Guix-patches via
  2023-06-28  0:59 ` [bug#64213] [PATCH v2 2/2] gnu: imgui-1.86: Adjust make-flags John Kehayias via Guix-patches via
@ 2023-06-29 14:59 ` John Kehayias via Guix-patches via
  2 siblings, 0 replies; 4+ messages in thread
From: John Kehayias via Guix-patches via @ 2023-06-29 14:59 UTC (permalink / raw)
  To: 64213-done

Pushed as 15056f47c217d87bf0914735fb52833a5457dc37 and 2b25bc03a11e1c6a473bbb000c35e94233120346

thanks





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-29 15:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-22  1:06 [bug#64213] [PATCH] gnu: imgui-1.86: Fix build for mangohud John Kehayias via Guix-patches via
2023-06-28  0:58 ` [bug#64213] [PATCH v2 1/2] gnu: imgui: Use #:make-flags John Kehayias via Guix-patches via
2023-06-28  0:59 ` [bug#64213] [PATCH v2 2/2] gnu: imgui-1.86: Adjust make-flags John Kehayias via Guix-patches via
2023-06-29 14:59 ` bug#64213: " John Kehayias via Guix-patches via

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).