aristocratos / btop

A monitor of resources
Apache License 2.0
21.37k stars 655 forks source link

[BUG] Build fails in Ubuntu 20.04 using gcc 13.2.0 #795

Open codeapparat opened 8 months ago

codeapparat commented 8 months ago

Describe the bug Can't compile btop under Ubuntu 20.04, using g++ 13.2.0, it fails at linking time. When typing make I get:

PLATFORM ?| Linux ARCH ?| x86_64 GPU_SUPPORT :| true CXX ?| /opt/gcc-13.2.0/bin/g++ (13.2.0) THREADS :| 6 REQFLAGS !| -std=c++20 WARNFLAGS :| -Wall -Wextra -pedantic OPTFLAGS :| -O2 -ftree-vectorize -flto=6 LDCXXFLAGS :| -pthread -DFMT_HEADER_ONLY -D_GLIBCXX_ASSERTIONS -D_FILE_OFFSET_BITS=64 -fexceptions -fstack-clash-protection -fcf-protection -fstack-protector -DGPU_SUPPORT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 CXXFLAGS +| $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS) LDFLAGS +| $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)

Building btop++ (v1.3.2) Linux x86_64 Command 'lowdown' not found: skipping generating man page btop.1 ... Configuring obj/config.h Compiling src/btop.cpp Compiling src/btop_menu.cpp Compiling src/btop_input.cpp Compiling src/btop_shared.cpp Compiling src/btop_draw.cpp ... Linking and optimizing binary... /usr/bin/ld: /tmp/ccj2IUfF.ltrans17.ltrans.o: in function `Shared::init()':

:(.text+0x5cf7): undefined reference to `dlopen' /usr/bin/ld: :(.text+0x5d12): undefined reference to `dlopen' /usr/bin/ld: :(.text+0x611b): undefined reference to `dlerror' /usr/bin/ld: /tmp/ccj2IUfF.ltrans23.ltrans.o: in function `Gpu::Rsmi::init()::{lambda(char const*)#1}::operator()(char const*) const [clone .isra.0]': :(.text+0x19): undefined reference to `dlsym' /usr/bin/ld: :(.text+0x21): undefined reference to `dlerror' /usr/bin/ld: /tmp/ccj2IUfF.ltrans23.ltrans.o: in function `Gpu::Nvml::init()::{lambda(char const*)#1}::operator()(char const*) const [clone .isra.0]': :(.text+0x4a4d): undefined reference to `dlsym' /usr/bin/ld: :(.text+0x4a55): undefined reference to `dlerror' /usr/bin/ld: /tmp/ccj2IUfF.ltrans23.ltrans.o: in function `Gpu::Rsmi::init() [clone .isra.0]': :(.text+0x4c50): undefined reference to `dlopen' /usr/bin/ld: :(.text+0x4c6a): undefined reference to `dlerror' /usr/bin/ld: /tmp/ccj2IUfF.ltrans23.ltrans.o: in function `Gpu::Nvml::shutdown() [clone .isra.0]': :(.text+0x4974): undefined reference to `dlclose' /usr/bin/ld: /tmp/ccj2IUfF.ltrans23.ltrans.o: in function `Gpu::Rsmi::shutdown() [clone .isra.0]': :(.text+0x4bcc): undefined reference to `dlclose' collect2: error: ld returned 1 exit status make: *** [Makefile:383: btop] Error 1 **To Reproduce** Ubuntu 20.04, compile gcc 13.2.0 and set CXX to the new g++ binary. `git clone https://github.com/aristocratos/btop.git ` `cd btop` ` make CXX=/opt/gcc-13.2.0/bin/g++` **Expected behavior** btop binary gets created after `make` **Info (please complete the following information):** - btop++ version: 1.3.2 (from git) - Architecture: x86_64 - Platform: Ubuntu 20.04 - Linux Kernel: 5.8.0-63-generic **Thank you very much, for this amazing tool!**
imwints commented 8 months ago

Read the README.md and search for similar issues before posting a bug report!

Duplicate of #704 #725 #730

Please upgrade to a newer version of your distro.

alalazo commented 8 months ago

@imwints Maybe getting four duplicates of the same issue means the use case is not as unusual as was initially thought?

arubin commented 2 months ago

For reference, I solved this issue by adding the line: target_link_libraries(btop dl) To the linking section towards the end of CMakeLists.txt

alalazo commented 2 months ago

@arubin See #725 :wink: