flightlessmango / MangoHud

A Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load and more. Discord: https://discordapp.com/invite/Gj5YmBb
MIT License
6.4k stars 284 forks source link

Error Building MangoHud on Ubuntu 22.04.3 - SDL2 Development Headers Not Found #1154

Closed Bengt closed 12 months ago

Bengt commented 12 months ago

Describe the bug

When using build.sh, I get an error about SDL2's libsdl development headers not being found:

ninja: Entering directory `build/meson32'
[1/82] Compiling C++ object subprojects/imgui-1.89.9/libimgui.a.p/backends_imgui_impl_sdlrenderer2.cpp.o
FAILED: subprojects/imgui-1.89.9/libimgui.a.p/backends_imgui_impl_sdlrenderer2.cpp.o 
g++ -m32 -Isubprojects/imgui-1.89.9/libimgui.a.p -Isubprojects/imgui-1.89.9 -I../../subprojects/imgui-1.89.9 -I../../subprojects/imgui-1.89.9/backends -I/usr/include/SDL2 -fvisibility=hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++14 -O3 -fPIC -D_REENTRANT '-DIMGUI_API=__attribute__((visibility("default")))' -MD -MQ subprojects/imgui-1.89.9/libimgui.a.p/backends_imgui_impl_sdlrenderer2.cpp.o -MF subprojects/imgui-1.89.9/libimgui.a.p/backends_imgui_impl_sdlrenderer2.cpp.o.d -o subprojects/imgui-1.89.9/libimgui.a.p/backends_imgui_impl_sdlrenderer2.cpp.o -c ../../subprojects/imgui-1.89.9/backends/imgui_impl_sdlrenderer2.cpp
In file included from /usr/include/SDL2/SDL_stdinc.h:31,
                 from /usr/include/SDL2/SDL_main.h:25,
                 from /usr/include/SDL2/SDL.h:32,
                 from ../../subprojects/imgui-1.89.9/backends/imgui_impl_sdlrenderer2.cpp:38:
/usr/include/SDL2/SDL_config.h:4:10: fatal error: SDL2/_real_SDL_config.h: No such file or directory
    4 | #include <SDL2/_real_SDL_config.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[2/82] Generating version.h with a custom command
ninja: build stopped: subcommand failed.

List relevant hardware/software information

To Reproduce

Steps to reproduce the behavior:

  1. Install Ubuntu 22.04.03
  2. Clone Repo:
    git clone --recurse-submodules https://github.com/flightlessmango/MangoHud.git
    cd MangoHud
  3. Run build script:
    ./build.sh build
  4. Observe the error.

Expected behavior

The build script installs the necessary libraries and builds the application successfully.

Bengt commented 12 months ago

I can work around this issue by resetting to the last release version:

git reset --hard v0.7.0
./build.sh build
gort818 commented 12 months ago

that is strange, sdl2 is disabled. it should look like this

imgui| Project name: imgui
imgui| Project version: 1.89.9
imgui| C++ compiler for the host machine: g++ -m32 (gcc 13.2.1 "g++ (GCC) 13.2.1 20230801")
imgui| C++ linker for the host machine: g++ -m32 ld.bfd 2.41.0
imgui| Library d3dcompiler found: NO
imgui| Library d3d9 skipped: feature dx9 disabled
imgui| Library d3d10 skipped: feature dx10 disabled
imgui| Library d3d11 skipped: feature dx11 disabled
imgui| Library d3d12 skipped: feature dx12 disabled
imgui| Dependency appleframeworks (modules: Foundation, AppKit, GameController, Metal) skipped: feature metal disabled
imgui| Dependency gl skipped: feature opengl disabled
imgui| Dependency sdl2 skipped: feature sdl_renderer disabled
imgui| Dependency vulkan skipped: feature vulkan disabled
imgui| Has header "webgpu/webgpu.h" skipped: feature webgpu disabled
imgui| Dependency glfw3 skipped: feature glfw disabled
imgui| Dependency sdl2 skipped: feature sdl2 disabled
imgui| Dependency appleframeworks (modules: Carbon, Cocoa, GameController) skipped: feature osx disabled
imgui| Library dwmapi skipped: feature win disabled
imgui| Dependency allegro-5 skipped: feature allegro5 disabled
imgui| Dependency allegro_primitives-5 skipped: feature allegro5 disabled
imgui| Build targets in project: 3
imgui| Subproject imgui finished.
gort818 commented 12 months ago

maybe we need to add sdl2 to the dependencies, can you try building again with libsdl2-dev installed

Bengt commented 12 months ago

Hi, @gort818! Thanks for the pointer. Installing libsdl2-dev does not help me as it is already installed:

$ sudo apt install libsdl2-dev
[sudo] password for bengt: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libsdl2-dev is already the newest version (2.0.20+dfsg-2ubuntu1.22.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
gort818 commented 12 months ago

You also have 32 bit library as well?

Bengt commented 12 months ago

No, I did not.

$ sudo apt install libsdl2-dev:i386
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  gir1.2-glib-2.0:i386 gir1.2-ibus-1.0:i386 libasound2-dev:i386 libblkid-dev:i386 libc6-dev:i386 libcrypt-dev:i386 libdbus-1-dev:i386
  libdecor-0-dev:i386 libdrm-dev:i386 libegl-dev:i386 libegl1-mesa-dev:i386 libffi-dev:i386 libgbm-dev:i386 libgirepository-1.0-1:i386
  libgl-dev:i386 libgles-dev:i386 libgles1:i386 libgles2:i386 libglib2.0-dev:i386 libglu1-mesa:i386 libglu1-mesa-dev:i386
  libglvnd-core-dev:i386 libglvnd-dev:i386 libglx-dev:i386 libibus-1.0-5:i386 libibus-1.0-dev:i386 libice-dev:i386 libice6:i386
  libmount-dev:i386 libnsl-dev:i386 libopengl-dev:i386 libopengl0:i386 libpciaccess-dev:i386 libpcre16-3:i386 libpcre2-16-0:i386
  libpcre2-32-0:i386 libpcre2-dev:i386 libpcre2-posix3:i386 libpcre3-dev:i386 libpcre32-3:i386 libpcrecpp0v5:i386
  libpthread-stubs0-dev:i386 libpulse-dev:i386 libpulse-mainloop-glib0:i386 libselinux1-dev:i386 libsepol-dev:i386 libsepol2:i386
  libsm-dev:i386 libsm6:i386 libsndio-dev:i386 libsndio7.0:i386 libtirpc-dev:i386 libudev-dev:i386 libwayland-dev:i386 libx11-dev:i386
  libxau-dev:i386 libxcb1-dev:i386 libxcursor-dev:i386 libxdmcp-dev:i386 libxext-dev:i386 libxfixes-dev:i386 libxi-dev:i386
  libxinerama-dev:i386 libxkbcommon-dev:i386 libxrandr-dev:i386 libxrender-dev:i386 libxss-dev:i386 libxt-dev:i386 libxt6:i386
  libxv-dev:i386 libxv1:i386 libxxf86vm-dev:i386 linux-libc-dev:i386 uuid-dev:i386 zlib1g-dev:i386
[apt go brr]
Bengt commented 12 months ago

I am now running into other problems:

[99/102] Linking target src/libMangoHud_dlsym.so
FAILED: src/libMangoHud_dlsym.so 
Bengt commented 12 months ago

I am trying this:

$ ./build.sh clean
Command: clean 
$ bash build.sh build
Command: build 
# Checking dependencies for "ubuntu"
# Missing dependencies:python3-pip python3-setuptools python3-wheel python3-matplotlib 
Do you wish the script to install these packages? [y/N]y
Attempting to install missing packages
[sudo] password for bengt: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  blt fonts-lyx javascript-common libboost-dev libboost1.74-dev libjs-jquery libjs-jquery-ui libjs-sphinxdoc libjs-underscore
  liblbfgsb0 libopenblas-dev libopenblas-pthread-dev libopenblas0 libopenblas0-pthread libpython3-dev libqhull-r8.0 libtk8.6
  libxsimd-dev python-matplotlib-data python3-appdirs python3-attr python3-beniget python3-brotli python3-cycler
  python3-decorator python3-dev python3-fonttools python3-fs python3-gast python3-kiwisolver python3-lz4 python3-mpmath
  python3-packaging python3-pil.imagetk python3-ply python3-pythran python3-scipy python3-sympy python3-tk python3-ufolib2
  python3-unicodedata2 tk8.6-blt2.5 unicode-data
[apt goes brr again]
Bengt commented 12 months ago

That worked! I can now install the latest version of the master branch.

Bengt commented 12 months ago

Thanks for the help, @gort818!

gort818 commented 12 months ago

No problem!, thanks for the report. seems we need to add those libs to dependencies.