ImHex
ImHex copied to clipboard
[Bug] winget installs GPU exe on machines requiring NoGPU exe
Operating System
Windows
What's the issue you encountered?
ImHex installed via winget is the wrong exe!
cat AppData\Local\ImHex\logs\20230115_132755.log
[13:27:55] [INFO] [main] Welcome to ImHex 1.26.2!
[13:27:55] [ERROR] [main] GLFW Error [65542] : WGL: The driver does not appear to support OpenGL
[13:27:55] [FATAL] [main] Failed to create GLFW window!
Could MSI installer not check if OpenGL is available and install NoGPU exe in case there is none or no good enough GPU ?
Intel HD Graphics 3000
Manufacturer Intel
Model HD Graphics 3000
Device ID 8086-0126
Revision A
Subvendor HP (103C)
Current Performance Level Level 0
Current GPU Clock 640 MHz
Technology 32 nm
Driver version 9.17.10.4459
How can the issue be reproduced?
run winget on a PC with a missing OpenGL driver
ImHex Version
1.26.2
ImHex Build Type
- [ ] Nightly or built from sources
Installation type
winget
Additional context?
No response
Detecting if OpenGL is available is gonna be pretty hard. Best that could probably be done is a checkbox you can check if you want the NoGPU version. That said, I know basically nothing about the installer. It's just all done using cmake. I'd gladly merge a PR if you want to look into how to do that though
https://stackoverflow.com/questions/126028/how-to-write-an-installer-that-checks-for-opengl-support has some suggestions
ImHex is using a WiX installer so that's not really applicable here
ImHex is using a WiX installer
so is below reference in readme.md incorrect? "Roblabla for adding MSI Installer support to ImHex"
WiX is a toolset for generating MSI installers.
Detecting if OpenGL is available is gonna be pretty hard.
I don't know if this trick would work on Windows, but for my own C++ project we try to load a special dynamic library that requires linking to the library we want, and if it fails to load (because the linked library isn't available) then we know that library isn't supported.
@Slackadays Detecting if we have GPU support in ImHex itself is trivial. However I have no idea how to do it inside of an MSI installer. I barely ever used WiX so far
I think the point I was making was that this trick lets ImHex check GPU support at runtime so that we don't need to check it in the MSI. Basically, we have a "universal binary" like Apple does for x86/ARM, but this time it's for GPU features. So if it can't load the GPU helper library, then we fall back to NoGPU.
In my case, this funky trick was the only thing that would let us add support for X11 and Wayland WITHOUT making them dependencies or checking what version to use in the installer.
So if it can't load the GPU helper library, then we fall back to NoGPU.
makes perfect sense and reduces complexity for users!
Doesn't work here sadly because the opengl dll is always available, even if the machine doesn't have a GPu
What stops ImHex from just falling back to NoGPU features if it can't make an OpenGL window?
ImHex links against opengll.dll which by default is the system dll which uses the GPU. On the NoGPU version, we place Mesa's software rendered dll next to the executable so it gets loaded instead.
ImGui itself has nothing to do with it, it's a dll that needs to be placed next to the executable. And that is only possible with elevated permissions which is something I really don't want to require
The Clipboardy fix to this would be to link ImHex to Windows OGL as normal, but if loading OGL from that fails, then dynamically open Mesa as a fallback. Mesa would always be included here even if Windows OGL is working, which is a problem in your case because it requires higher permissions.
The alternative if you can't dynamically load Mesa would be to make another dynamically loaded DLL that's linked against Mesa that does nothing but acts as a shim between ImHex and Mesa.
Unfortunately, it looks like none of these will work unless you require elevated permissions every time, which doesn't matter for CB because it's simpler and quicker to say "you need Administrator to install CB" than "you need Administrator to install CB, unless you do this special step"
This issue is marked stale as it has been open for 11 months without activity. Please try the latest ImHex version. (Avaiable here: https://imhex.download/ for release and https://imhex.download/#nightly for development version) If the issue persists on the latest version, please make a comment on this issue again
Without response, this issue will be closed in one month.