btop
btop copied to clipboard
[BUG] Fix warnings on OpenBSD during build with clang++
On OpenBSD current/amd64, with recent updates of libc++ (sync with LLVM 16.0.6), it's possible to build/linkg btop
with clang++
compiler (version 16.0.6).
During compilation, there are some warnings:
$ gmake CXX=clang++
PLATFORM ?| OpenBSD
ARCH ?| amd64
GPU_SUPPORT :| false
CXX ?| clang++ (16.0.6)
THREADS :| 2
REQFLAGS !| -std=c++20
WARNFLAGS :| -Wall -Wextra -pedantic
OPTFLAGS :| -O2 -ftree-vectorize -flto=thin
LDCXXFLAGS :| -pthread -D_GLIBCXX_ASSERTIONS -D_FILE_OFFSET_BITS=64 -fexceptions -fstack-clash-protection -fcf-protection -fstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -lkvm
CXXFLAGS +| $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
LDFLAGS +| $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
Compiling src/btop.cpp
clang++: warning: -lkvm: 'linker' input unused [-Wunused-command-line-argument]
clang++: warning: argument unused during compilation: '-fstack-clash-protection' [-Wunused-command-line-argument]
Compiling src/btop_config.cpp
clang++: warning: -lkvm: 'linker' input unused [-Wunused-command-line-argument]
clang++: warning: argument unused during compilation: '-fstack-clash-protection' [-Wunused-command-line-argument]
9% -> obj/btop_config.o (560KiB) (13s)
Compiling src/btop_draw.cpp
clang++: warning: -lkvm: 'linker' input unused [-Wunused-command-line-argument]
clang++: warning: argument unused during compilation: '-fstack-clash-protection' [-Wunused-command-line-argument]
18% -> obj/btop.o (640KiB) (14s)
(...)
To fix these warnings, Makefile
must be modified:
- remove
-fstack-clash-protection
flag - add
-lkvm
flag only for linking, not for build
These warnings are really verbose and can be ignored safely. If it still bugs you, you can disable them with -Wno-unused-command-line-argument
. The same thing happens on FreeBSD and macOS as well.