Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 838850 - [feature request] media-libs/imgui: multilib + pkgconfig
Summary: [feature request] media-libs/imgui: multilib + pkgconfig
Status: UNCONFIRMED
Alias: None
Product: GURU
Classification: Unclassified
Component: Package issues (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: GURU project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-16 16:36 UTC by Adel KARA SLIMANE
Modified: 2022-08-27 19:26 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adel KARA SLIMANE 2022-04-16 16:36:01 UTC
Hello,

I am trying to add MangoHud to GURU and it depends on imgui, I'd need it to have a multilib build + that install the proper pkgconfig .pc files. Thanks!

A possibility is to use meson or one of the various open PRs to add Cmake support.

Thanks!
Comment 1 Alessandro Barbieri 2022-04-16 17:00:29 UTC
I'm on a no-multilib profile because I dislike multilib
Comment 2 Adel KARA SLIMANE 2022-04-16 21:21:29 UTC
I understand x) It's okay I bundled imgui in mangohud for now.
Comment 3 Larry the Git Cow gentoo-dev 2022-04-17 18:12:59 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=e5119f64b321b101843486a27ae1bd7135f06242

commit e5119f64b321b101843486a27ae1bd7135f06242
Author:     Adel KARA SLIMANE <adel.ks@zegrapher.com>
AuthorDate: 2022-04-16 17:30:19 +0000
Commit:     Adel KARA SLIMANE <adel.ks@zegrapher.com>
CommitDate: 2022-04-16 17:32:43 +0000

    games-util/mangohud: new package
    
    The imgui dependency that is bundled in GURU needs some work
    before it can be used as a dependency, bundle it for now
    
    Bug: https://bugs.gentoo.org/838850
    
    Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>

 games-util/mangohud/Manifest                       |  3 +
 .../files/mangonhud-0.6.6-meson-build.patch        | 14 ++++
 games-util/mangohud/mangohud-0.6.6.1.ebuild        | 94 ++++++++++++++++++++++
 games-util/mangohud/metadata.xml                   | 15 ++++
 4 files changed, 126 insertions(+)
Comment 4 Alessandro Barbieri 2022-04-21 21:54:18 UTC
There are 8 different PR that add cmake support ...
Comment 5 Adel KARA SLIMANE 2022-04-21 22:08:06 UTC
> There are 8 different PR that add cmake support ...

Yeah crazy... I'd say pick the simplest one, that doesn't care about windows nor directx, if you want to go that route. I was in the middle of writing a meson.build for it then stopped, because it's wrapped already [1] but the wrap is a little bit too careless : it auto enables features if dependencies are found, it needs improving so it can be properly used in Gentoo with useflags.

[1] https://mesonbuild.com/Wrapdb-projects.html
Comment 6 Alessandro Barbieri 2022-04-21 22:17:52 UTC
Also which backends are needed for mangohud? You'll need their respective libs to be multilib
Comment 7 Adel KARA SLIMANE 2022-04-21 23:40:48 UTC
Here's what MangoHud needs [1]

imgui_options = [
  'default_library=static',
  'dx9=disabled',
  'dx10=disabled',
  'dx11=disabled',
  'dx12=disabled',
  'metal=disabled',
  'opengl=disabled',
  'vulkan=disabled',
  'glfw=disabled',
  'sdl2=disabled',
  'osx=disabled',
  'win=disabled',
  'marmalade=disabled',
  'allegro5=disabled',
]


[1] https://github.com/flightlessmango/MangoHud/blob/master/meson.build#L219
Comment 8 Adel KARA SLIMANE 2022-04-21 23:48:16 UTC
So it looks like it only needs imgui itself and no backend :thinking: So I suppose that this cmake [1] should work if you want to take that solution.

Otherwise, the meson route may need more work as the meson wrap zip, that contains a meson.build, does not use pkg-config module to install .pc file. So it is not enough.


[1] https://github.com/ocornut/imgui/pull/4614
Comment 9 Adel KARA SLIMANE 2022-05-03 21:41:11 UTC
Thanks for adding CMAKE support, I tried it and unfortunately there's a small issue with the installed .pc file

```
 1 prefix=/usr
 2 libdir=${prefix}/lib64
 3 includedir=${prefix}/include/imgui
 4
 5 Name: imgui
 6 Description: Bloat-free Immediate Mode Graphical User interface for C
 7 Version: 1.87
 8 URL: https://github.com/ocornut/imgui
 9 Libs: -L${libdir} -limgui /usr/lib64/libGL.so;-L/usr/lib64  -lSDL2;Vulkan::Vulkan
10 Libs.private: -lm
11 Cflags: -I${includedir}
```

