flightlessmango/MangoHud

Building 32-bit fails on 64-bit systems

lixiaolong2007 opened this issue · 7 comments

Describe the bug
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

List relevant hardware/software information

  • Linux Distribution:debian 12 64bit
  • MangoHud version: 0.7.2
  • GPU: MX150

To Reproduce
Steps to reproduce the behavior:
1、export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/i386-linux-gnu
2、Build 32-bit

vega9500@vega9500:~/MangoHud$ echo $LD_LIBRARY_PATH

vega9500@vega9500:~/MangoHud$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/i386-linux-gnu
vega9500@vega9500:~/MangoHud$ echo $LD_LIBRARY_PATH
:/usr/lib/i386-linux-gnu
vega9500@vega9500:~/MangoHud$ CC="gcc -m32" \
CXX="g++ -m32" \
PKG_CONFIG_PATH="/usr/lib32/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig" \
meson build32 --libdir lib32
ninja -C build32 install
The Meson build system
Version: 1.0.1
Source dir: /home/vega9500/MangoHud
Build dir: /home/vega9500/MangoHud/build32
Build type: native build
Project name: MangoHud
Project version: v0.7.1
C compiler for the host machine: gcc -m32 (gcc 12.2.0 "gcc (Debian 12.2.0-14) 12.2.0")
C linker for the host machine: gcc -m32 ld.bfd 2.40
C++ compiler for the host machine: g++ -m32 (gcc 12.2.0 "g++ (Debian 12.2.0-14) 12.2.0")
C++ linker for the host machine: g++ -m32 ld.bfd 2.40
Host machine cpu family: x86
Host machine cpu: i686
Program python3 (mako) found: YES (/usr/bin/python3) modules: mako
Checking if "GCC atomic builtins" compiles: YES 
Checking if "Supports timespec_get" compiles: YES 
Checking for function "bswap32" : YES 
Checking for function "bswap64" : YES 
Checking for function "clz" : YES 
Checking for function "clzll" : YES 
Checking for function "ctz" : YES 
Checking for function "expect" : YES 
Checking for function "ffs" : YES 
Checking for function "ffsll" : YES 
Checking for function "popcount" : YES 
Checking for function "popcountll" : YES 
Checking for function "unreachable" : YES 
Found pkg-config: /usr/bin/pkg-config (1.8.1)
Run-time dependency x11 found: YES 1.8.4
Run-time dependency wayland-client found: YES 1.21.0
Run-time dependency dbus-1 found: YES 1.14.10
Run-time dependency xkbcommon found: YES 1.5.0
Run-time dependency threads found: YES
Compiler for C supports arguments -Werror=implicit-function-declaration: YES 
Compiler for C supports arguments -Werror=missing-declarations: YES 
Compiler for C supports arguments -Werror=missing-prototypes: YES 
Compiler for C supports arguments -Werror=return-type: YES 
Compiler for C supports arguments -Werror=incompatible-pointer-types: YES 
Compiler for C supports arguments -Wno-unused-parameter: YES 
Compiler for C supports arguments -Qunused-arguments: NO 
Compiler for C supports arguments -fno-math-errno: YES 
Compiler for C supports arguments -fno-trapping-math: YES 
Compiler for C supports arguments -Wno-missing-field-initializers: YES 
Compiler for C++ supports arguments -Werror=missing-declarations: YES 
Compiler for C++ supports arguments -Werror=return-type: YES 
Compiler for C++ supports arguments -Wno-unused-parameter: YES 
Compiler for C++ supports arguments -Qunused-arguments: NO 
Compiler for C++ supports arguments -fno-math-errno: YES 
Compiler for C++ supports arguments -fno-trapping-math: YES 
Compiler for C++ supports arguments -Wno-non-virtual-dtor: YES 
Compiler for C++ supports arguments -Wno-missing-field-initializers: YES 
Checking for function "dlopen" : YES 
Checking for function "clock_gettime" : YES 
Downloading vulkan-headers source from https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.2.158.tar.gz
Downloading file of unknown size.
Downloading vulkan-headers patch from https://wrapdb.mesonbuild.com/v2/vulkan-headers_1.2.158-2/get_patch
Download size: 1107
Downloading: ..........

Executing subproject vulkan-headers 

