flightlessmango/MangoHud

WError: warn_unused_result

unphased opened this issue · 4 comments

Describe the bug
Cannot build from source.

List relevant hardware/software information

  • Ubuntu 22.04
  • MangoHud version v0.7.2-rc2 and master (7f43987)
  • GPU (irrelevant, but 3080Ti)

To Reproduce

  • clone repo
  • ./build.sh build
[18/93] Compiling C++ object src/libMangoHud.a.p/shell.cpp.o
FAILED: src/libMangoHud.a.p/shell.cpp.o
c++ -Isrc/libMangoHud.a.p -Isrc -I../../src -I../../include -Isubprojects/imgui-1.89.9 -I../../subprojects/imgui-1.89.9 -I../../subprojects/imgui-1.89.9/backends -I../../subprojects/spdlog-1.13.0/include -I../../subprojects/Vulkan-Headers-1.2.158/include -I../../subprojects/nlohmann_json-3.10.5/single_include -Isubprojects/implot-0.16 -I../../subprojects/implot-0.16 -I. -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -fvisibility=hidden -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c++14 -O3 -Wno-unused-parameter -fno-math-errno -fno-trapping-math -Wno-non-virtual-dtor -Wno-missing-field-initializers -fPIC -pthread '-DIMGUI_API=__attribute__((visibility("default")))' -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="v0.7.1"' -DSPDLOG_COMPILED_LIB -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG -D_GNU_SOURCE -DHAVE_PTHREAD -DUSE_GCC_ATOMIC_BUILTINS -DHAVE_TIMESPEC_GET -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE '-DMANGOHUD_ARCH="64bit"' -DHAVE_NVML -DHAVE_XNVCTRL -DHAVE_X11 -DHAVE_WAYLAND -DHAVE_DBUS -DVK_USE_PLATFORM_XLIB_KHR -DVK_USE_PLATFORM_WAYLAND_KHR -MD -MQ src/libMangoHud.a.p/shell.cpp.o -MF src/libMangoHud.a.p/shell.cpp.o.d -o src/libMangoHud.a.p/shell.cpp.o -c ../../src/shell.cpp
../../src/shell.cpp: In constructor ‘Shell::Shell()’:
../../src/shell.cpp:40:9: error: ignoring return value of ‘int pipe(int*)’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
   40 |     pipe(to_shell);
      |     ~~~~^~~~~~~~~~
../../src/shell.cpp:41:9: error: ignoring return value of ‘int pipe(int*)’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
   41 |     pipe(from_shell);
      |     ~~~~^~~~~~~~~~~~
In file included from ../../src/shell.cpp:1:
../../src/shell.h: In member function ‘void Shell::writeCommand(const string&)’:
../../src/shell.h:25:14: error: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
   25 |         write(to_shell[1], command.c_str(), command.length());
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/shell.cpp: In destructor ‘Shell::~Shell()’:
../../src/shell.cpp:69:10: error: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
   69 |     write(to_shell[1], "exit\n", 5);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
[35/93] Compiling C++ object src/libMangoHud.a.p/overlay_params.cpp.o
ninja: build stopped: subcommand failed.

Workaround: installed via apt

Since I can't use GOverlay with the mangohud from apt, i kept trying, and it looks like v0.7.1 is compiling.

Should be fixed here cdd8043

@flightlessmango Still not building for me. Unless I am doing it wrong. I am deleting the Mangohud directory. Doing a fresh git clone then running the build script.

https://gist.github.com/ChaosBlades/f29c9485da8c22e04bfaf50249b0b309

Ah yes sorry, I forgot to fix that one too. 976ae0f
hopefully it works now