this line in particular

```
 9 Libs: -L${libdir} -limgui /usr/lib64/libGL.so;-L/usr/lib64  
```

with this extra string "/usr/lib64/libGL.so;-L/usr/lib64" that relaces the @IMGUI_LIBRARIES@ placeholder.
Comment 10 Alessandro Barbieri 2022-05-03 22:30:48 UTC
I've taken that pc file from Debian
Can you better explain the issue?
Comment 11 Adel KARA SLIMANE 2022-05-03 23:44:44 UTC
Linking fails with this

```
x86_64-pc-linux-gnu-g++  -o src/libMangoHud.so src/libMangoHud.so.p/meson-generated_.._.._vk_enum_to_str.c.o src/libMangoHud.so.p/mesa_util_os_socket.c.o src/libMangoHud.so.p/mesa_util_os_time.c.o src/libMangoHud.so.p/hud_elements.cpp.o src/libMangoHud.so.p/overlay.cpp.o src/libMangoHud.so.p/overlay_params.cpp.o src/libMangoHud.so.p/font.cpp.o src/libMangoHud.so.p/keybinds.cpp.o src/libMangoHud.so.p/font_unispace.c.o src/libMangoHud.so.p/logging.cpp.o src/libMangoHud.so.p/config.cpp.o src/libMangoHud.so.p/gpu.cpp.o src/libMangoHud.so.p/vulkan.cpp.o src/libMangoHud.so.p/blacklist.cpp.o src/libMangoHud.so.p/file_utils.cpp.o src/libMangoHud.so.p/cpu.cpp.o src/libMangoHud.so.p/memory.cpp.o src/libMangoHud.so.p/iostats.cpp.o src/libMangoHud.so.p/notify.cpp.o src/libMangoHud.so.p/elfhacks.cpp.o src/libMangoHud.so.p/real_dlsym.cpp.o src/libMangoHud.so.p/pci_ids.cpp.o src/libMangoHud.so.p/battery.cpp.o src/libMangoHud.so.p/loaders_loader_x11.cpp.o src/libMangoHud.so.p/shared_x11.cpp.o src/libMangoHud.so.p/dbus.cpp.o src/libMangoHud.so.p/loaders_loader_dbus.cpp.o src/libMangoHud.so.p/loaders_loader_libdrm.cpp.o src/libMangoHud.so.p/gl_glad.c.o src/libMangoHud.so.p/gl_imgui_impl_opengl3.cpp.o src/libMangoHud.so.p/gl_imgui_hud.cpp.o src/libMangoHud.so.p/gl_inject_egl.cpp.o src/libMangoHud.so.p/loaders_loader_glx.cpp.o src/libMangoHud.so.p/gl_inject_glx.cpp.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libMangoHud.so -O3 -march=native -pipe -Wl,-O1 -Wl,--as-needed -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--exclude-libs,ALL -lGL -Wl,--version-script,/var/tmp/portage/games-util/mangohud-0.6.6.1-r1/work/MangoHud-0.6.6.1/src/mangohud.version /usr/lib64/libwayland-client.so /usr/lib64/libimgui.so '/usr/lib64/libGL.so;-L/usr/lib64' '-lSDL2;Vulkan::Vulkan' /usr/lib64/libspdlog.so -pthread /usr/lib64/libfmt.so /usr/lib64/libvulkan.so -Wl,--end-group
/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find /usr/lib64/libGL.so;-L/usr/lib64: No such file or directory
/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lSDL2;Vulkan::Vulkan: No such file or directory
```

which made me think that `/usr/lib64/libGL.so;-L/usr/lib64` and `-lSDL2;Vulkan::Vulkan` are syntactically incorrect ?
Comment 12 Adel KARA SLIMANE 2022-05-03 23:46:30 UTC
Note that I created an imgui-1.86 ebuild from the latest one to test, as version 1.87 brings breaking changes for MangoHud (upstream, in their wrap file they need 1.81, if you can make that one it would be awesome!)
Comment 13 Alessandro Barbieri 2022-05-04 00:08:01 UTC
Oh, I see. I'm putting cmake syntax into the pc file. I'll try to find a solution.
Comment 14 Adel KARA SLIMANE 2022-08-27 19:26:50 UTC
Hello,

I added imgui-1.81 with meson build system (with extra tweaks that are cleaner than with cmake) and I could successfully make it work with MangoHud. 

Is that okay with you ? If the meson version works for your uses of imgui, we can move every ebuild to meson instead. If you have any