vulkan-headers| Project name: vulkan-headers
vulkan-headers| Project version: 1.2.158
vulkan-headers| C compiler for the host machine: gcc -m32 (gcc 12.2.0 "gcc (Debian 12.2.0-14) 12.2.0")
vulkan-headers| C linker for the host machine: gcc -m32 ld.bfd 2.40
vulkan-headers| Build targets in project: 1
vulkan-headers| Subproject vulkan-headers finished.

Checking for size of "void*" : 4
Downloading imgui source from https://github.com/ocornut/imgui/archive/refs/tags/v1.89.9.tar.gz
Download size: 1609452
Downloading: ..........
Downloading imgui patch from https://wrapdb.mesonbuild.com/v2/imgui_1.89.9-1/get_patch
Download size: 2413
Downloading: ..........

Executing subproject imgui 

imgui| Project name: imgui
imgui| Project version: 1.89.9
imgui| C++ compiler for the host machine: g++ -m32 (gcc 12.2.0 "g++ (Debian 12.2.0-14) 12.2.0")
imgui| C++ linker for the host machine: g++ -m32 ld.bfd 2.40
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.

Downloading implot source from https://github.com/epezent/implot/archive/refs/tags/v0.16.zip
Downloading file of unknown size.
Downloading implot patch from https://wrapdb.mesonbuild.com/v2/implot_0.16-1/get_patch
Download size: 1226
Downloading: ..........

Executing subproject implot 

implot| Project name: ImGui Plotting Library
implot| Project version: 0.16
implot| C++ compiler for the host machine: g++ -m32 (gcc 12.2.0 "g++ (Debian 12.2.0-14) 12.2.0")
implot| C++ linker for the host machine: g++ -m32 ld.bfd 2.40
implot| Build targets in project: 4
implot| Subproject implot finished.

Library spdlog skipped: feature use_system_spdlog disabled
Downloading spdlog source from https://github.com/gabime/spdlog/archive/refs/tags/v1.13.0.tar.gz
Download size: 264003
Downloading: ..........
Downloading spdlog patch from https://wrapdb.mesonbuild.com/v2/spdlog_1.13.0-1/get_patch
Download size: 2959
Downloading: ..........

Executing subproject spdlog 

spdlog| Project name: spdlog
spdlog| Project version: 1.13.0
spdlog| C++ compiler for the host machine: g++ -m32 (gcc 12.2.0 "g++ (Debian 12.2.0-14) 12.2.0")
spdlog| C++ linker for the host machine: g++ -m32 ld.bfd 2.40
spdlog| Dependency threads found: YES unknown (cached)
spdlog| Header "format" has symbol "__cpp_lib_format" skipped: feature std_format disabled
spdlog| Dependency fmt skipped: feature external_fmt disabled
spdlog| Build targets in project: 5
spdlog| Subproject spdlog finished.

Found CMake: /usr/bin/cmake (3.25.1)
Run-time dependency nlohmann_json found: NO (tried pkgconfig and cmake)
Looking for a fallback subproject for the dependency nlohmann_json
Downloading nlohmann_json source from https://github.com/nlohmann/json/releases/download/v3.10.5/include.zip
Download size: 260679
Downloading: ..........

Executing subproject nlohmann_json 

nlohmann_json| Project name: nlohmann_json
nlohmann_json| Project version: 3.10.5
nlohmann_json| C++ compiler for the host machine: g++ -m32 (gcc 12.2.0 "g++ (Debian 12.2.0-14) 12.2.0")
nlohmann_json| C++ linker for the host machine: g++ -m32 ld.bfd 2.40
nlohmann_json| Build targets in project: 5
nlohmann_json| Subproject nlohmann_json finished.

Dependency nlohmann_json from subproject subprojects/nlohmann_json-3.10.5 found: YES 3.10.5
Program glslangValidator found: YES (/usr/bin/glslangValidator)
Program git found: YES (/usr/bin/git)
Has header "NVCtrl/NVCtrl.h" : YES 
Compiler for C supports link arguments -Wl,-Bsymbolic-functions: YES 
Compiler for C supports link arguments -Wl,-z,relro: YES 
Compiler for C supports link arguments -Wl,--exclude-libs,ALL: YES 
Compiler for C supports link arguments -lGL: YES 
Compiler for C supports link arguments -static-libstdc++: YES 
WARNING: extract_all_objects called without setting recursive
keyword argument. Meson currently defaults to
non-recursive to maintain backward compatibility but
the default will be changed in the future.

Configuring MangoHud.x86.json using configuration
Configuring mangohud using configuration
Program appstreamcli found: YES (/usr/bin/appstreamcli)
Build targets in project: 11

