Skip to content

Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic

build(linux): self-contained binaries, nothing to install except GTK3 for the GUI

anof-cyberee065e1e1dd0
diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml
index 9663289..afcb063 100644
--- a/.github/workflows/build-linux.yml
+++ b/.github/workflows/build-linux.yml
@@ -29,12 +29,11 @@ jobs:
build-essential \
gcc \
make \
+ bzip2 \
clang \
linux-tools-common \
linux-tools-generic \
libbpf-dev \
- libelf-dev \
- zlib1g-dev \
libgtk-3-dev \
pkg-config
shell: bash
@@ -151,17 +150,21 @@ jobs:
run: |
set -e
out="$PWD/Linux/output"
- run_in() { # image, install command
+ # The library and the command line program must run in a bare image with nothing installed; only the GUI needs GTK3.
+ run_in() { # image, command that installs GTK3 for the GUI check
echo "::group::$1"
- docker run --rm -v "$out:/out:ro" "$1" sh -c "$2 >/dev/null 2>&1 &&
- LD_LIBRARY_PATH=/out /out/ProxyBridge --help | grep -q -- '--profile' && echo 'CLI starts' &&
- missing=\$(LD_LIBRARY_PATH=/out ldd /out/ProxyBridge /out/libproxybridge.so /out/ProxyBridgeGUI 2>&1 | grep 'not found' || true) &&
- if [ -n \"\$missing\" ]; then echo \"missing: \$missing\"; exit 1; fi && echo 'all libraries resolve'"
+ docker run --rm -v "$out:/out:ro" "$1" sh -c "
+ /out/ProxyBridge --help | grep -q -- '--profile' && echo 'CLI starts with nothing installed' &&
+ missing=\$(ldd /out/ProxyBridge /out/libproxybridge.so 2>&1 | grep 'not found' || true) &&
+ if [ -n \"\$missing\" ]; then echo \"missing: \$missing\"; exit 1; fi && echo 'CLI and library: all libraries resolve' &&
+ $2 >/dev/null 2>&1 &&
+ missing=\$(LD_LIBRARY_PATH=/out ldd /out/ProxyBridgeGUI 2>&1 | grep 'not found' || true) &&
+ if [ -n \"\$missing\" ]; then echo \"missing: \$missing\"; exit 1; fi && echo 'GUI: all libraries resolve with GTK3'"
echo "::endgroup::"
}
- run_in ubuntu:22.04 "apt-get update && apt-get install -y libelf1 zlib1g libgtk-3-0"
- run_in debian:12 "apt-get update && apt-get install -y libelf1 zlib1g libgtk-3-0"
- run_in fedora:40 "dnf install -y elfutils-libelf zlib gtk3"
+ run_in ubuntu:22.04 "apt-get update && apt-get install -y libgtk-3-0"
+ run_in debian:12 "apt-get update && apt-get install -y libgtk-3-0"
+ run_in fedora:40 "dnf install -y gtk3"
shell: bash
- name: Verify the build left the source tree clean
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 4cf38a6..32fad0f 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -178,11 +178,10 @@ jobs:
make \
clang \
curl \
+ bzip2 \
linux-tools-common \
linux-tools-generic \
libbpf-dev \
- libelf-dev \
- zlib1g-dev \
libgtk-3-dev \
pkg-config
shell: bash
diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml
index 86d5986..bc5b232 100644
--- a/.github/workflows/release-linux.yml
+++ b/.github/workflows/release-linux.yml
@@ -35,12 +35,11 @@ jobs:
build-essential \
gcc \
make \
+ bzip2 \
clang \
linux-tools-common \
linux-tools-generic \
libbpf-dev \
- libelf-dev \
- zlib1g-dev \
libgtk-3-dev \
pkg-config
shell: bash
diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml
index d313e8a..c040fa0 100644
--- a/.github/workflows/sonarqube.yml
+++ b/.github/workflows/sonarqube.yml
@@ -108,11 +108,10 @@ jobs:
make \
clang \
curl \
+ bzip2 \
linux-tools-common \
linux-tools-generic \
libbpf-dev \
- libelf-dev \
- zlib1g-dev \
libgtk-3-dev \
pkg-config
shell: bash
diff --git a/Linux/README.md b/Linux/README.md
index 60f1800..2ed505e 100644
--- a/Linux/README.md
+++ b/Linux/README.md
@@ -35,7 +35,7 @@ curl -Lo deploy.sh https://raw.githubusercontent.com/InterceptSuite/ProxyBridge/
This script will:
- Download the latest release from GitHub automatically
- Detect your Linux distribution
-- Install all required dependencies (libelf, zlib, GTK3)
+- Install GTK3 if the GUI is included and GTK3 is missing (the command line program needs nothing)
- Install ProxyBridge CLI, GUI, and library to system paths
- Update library cache (ldconfig)
- Verify installation
@@ -64,7 +64,7 @@ This script will:
```
The setup script will:
-- Install runtime dependencies (libelf, zlib, GTK3)
+- Install GTK3 if the GUI is included and it is missing (the command line program is a single self-contained file)
- Copy binaries to `/usr/local/bin` (ProxyBridge CLI and GUI)
- Copy library to `/usr/local/lib` (libproxybridge.so)
- Update library cache
@@ -344,9 +344,9 @@ ProxyBridge hooks the **socket calls** (`connect()`, `sendmsg()`, `recvmsg()`) w
- Linux kernel 5.11+ with BTF and cgroup v2 (to run); GCC, Make, **clang** and **bpftool** (to build the eBPF object and skeleton)
- Development libraries:
- - libelf-dev + zlib1g-dev (Debian/Ubuntu) or elfutils-libelf-devel + zlib-devel (Fedora/RHEL). libbpf itself is built from a pinned
- release and linked statically, so it is not needed at run time
- - curl (fetches the pinned libbpf source on first build)
+ - curl and bzip2 (the first build downloads pinned, checksum-verified libbpf, libelf (elfutils) and zlib sources, builds them
+ as static libraries into `~/.cache/proxybridge`, and links them in: the library and the command line program need only glibc
+ at run time, no libelf, zlib or libbpf package)
- libgtk-3-dev (optional, for GUI) or gtk3-devel (Fedora/RHEL)
- pkg-config
@@ -361,19 +361,19 @@ full RELRO, BIND_NOW, PIE, stack protector and CET flags; `Linux/tests/check_bin
```bash
sudo apt-get update
sudo apt-get install build-essential gcc make clang bpftool \
- libelf-dev zlib1g-dev curl libgtk-3-dev pkg-config
+ curl bzip2 libgtk-3-dev pkg-config
```
**Fedora:**
```bash
sudo dnf install gcc make clang bpftool \
- elfutils-libelf-devel zlib-devel curl gtk3-devel pkg-config
+ curl bzip2 gtk3-devel pkg-config
```
**Arch/Manjaro:**
```bash
sudo pacman -S base-devel gcc make clang bpf \
- libelf zlib curl gtk3 pkg-config
+ curl bzip2 gtk3 pkg-config
```
2. **Clone or download ProxyBridge source code:**
diff --git a/Linux/build.sh b/Linux/build.sh
index b787a4f..736f76c 100755
--- a/Linux/build.sh
+++ b/Linux/build.sh
@@ -25,7 +25,7 @@ need() { # command, install hint
command -v "$1" >/dev/null 2>&1 || { echo "ERROR: '$1' not found. $2"; exit 1; }
}
need gcc "Install: sudo apt install build-essential | sudo dnf install gcc"
-need curl "Needed to fetch the pinned libbpf source. Install: sudo apt install curl"
+need curl "Needed to fetch the pinned libbpf, libelf and zlib sources. Install: sudo apt install curl"
need make "Install: sudo apt install make | sudo dnf install make"
need clang "Needed to compile the eBPF program. Install: sudo apt install clang | sudo dnf install clang"
BPFTOOL="${BPFTOOL:-bpftool}" # set BPFTOOL=/path/to/bpftool if it is not on PATH (e.g. /usr/lib/linux-tools/*/bpftool on Ubuntu)
@@ -35,12 +35,12 @@ if [ "${STATIC_LIBBPF:-1}" != 1 ] && [ ! -f /usr/include/bpf/libbpf.h ] && ! pkg
echo "ERROR: libbpf development files not found. Install: sudo apt install libbpf-dev | sudo dnf install libbpf-devel"
exit 1
fi
-for h in libelf.h zlib.h; do
- [ -f "/usr/include/$h" ] || find /usr/include -name "$h" -print -quit 2>/dev/null | grep -q . || {
- echo "ERROR: $h not found (needed to build the static libbpf). Install: sudo apt install libelf-dev zlib1g-dev | sudo dnf install elfutils-libelf-devel zlib-devel"
- exit 1
- }
-done
+if [ "${STATIC_LIBBPF:-1}" = 1 ]; then
+ # libbpf, libelf and zlib are downloaded (checksum-verified) and built once into ~/.cache/proxybridge, then linked statically
+ need curl "Needed to download the pinned libbpf, libelf and zlib sources."
+ need bzip2 "Needed to unpack elfutils. Install: sudo apt install bzip2 | sudo dnf install bzip2"
+ need make "Needed to build."
+fi
if [ -e "$OUTPUT_DIR" ]; then
echo "Removing existing output directory..."
@@ -73,7 +73,7 @@ echo "Library build successful"
echo ""
echo "=== Building CLI ==="
-make -j"$JOBS" -C "$SCRIPT_DIR/cli" BUILD_DIR="$BUILD_DIR/cli" LIBDIR="$BUILD_DIR/lib"
+make -j"$JOBS" -C "$SCRIPT_DIR/cli" BUILD_DIR="$BUILD_DIR/cli" LIBDIR="$BUILD_DIR/lib" "${LIBBPF_ARGS[@]}"
[ -f "$BUILD_DIR/cli/ProxyBridge" ] || { echo "CLI build failed!"; exit 1; }
echo "CLI build successful"
echo ""
diff --git a/Linux/cli/Makefile b/Linux/cli/Makefile
index d4f10d8..d763cd2 100644
--- a/Linux/cli/Makefile
+++ b/Linux/cli/Makefile
@@ -5,8 +5,20 @@ BUILD_DIR ?= .
LIBDIR ?= ../src
CFLAGS = $(CFLAGS_COMMON) -fPIE -I../src -I../profile
-LDFLAGS = -pie $(HARDEN_LDFLAGS) -L$(LIBDIR) -Wl,-rpath,/usr/local/lib $(STRIP_FLAG)
+LDFLAGS = -pie $(HARDEN_LDFLAGS) $(STRIP_FLAG)
+
+# With LIBBPF_DIR (the pinned static libbpf, libelf and zlib built by src/Makefile) the engine objects are linked straight into
+# the program: one self-contained file that needs nothing but glibc and runs from any directory. Without it the program uses
+# libproxybridge.so (a build against the distribution's libbpf).
+LIBBPF_DIR ?=
+ENGINE = ProxyBridge pb_rules pb_dns pb_proc pb_bpf pb_relay
+ifneq ($(LIBBPF_DIR),)
+ENGINE_OBJECTS = $(addprefix $(LIBDIR)/,$(addsuffix .o,$(ENGINE)))
+LIBS = $(ENGINE_OBJECTS) $(LIBBPF_DIR)/lib/libbpf.a $(LIBBPF_DIR)/lib/libelf.a $(LIBBPF_DIR)/lib/libz.a -lpthread
+else
+LDFLAGS += -L$(LIBDIR) -Wl,-rpath,/usr/local/lib
LIBS = -lproxybridge -lpthread
+endif
TARGET = $(BUILD_DIR)/ProxyBridge
OBJECTS = $(BUILD_DIR)/main.o $(BUILD_DIR)/pb_profile.o
diff --git a/Linux/deploy.sh b/Linux/deploy.sh
index fad6731..d5b4727 100644
--- a/Linux/deploy.sh
+++ b/Linux/deploy.sh
@@ -129,10 +129,19 @@ detect_distro() {
echo "Detected distribution: $DISTRO"
}
-# Install dependencies based on distribution
+# The command line program and the library are self-contained (libbpf, libelf and zlib are linked in; only glibc is used), so
+# nothing needs installing for them. The GUI needs GTK3, which cannot be linked statically: install it only if it is missing.
install_dependencies() {
echo ""
- echo "Checking and installing dependencies..."
+ if [ ! -f "$TEMP_DIR/ProxyBridgeGUI" ]; then
+ echo "No dependencies to install (the command line program is self-contained)."
+ return
+ fi
+ if ldconfig -p 2>/dev/null | grep -q 'libgtk-3\.so\.0'; then
+ echo "GTK3 is already installed (needed by the GUI)."
+ return
+ fi
+ echo "Installing GTK3 (needed by the GUI)..."
# Normalize distro name using ID_LIKE fallback
local distro_family="$DISTRO"
@@ -148,47 +157,19 @@ install_dependencies() {
case "$distro_family" in
ubuntu|debian|linuxmint|pop|elementary|zorin|kali|raspbian|mx|antix|deepin|lmde)
- echo "Using apt package manager..."
apt-get update -qq
- apt-get install -y libelf1 zlib1g libgtk-3-0
- ;;
- fedora)
- echo "Using dnf package manager..."
- dnf install -y elfutils-libelf zlib gtk3
- ;;
- rhel|centos|rocky|almalinux)
- echo "Using yum package manager..."
- yum install -y elfutils-libelf zlib gtk3
- ;;
- arch|manjaro|endeavouros|garuda)
- echo "Using pacman package manager..."
- pacman -Sy --noconfirm libelf zlib gtk3
- ;;
- opensuse*|sles)
- echo "Using zypper package manager..."
- zypper install -y libelf1 libz1 gtk3
- ;;
- void)
- echo "Using xbps package manager..."
- xbps-install -Sy libelf zlib gtk3
+ apt-get install -y libgtk-3-0
;;
+ fedora) dnf install -y gtk3 ;;
+ rhel|centos|rocky|almalinux) yum install -y gtk3 ;;
+ arch|manjaro|endeavouros|garuda) pacman -Sy --noconfirm gtk3 ;;
+ opensuse*|sles) zypper install -y gtk3 ;;
+ void) xbps-install -Sy gtk3 ;;
*)
- echo "WARNING: Unknown distribution '$DISTRO' (family: '$DISTRO_LIKE')"
- echo ""
- echo "Please manually install the following packages:"
- echo " Debian/Ubuntu: sudo apt install libelf1 zlib1g libgtk-3-0"
- echo " Fedora: sudo dnf install elfutils-libelf zlib gtk3"
- echo " Arch: sudo pacman -S libelf zlib gtk3"
- echo ""
- read -p "Continue anyway? (y/n) " -n 1 -r
- echo
- if [[ ! $REPLY =~ ^[Yy]$ ]]; then
- exit 1
- fi
+ echo "WARNING: Unknown distribution '$DISTRO'. The GUI needs GTK3 (Debian/Ubuntu: libgtk-3-0, Fedora: gtk3, Arch: gtk3)."
+ echo "The command line program works without it."
;;
esac
-
- echo "Dependencies installed"
}
# Use /usr/local/lib (matches RPATH in binary)
diff --git a/Linux/setup.sh b/Linux/setup.sh
index f0764b1..5aa4ba9 100644
--- a/Linux/setup.sh
+++ b/Linux/setup.sh
@@ -32,11 +32,20 @@ detect_distro() {
echo "Detected distribution: $DISTRO"
}
-# Install dependencies based on distribution
+# The command line program and the library are self-contained (libbpf, libelf and zlib are linked in; only glibc is used), so
+# nothing needs installing for them. The GUI needs GTK3, which cannot be linked statically: install it only if it is missing.
install_dependencies() {
echo ""
- echo "Checking and installing dependencies..."
-
+ if [ ! -f "$SCRIPT_DIR/ProxyBridgeGUI" ]; then
+ echo "No dependencies to install (the command line program is self-contained)."
+ return
+ fi
+ if ldconfig -p 2>/dev/null | grep -q 'libgtk-3\.so\.0'; then
+ echo "GTK3 is already installed (needed by the GUI)."
+ return
+ fi
+ echo "Installing GTK3 (needed by the GUI)..."
+
# Normalize distro name using ID_LIKE fallback
local distro_family="$DISTRO"
if [ -n "$DISTRO_LIKE" ]; then
@@ -48,51 +57,22 @@ install_dependencies() {
*suse*) distro_family="opensuse" ;;
esac
fi
-
+
case "$distro_family" in
ubuntu|debian|linuxmint|pop|elementary|zorin|kali|raspbian|mx|antix|deepin|lmde)
- echo "Using apt package manager..."
apt-get update -qq
- # libgtk-3-0 is for the GUI, libelf+zlib are what the statically linked libbpf needs
- apt-get install -y libelf1 zlib1g libgtk-3-0
- ;;
- fedora)
- echo "Using dnf package manager..."
- dnf install -y elfutils-libelf zlib gtk3
- ;;
- rhel|centos|rocky|almalinux)
- echo "Using yum package manager..."
- yum install -y elfutils-libelf zlib gtk3
- ;;
- arch|manjaro|endeavouros|garuda)
- echo "Using pacman package manager..."
- pacman -Sy --noconfirm libelf zlib gtk3
- ;;
- opensuse*|sles)
- echo "Using zypper package manager..."
- zypper install -y libelf1 libz1 gtk3
- ;;
- void)
- echo "Using xbps package manager..."
- xbps-install -Sy libelf zlib gtk3
+ apt-get install -y libgtk-3-0
;;
+ fedora) dnf install -y gtk3 ;;
+ rhel|centos|rocky|almalinux) yum install -y gtk3 ;;
+ arch|manjaro|endeavouros|garuda) pacman -Sy --noconfirm gtk3 ;;
+ opensuse*|sles) zypper install -y gtk3 ;;
+ void) xbps-install -Sy gtk3 ;;
*)
- echo "WARNING: Unknown distribution '$DISTRO' (family: '$DISTRO_LIKE')"
- echo ""
- echo "Please manually install the following packages:"
- echo " Debian/Ubuntu: sudo apt install libelf1 zlib1g libgtk-3-0"
- echo " Fedora: sudo dnf install elfutils-libelf zlib gtk3"
- echo " Arch: sudo pacman -S libelf zlib gtk3"
- echo ""
- read -p "Continue anyway? (y/n) " -n 1 -r
- echo
- if [[ ! $REPLY =~ ^[Yy]$ ]]; then
- exit 1
- fi
+ echo "WARNING: Unknown distribution '$DISTRO'. The GUI needs GTK3 (Debian/Ubuntu: libgtk-3-0, Fedora: gtk3, Arch: gtk3)."
+ echo "The command line program works without it."
;;
esac
-
- echo "Dependencies installed"
}
# Use /usr/local/lib (matches RPATH in binary)
diff --git a/Linux/src/Makefile b/Linux/src/Makefile
index fc91bcf..77dd4b3 100644
--- a/Linux/src/Makefile
+++ b/Linux/src/Makefile
@@ -7,18 +7,22 @@ MULTIARCH := $(shell $(CC) -print-multiarch)
# BUILD_DIR keeps every generated file out of the source tree; build.sh points it at a temporary directory.
BUILD_DIR ?= .
-# libbpf is linked statically from a pinned release built as position-independent code, so the library does not depend on the
-# distribution's libbpf (Ubuntu 22.04 ships 0.5, and distribution libbpf.a is not PIC). With LIBBPF_DIR unset the system
-# libbpf is used instead.
+# libbpf, libelf and zlib are linked statically from pinned releases built as position-independent code, so the library
+# depends on nothing but glibc: not on the distribution's libbpf (Ubuntu 22.04 ships 0.5), and not on libelf or zlib
+# (distribution .a files are not PIC). With LIBBPF_DIR unset the system libbpf is used instead.
LIBBPF_VERSION ?= 1.6.3
LIBBPF_SHA256 ?= 989ed3c1a3db8ff0f7c08dd43953c6b9d0c3ac252653a48d566aaedf98bc80ca
-LIBBPF_RECIPE ?= 2
+ZLIB_VERSION ?= 1.3.1
+ZLIB_SHA256 ?= 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23
+ELFUTILS_VERSION ?= 0.191
+ELFUTILS_SHA256 ?= df76db71366d1d708365fc7a6c60ca48398f14367eb2b8954efc8897147ad871
+LIBBPF_RECIPE ?= 3
LIBBPF_CACHE ?= $(or $(XDG_CACHE_HOME),$(HOME)/.cache)/proxybridge/libbpf-$(LIBBPF_VERSION)-r$(LIBBPF_RECIPE)
LIBBPF_DIR ?=
ifneq ($(LIBBPF_DIR),)
LIBBPF_INCLUDE = -I$(LIBBPF_DIR)/include
-LIBBPF_LIBS = $(LIBBPF_DIR)/lib/libbpf.a -lelf -lz
+LIBBPF_LIBS = $(LIBBPF_DIR)/lib/libbpf.a $(LIBBPF_DIR)/lib/libelf.a $(LIBBPF_DIR)/lib/libz.a
else
LIBBPF_LIBS = -lbpf
endif
@@ -57,17 +61,27 @@ test-rules: tests/rules_test.c tests/dns_test.c tests/proc_test.c pb_rules.c pb_
$(CC) -Wall -Wextra -g -fsanitize=address,undefined -D_GNU_SOURCE tests/dns_test.c pb_dns.c -o $(BUILD_DIR)/dns_test && $(BUILD_DIR)/dns_test
$(CC) -Wall -Wextra -g -fsanitize=address,undefined -D_GNU_SOURCE tests/proc_test.c pb_proc.c -o $(BUILD_DIR)/proc_test && $(BUILD_DIR)/proc_test
-# Downloads, verifies and builds libbpf (cached); prints nothing. `make -s libbpf-path` prints the directory to use as LIBBPF_DIR.
+# Downloads, verifies and builds zlib, libelf (from elfutils) and libbpf (cached); prints nothing. `make -s libbpf-path` prints
+# the directory to use as LIBBPF_DIR. Every download is checked against a pinned SHA-256.
libbpf-static: $(LIBBPF_CACHE)/lib/libbpf.a
$(LIBBPF_CACHE)/lib/libbpf.a:
- @set -e; work=$$(mktemp -d); cd "$$work"; \
- curl -fsSL -o libbpf.tar.gz https://github.com/libbpf/libbpf/archive/refs/tags/v$(LIBBPF_VERSION).tar.gz; \
- echo "$(LIBBPF_SHA256) libbpf.tar.gz" | sha256sum -c --quiet -; \
- tar xzf libbpf.tar.gz; \
- $(MAKE) -s -C libbpf-$(LIBBPF_VERSION)/src BUILD_STATIC_ONLY=y OBJDIR="$$work/obj" CFLAGS="-O2 -fPIC -include $(CURDIR)/glibc_compat.h" \
+ @set -e; work=$$(mktemp -d); cd "$$work"; root="$$work/root"; mkdir -p "$$root/include" "$$root/lib"; \
+ fetch() { curl -fsSL -o "$$1" "$$2"; echo "$$3 $$1" | sha256sum -c --quiet -; }; \
+ fetch zlib.tar.gz https://github.com/madler/zlib/releases/download/v$(ZLIB_VERSION)/zlib-$(ZLIB_VERSION).tar.gz $(ZLIB_SHA256); \
+ fetch elfutils.tar.bz2 https://sourceware.org/elfutils/ftp/$(ELFUTILS_VERSION)/elfutils-$(ELFUTILS_VERSION).tar.bz2 $(ELFUTILS_SHA256); \
+ fetch libbpf.tar.gz https://github.com/libbpf/libbpf/archive/refs/tags/v$(LIBBPF_VERSION).tar.gz $(LIBBPF_SHA256); \
+ tar --no-same-owner -xzf zlib.tar.gz; tar --no-same-owner -xjf elfutils.tar.bz2; tar --no-same-owner -xzf libbpf.tar.gz; \
+ ( cd zlib-$(ZLIB_VERSION) && CFLAGS="-O2 -fPIC -include $(CURDIR)/glibc_compat.h" ./configure --static --prefix="$$root" >/dev/null && $(MAKE) -s install >/dev/null ); \
+ ( cd elfutils-$(ELFUTILS_VERSION) && CFLAGS="-O2 -fPIC -Wno-error -include $(CURDIR)/glibc_compat.h" CPPFLAGS="-I$$root/include" LDFLAGS="-L$$root/lib" \
+ ./configure --disable-debuginfod --disable-libdebuginfod --disable-nls \
+ --without-bzlib --without-lzma --without-zstd --disable-demangler --disable-symbol-versioning >/dev/null && \
+ $(MAKE) -s -C lib >/dev/null && $(MAKE) -s -C libelf libelf.a >/dev/null && \
+ cp libelf/libelf.a "$$root/lib/" && cp libelf/libelf.h libelf/gelf.h libelf/nlist.h "$$root/include/" ); \
+ $(MAKE) -s -C libbpf-$(LIBBPF_VERSION)/src BUILD_STATIC_ONLY=y OBJDIR="$$work/obj" PKG_CONFIG=true \
+ CFLAGS="-O2 -fPIC -I$$root/include -include $(CURDIR)/glibc_compat.h" \
DESTDIR="$$work/root" PREFIX=/ LIBDIR=/lib install >/dev/null; \
- mkdir -p "$(LIBBPF_CACHE)"; cp -r "$$work/root/include" "$$work/root/lib" "$(LIBBPF_CACHE)/"; \
+ mkdir -p "$(LIBBPF_CACHE)"; cp -r "$$root/include" "$$root/lib" "$(LIBBPF_CACHE)/"; \
cd /; rm -rf "$$work"
libbpf-path:
diff --git a/Linux/tests/check_binaries.sh b/Linux/tests/check_binaries.sh
index b4dbdb1..504749c 100755
--- a/Linux/tests/check_binaries.sh
+++ b/Linux/tests/check_binaries.sh
@@ -35,10 +35,12 @@ audit() { # file kind(lib|exe) allowed-NEEDED-regex
}
LIBBPF_DEP=''; [ "${ALLOW_DYNAMIC_LIBBPF:-0}" = 1 ] && LIBBPF_DEP='|libbpf\.so\.1'
-audit libproxybridge.so lib "^(libc\.so\.6|libelf\.so\.1|libz\.so\.1|libm\.so\.6|ld-linux.*$LIBBPF_DEP)\$"
+# libbpf, libelf and zlib are linked in: the library and the command line program depend on glibc alone
+audit libproxybridge.so lib "^(libc\.so\.6|libm\.so\.6|ld-linux.*$LIBBPF_DEP)\$"
exports=$(nm -D --defined-only "$DIR/libproxybridge.so" 2>/dev/null | awk '$2=="T"{print $3}' | grep -v '^ProxyBridge_' | tr '\n' ' ')
check "library exports only the ProxyBridge_* API${exports:+ (also: $exports)}" '[ -z "$exports" ]'
-audit ProxyBridge exe '^(libc\.so\.6|libproxybridge\.so|libpthread\.so\.0|libm\.so\.6|ld-linux.*)$'
+if [ "${ALLOW_DYNAMIC_LIBBPF:-0}" = 1 ]; then CLI_DEP='|libproxybridge\.so|libbpf\.so\.1|libelf\.so\.1|libz\.so\.1'; else CLI_DEP=''; fi
+audit ProxyBridge exe "^(libc\.so\.6|libpthread\.so\.0|libm\.so\.6|ld-linux.*$CLI_DEP)\$"
audit ProxyBridgeGUI exe '^(libc\.so\.6|libproxybridge\.so|libpthread\.so\.0|libm\.so\.6|libgtk-3\.so\.0|libgdk-3\.so\.0|libglib-2\.0\.so\.0|libgobject-2\.0\.so\.0|libgio-2\.0\.so\.0|libcairo\.so\.2|libgdk_pixbuf-2\.0\.so\.0|libpango-1\.0\.so\.0|libpangocairo-1\.0\.so\.0|libatk-1\.0\.so\.0|ld-linux.*)$'
echo