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.13k stars 262 forks source link

Building fails when with_x11 is set to disabled #1281

Closed nokia8801 closed 3 months ago

nokia8801 commented 3 months ago

Describe the bug Fails building when with_x11=disabled is set. It builds when with_x11=enabled is set.

List relevant hardware/software information

To Reproduce Steps to reproduce the behavior:

  1. Clone the AUR package.
  2. Edit PKGBUILD and add:
        -Dwith_nvml=disabled \
        -Dwith_xnvctrl=disabled \
        -Dwith_dbus=enabled \
        -Dwith_x11=disabled \
        -Dwith_wayland=enabled \
  3. makepkg -src

Expected behavior It should build? Unless Wayland only isn't possible?

Additional context I don't have an NVIDIA GPU in this PC and I also try to keep my system Wayland native as possible. MangoHud is one of the last remnants of X11 on my system next to Steam. I figured I would try my luck at building a version without libx11.

...
MangoHud v0.7.1

  Subprojects
    imgui             : YES
    implot            : YES
    spdlog            : YES
    vulkan-headers    : YES

  User defined options
    auto_features     : enabled
    buildtype         : plain
    libexecdir        : lib
    prefix            : /usr
    sbindir           : bin
    wrap_mode         : nofallback
    python.bytecompile: 1
    b_pie             : true
    mangoapp          : true
    mangoapp_layer    : true
    mangohudctl       : true
    with_dbus         : enabled
    with_nvml         : disabled
    with_wayland      : enabled
    with_x11          : disabled
    with_xnvctrl      : disabled

Found ninja-1.11.1 at /usr/bin/ninja
INFO: autodetecting backend as ninja                                                                                                                                                                    
INFO: calculating backend command to run: /usr/bin/ninja -C /tmp/makepkg/mangohud-git/src/build
ninja: Entering directory `/tmp/makepkg/mangohud-git/src/build'
[6/115] Generating src/overlay.vert.spv.h with a custom command
../MangoHud/src/overlay.vert
[7/115] Generating src/overlay.frag.spv.h with a custom command
../MangoHud/src/overlay.frag
[44/115] Compiling C++ object src/libMangoHud.a.p/shell.cpp.o
...
[113/115] Linking target src/mangoapp
FAILED: src/mangoapp 
c++  -o src/mangoapp src/mangoapp.p/app_main.cpp.o -Wl,--as-needed -Wl,--no-undefined -pie -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -falign-functions=32 -march=rocketlake -O3 -mtune=rocketlake -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mpclmul -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -falign-functions=32 -Wl,--start-group src/libMangoHud.a subprojects/imgui-1.89.9/libimgui.a subprojects/spdlog-1.13.0/src/libspdlog.a subprojects/implot-0.16/libimplot.a -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--exclude-libs,ALL -lGL -static-libstdc++ -Wl,--version-script,/tmp/makepkg/mangohud-git/src/MangoHud/src/mangohud.version -pthread /usr/lib/libwayland-client.so /usr/lib/libglfw.so /usr/lib/libGLEW.so /usr/lib/libEGL.so /usr/lib/libGL.so /usr/lib/libGLU.so /usr/lib/libOpenGL.so /usr/lib/libxkbcommon.so -ldl -Wl,--end-group
/usr/bin/ld: /tmp/cczvMakn.ltrans0.ltrans.o: undefined reference to symbol 'XInternAtom'
/usr/bin/ld: /usr/lib/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
[115/115] Linking target src/libMangoHud.so
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...

I also tried building with mold as the linker to see if there was any more info. I created another issue about mold as it either fails or throws warning but that is separate from this. Here are the mold errors for with_x11=disabled:

mold: error: undefined symbol: XFree
>>> referenced by <artificial>
>>>               /tmp/cckUjnbr.ltrans0.ltrans.o:(get_prop(char const*))
mold: error: undefined symbol: XSync
>>> referenced by <artificial>
>>>               /tmp/cckUjnbr.ltrans0.ltrans.o:(main)>>> referenced by <artificial>
>>>               /tmp/cckUjnbr.ltrans0.ltrans.o:(main)
mold: error: undefined symbol: XInternAtom
>>> referenced by <artificial>
>>>               /tmp/cckUjnbr.ltrans0.ltrans.o:(get_prop(char const*))>>> referenced by <artificial>
>>>               /tmp/cckUjnbr.ltrans0.ltrans.o:(main)>>> referenced by <artificial>
>>>               /tmp/cckUjnbr.ltrans0.ltrans.o:(main)>>> referenced 1 more times

mold: error: undefined symbol: XChangeProperty
>>> referenced by <artificial>
>>>               /tmp/cckUjnbr.ltrans0.ltrans.o:(main)>>> referenced by <artificial>
>>>               /tmp/cckUjnbr.ltrans0.ltrans.o:(main)>>> referenced by <artificial>
>>>               /tmp/cckUjnbr.ltrans0.ltrans.o:(main)>>> referenced 1 more times

mold: error: undefined symbol: XGetWindowProperty

This is my Minecraft PC which uses GLFW 3.4, which can run Minecraft natively over Wayland. If I can make MangoHud Wayland only as well, it would be great.

flightlessmango commented 3 months ago

Should be fixed here 01b81d068b462cfb21b3671897e17493e6940d26