MangoHud v0.7.1

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

  User defined options
    libdir        : lib32

Found ninja-1.11.1 at /usr/bin/ninja
WARNING: Running the setup command as `meson [options]` instead of `meson setup [options]` is ambiguous and deprecated.
ninja: Entering directory `build32'
[9/114] Generating src/overlay.frag.spv.h with a custom command
../src/overlay.frag
[10/114] Generating src/overlay.vert.spv.h with a custom command
../src/overlay.vert
[111/114] Linking target src/libMangoHud_dlsym.so
FAILED: src/libMangoHud_dlsym.so 
g++ -m32  -o src/libMangoHud_dlsym.so src/libMangoHud_dlsym.so.p/elfhacks.cpp.o src/libMangoHud_dlsym.so.p/real_dlsym.cpp.o src/libMangoHud_dlsym.so.p/hook_dlsym.cpp.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libMangoHud_dlsym.so -Wl,-rpath,/usr/lib/x86_64-linux-gnu -Wl,-rpath-link,/usr/lib/x86_64-linux-gnu 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,/home/vega9500/MangoHud/src/mangohud.version /usr/lib/x86_64-linux-gnu/libwayland-client.so /usr/lib/x86_64-linux-gnu/libxkbcommon.so -Wl,--end-group -pthread
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libwayland-client.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
[112/114] Linking target src/libMangoHud.so
FAILED: src/libMangoHud.so 
g++ -m32  -o src/libMangoHud.so src/libMangoHud.a.p/vulkan.cpp.o src/libMangoHud.a.p/mesa_util_os_socket.c.o src/libMangoHud.a.p/mesa_util_os_time.c.o src/libMangoHud.a.p/hud_elements.cpp.o src/libMangoHud.a.p/overlay.cpp.o src/libMangoHud.a.p/overlay_params.cpp.o src/libMangoHud.a.p/font.cpp.o src/libMangoHud.a.p/keybinds.cpp.o src/libMangoHud.a.p/font_unispace.c.o src/libMangoHud.a.p/logging.cpp.o src/libMangoHud.a.p/config.cpp.o src/libMangoHud.a.p/gpu.cpp.o src/libMangoHud.a.p/blacklist.cpp.o src/libMangoHud.a.p/file_utils.cpp.o src/libMangoHud.a.p/cpu.cpp.o src/libMangoHud.a.p/memory.cpp.o src/libMangoHud.a.p/iostats.cpp.o src/libMangoHud.a.p/notify.cpp.o src/libMangoHud.a.p/elfhacks.cpp.o src/libMangoHud.a.p/real_dlsym.cpp.o src/libMangoHud.a.p/pci_ids.cpp.o src/libMangoHud.a.p/battery.cpp.o src/libMangoHud.a.p/control.cpp.o src/libMangoHud.a.p/device.cpp.o src/libMangoHud.a.p/amdgpu.cpp.o src/libMangoHud.a.p/intel.cpp.o src/libMangoHud.a.p/msm.cpp.o src/libMangoHud.a.p/net.cpp.o src/libMangoHud.a.p/shell.cpp.o src/libMangoHud.a.p/nvml.cpp.o src/libMangoHud.a.p/loaders_loader_nvml.cpp.o src/libMangoHud.a.p/loaders_loader_nvctrl.cpp.o src/libMangoHud.a.p/nvctrl.cpp.o src/libMangoHud.a.p/loaders_loader_x11.cpp.o src/libMangoHud.a.p/shared_x11.cpp.o src/libMangoHud.a.p/wayland_hook.cpp.o src/libMangoHud.a.p/wayland_keybinds.cpp.o src/libMangoHud.a.p/dbus.cpp.o src/libMangoHud.a.p/loaders_loader_dbus.cpp.o src/libMangoHud.a.p/meson-generated_.._.._vk_enum_to_str.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libMangoHud.so -Wl,-rpath,/usr/lib/x86_64-linux-gnu -Wl,-rpath-link,/usr/lib/x86_64-linux-gnu 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,/home/vega9500/MangoHud/src/mangohud.version /usr/lib/x86_64-linux-gnu/libwayland-client.so /usr/lib/x86_64-linux-gnu/libxkbcommon.so -Wl,--end-group -pthread
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libwayland-client.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
[113/114] Linking target src/libMangoHud_opengl.so
FAILED: src/libMangoHud_opengl.so 
g++ -m32  -o src/libMangoHud_opengl.so src/libMangoHud_opengl.so.p/gl_glad.c.o src/libMangoHud_opengl.so.p/gl_gl_renderer.cpp.o src/libMangoHud_opengl.so.p/gl_gl_hud.cpp.o src/libMangoHud_opengl.so.p/gl_inject_egl.cpp.o src/libMangoHud_opengl.so.p/loaders_loader_glx.cpp.o src/libMangoHud_opengl.so.p/gl_inject_glx.cpp.o src/libMangoHud_opengl.so.p/hud_elements.cpp.o src/libMangoHud_opengl.so.p/overlay.cpp.o src/libMangoHud_opengl.so.p/overlay_params.cpp.o src/libMangoHud_opengl.so.p/font.cpp.o src/libMangoHud_opengl.so.p/keybinds.cpp.o src/libMangoHud_opengl.so.p/font_unispace.c.o src/libMangoHud_opengl.so.p/logging.cpp.o src/libMangoHud_opengl.so.p/config.cpp.o src/libMangoHud_opengl.so.p/gpu.cpp.o src/libMangoHud_opengl.so.p/blacklist.cpp.o src/libMangoHud_opengl.so.p/file_utils.cpp.o src/libMangoHud_opengl.so.p/cpu.cpp.o src/libMangoHud_opengl.so.p/memory.cpp.o src/libMangoHud_opengl.so.p/iostats.cpp.o src/libMangoHud_opengl.so.p/notify.cpp.o src/libMangoHud_opengl.so.p/elfhacks.cpp.o src/libMangoHud_opengl.so.p/real_dlsym.cpp.o src/libMangoHud_opengl.so.p/pci_ids.cpp.o src/libMangoHud_opengl.so.p/battery.cpp.o src/libMangoHud_opengl.so.p/control.cpp.o src/libMangoHud_opengl.so.p/device.cpp.o src/libMangoHud_opengl.so.p/amdgpu.cpp.o src/libMangoHud_opengl.so.p/intel.cpp.o src/libMangoHud_opengl.so.p/msm.cpp.o src/libMangoHud_opengl.so.p/net.cpp.o src/libMangoHud_opengl.so.p/shell.cpp.o src/libMangoHud_opengl.so.p/nvml.cpp.o src/libMangoHud_opengl.so.p/loaders_loader_nvml.cpp.o src/libMangoHud_opengl.so.p/loaders_loader_nvctrl.cpp.o src/libMangoHud_opengl.so.p/nvctrl.cpp.o src/libMangoHud_opengl.so.p/loaders_loader_x11.cpp.o src/libMangoHud_opengl.so.p/shared_x11.cpp.o src/libMangoHud_opengl.so.p/wayland_hook.cpp.o src/libMangoHud_opengl.so.p/wayland_keybinds.cpp.o src/libMangoHud_opengl.so.p/dbus.cpp.o src/libMangoHud_opengl.so.p/loaders_loader_dbus.cpp.o src/libMangoHud_opengl.so.p/mesa_util_os_socket.c.o src/libMangoHud_opengl.so.p/mesa_util_os_time.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libMangoHud_opengl.so -Wl,-rpath,/usr/lib/x86_64-linux-gnu -Wl,-rpath-link,/usr/lib/x86_64-linux-gnu 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,/home/vega9500/MangoHud/src/mangohud.version /usr/lib/x86_64-linux-gnu/libwayland-client.so /usr/lib/x86_64-linux-gnu/libxkbcommon.so -Wl,--end-group -pthread
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libwayland-client.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

You don't have the 32bit Wayland client dependency installed

You don't have the 32bit Wayland client dependency installed

In fact I installed it and I manually pointed to the 32 bit libraries

If not installed it will indicate missing dependencies before building

If not installed it will indicate missing dependencies before building

This was not my experience. As the error shows, he will accept 64bit dependency for 32bit build but then fail because he's trying to use the 64bit lib

Building 64bit and 32bit in a debian:12 container works fine using build.sh
Double check that you have all the deps that are in https://github.com/flightlessmango/MangoHud/blob/master/build_deps.sh

I reinstalled the dependencies according to build.sh, and I built it multiple times, only succeeding once. I think it’s an issue with meson build32 --libdir lib32 , as it doesn’t seem to be able to correctly link to the 32-bit libraries,I tried changing it to meson build32 --libdir lib/i386-linux-gnu and it succeeded

Thank you very much