Compare commits

...

4 Commits

Author SHA1 Message Date
Airren 82f75628e9
Merge 578acff2c9 into 3d46dc6969 2024-05-13 22:08:30 +01:00
Jakob P. Liljenberg 3d46dc6969
Merge pull request #838 from imwints/freebsd-static
Add missing linker flag for static links on FreeBSD
2024-05-13 23:05:12 +02:00
Steffen Winter b93206f038
Add missing linker flag for static links on FreeBSD
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278551
2024-05-13 22:47:03 +02:00
Airren 578acff2c9 Update readme with ubuntu install cmd and refact by collapsed block
Signed-off-by: Airren <qiang.ren@intel.com>
2024-04-15 15:55:26 +08:00
3 changed files with 39 additions and 14 deletions

View File

@ -193,6 +193,12 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
INSTALL_RPATH "/usr/local/lib/gcc${GCC_VERSION_MAJOR}"
BUILD_WITH_INSTALL_RPATH TRUE
)
# The gcc compiler wrapper doesn't add '--eh-frame-hdr' on FreeBSD with static builds
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278551
if(BTOP_STATIC)
target_link_options(btop PRIVATE LINKER:--eh-frame-hdr)
endif()
endif()
find_package(devstat REQUIRED)

View File

@ -97,17 +97,18 @@ ifneq ($(PLATFORM) $(ARCH),macos arm64)
endif
ifeq ($(STATIC),true)
ifeq ($(CXX_IS_CLANG) $(CLANG_WORKS),true true)
ifeq ($(CXX_IS_CLANG),true)
ifeq ($(shell $(CXX) -print-target-triple | grep gnu >/dev/null; echo $$?),0)
$(error $(shell printf "\033[1;91mERROR: \033[97m$(CXX) can't statically link glibc\033[0m"))
endif
else
override ADDFLAGS += -static-libgcc -static-libstdc++
endif
ifeq ($(PLATFORM_LC),linux)
override ADDFLAGS += -DSTATIC_BUILD -static -Wl,--fatal-warnings
else ifeq ($(PLATFORM_LC),freebsd)
override ADDFLAGS += -DSTATIC_BUILD
ifeq ($(PLATFORM_LC),$(filter $(PLATFORM_LC),freebsd linux))
override ADDFLAGS += -DSTATIC_BUILD -static
else
ifeq ($(CXX_IS_CLANG),false)
override ADDFLAGS += -static-libgcc -static-libstdc++
endif
endif
endif
@ -130,9 +131,13 @@ else ifeq ($(PLATFORM_LC),freebsd)
PLATFORM_DIR := freebsd
THREADS := $(shell getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)
SU_GROUP := wheel
override ADDFLAGS += -lm -lkvm -ldevstat -Wl,-rpath=/usr/local/lib/gcc$(CXX_VERSION_MAJOR)
ifneq ($(STATIC),true)
override ADDFLAGS += -lstdc++
override ADDFLAGS += -lm -lkvm -ldevstat
ifeq ($(STATIC),true)
override ADDFLAGS += -lelf -Wl,--eh-frame-hdr
endif
ifeq ($(CXX_IS_CLANG),false)
override ADDFLAGS += -lstdc++ -Wl,rpath=/usr/local/lib/gcc$(CXX_VERSION_MAJOR)
endif
export MAKE = gmake
else ifeq ($(PLATFORM_LC),macos)

View File

@ -324,25 +324,39 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
**Binary release (from native os repo)**
* **openSUSE**
<details><summary>openSUSE</summary><p>
* **Tumbleweed:**
```bash
sudo zypper in btop
```
* For all other versions, see [openSUSE Software: btop](https://software.opensuse.org/package/btop)
* **Fedora**
</p></details>
<details><summary>Fedora</summary><p>
```bash
sudo dnf install btop
```
* **RHEL/AlmaLinux 8+**
</p></details>
<details><summary>RHEL/AlmaLinux 8+</summary><p>
```bash
sudo dnf install epel-release
sudo dnf install btop
```
* **FreeBSD**
</p></details>
<details><summary>FreeBSD</summary><p>
```sh
pkg install btop
```
</p></details>
<details><summary>Ubuntu</summary><p>
```sh
sudo apt install btop
```
</p></details>
**Binary release on Homebrew (macOS (x86_64 & ARM64) / Linux (x86_64))**