Skip to content

Commit f8f3881

Browse files
committed
Installed Inferno, libkqueue rebuilt from source with debug symbols
1 parent 4df2b46 commit f8f3881

5 files changed

Lines changed: 260 additions & 0 deletions

File tree

scripts/docker/build/ubuntu24/Dockerfile.cb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,15 @@ RUN git clone --depth 1 --no-single-branch ${source}
8181

8282
#
8383
# Install build dependencies for all branches from v4 onwards
84+
# Debian sid fails if debian/control doesn't exist due to an issue
85+
# in one of the included make files, so we create a blank file.
8486
#
8587
WORKDIR freeradius-server
8688
RUN for i in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin 2>/dev/null | sed -e 's#origin/##' | egrep "^(v[4-9]*\.[0-9x]*\.x|master|${branch})$" | sort -u); \
8789
do \
8890
git checkout $i; \
8991
if [ -e ./debian/control.in ] ; then \
92+
touch -t 202001010000 debian/control; \
9093
debian/rules debian/control ; \
9194
fi ; \
9295
mk-build-deps -irt"apt-get -o Debug::pkgProblemResolver=yes $APT_OPTS" debian/control ; \
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Auto generated for ubuntu24
2+
# from scripts/docker/m4/profiling.deb.m4
3+
#
4+
# Rebuild this file with `make profiling.ubuntu24.regen`
5+
#
6+
ARG from=freeradius40x-build/ubuntu24
7+
FROM ${from}
8+
9+
#
10+
# Install profiling tools
11+
#
12+
RUN apt-get update && \
13+
apt-get install -y $APT_OPTS \
14+
libgoogle-perftools-dev \
15+
google-perftools \
16+
valgrind \
17+
heaptrack \
18+
psmisc \
19+
kcachegrind \
20+
kio \
21+
libkf5iconthemes5 \
22+
libkf5parts5 \
23+
libkf5textwidgets5 \
24+
libqt5gui5 \
25+
libqt5widgets5 && \
26+
apt-get clean && \
27+
rm -r /var/lib/apt/lists/*
28+
29+
#
30+
# Set up Ubuntu debug symbol repository and install OS library debug symbols.
31+
# These allow callgrind/valgrind to resolve system library calls (glibc,
32+
# OpenSSL, talloc, etc.) to named symbols instead of hex addresses.
33+
#
34+
RUN apt-get update && \
35+
apt-get install -y $APT_OPTS ubuntu-dbgsym-keyring && \
36+
printf 'deb http://ddebs.ubuntu.com noble main restricted universe multiverse\ndeb http://ddebs.ubuntu.com noble-updates main restricted universe multiverse\n' \
37+
> /etc/apt/sources.list.d/ddebs.list && \
38+
apt-get update && \
39+
apt-get install -y $APT_OPTS \
40+
libc6-dbg \
41+
zlib1g-dbgsym \
42+
libreadline8t64-dbgsym \
43+
libssl3t64-dbgsym \
44+
libsasl2-2-dbgsym \
45+
libpam0g-dbgsym \
46+
libldap2-dbgsym \
47+
libtalloc2-dbgsym \
48+
libpcre2-8-0-dbgsym \
49+
libpcap0.8t64-dbgsym \
50+
libcurl4t64-dbgsym \
51+
libunbound8-dbgsym \
52+
libsqlite3-0-dbgsym \
53+
libpq5-dbgsym \
54+
libmariadb3-dbgsym \
55+
libgdbm6t64-dbgsym \
56+
libjson-c5-dbgsym \
57+
libbrotli1-dbgsym \
58+
libhiredis1.1.0-dbgsym \
59+
librdkafka1-dbgsym \
60+
libwbclient0-dbgsym && \
61+
apt-get clean && \
62+
rm -r /var/lib/apt/lists/*
63+
64+
#
65+
# Rebuild libkqueue from source with full debug
66+
#
67+
RUN apt-get update && \
68+
apt-get install -y $APT_OPTS --no-install-recommends cmake git && \
69+
apt-get clean && \
70+
rm -r /var/lib/apt/lists/* && \
71+
git clone --depth 1 https://github.com/mheily/libkqueue.git /tmp/libkqueue && \
72+
cd /tmp/libkqueue && \
73+
cmake -G "Unix Makefiles" \
74+
-DCMAKE_INSTALL_PREFIX=/usr \
75+
-DCMAKE_INSTALL_LIBDIR=lib \
76+
-DCMAKE_C_FLAGS="-g3 -O1 -fno-omit-frame-pointer" \
77+
. && \
78+
make && \
79+
cpack -G DEB && \
80+
dpkg -i *.deb && \
81+
cd / && rm -rf /tmp/libkqueue
82+
83+
#
84+
# Install FlameGraph scripts
85+
#
86+
RUN git clone --depth 1 https://github.com/brendangregg/FlameGraph /opt/flamegraph \
87+
&& chmod +x /opt/flamegraph/*.pl /opt/flamegraph/*.sh
88+
89+
ENV PATH="/opt/flamegraph:${PATH}" \
90+
DEBUGINFOD_URLS="https://debuginfod.ubuntu.com"
91+
92+
#
93+
# Install Inferno for callgrind → folded conversion
94+
# Inferno is a Rust port of FlameGraph with broader format support
95+
#
96+
RUN apt-get update && \
97+
apt-get install -y $APT_OPTS --no-install-recommends \
98+
cargo && \
99+
cargo install inferno --version 0.11.21 --locked --root /usr/local && \
100+
apt-get clean && \
101+
rm -r /var/lib/apt/lists/*
102+
103+
EXPOSE 1812/udp 1813/udp
104+
CMD ["/bin/sh", "-c", "while true; do sleep 60; done"]

scripts/docker/crossbuild.mk

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ endif
4040
CB_IPREFIX:=freeradius40x-build
4141
CB_CPREFIX:=fr40x-crossbuild-
4242

43+
PROFILE ?= default-profiling
44+
45+
# Where profiling profiles live
46+
PROFILES_DIR:=$(CB_DIR)/profiling/profiles
47+
48+
# All available profiling profiles (one sub-directory per profile)
49+
CB_PROFILES:=$(sort $(patsubst $(PROFILES_DIR)/%,%,$(wildcard $(PROFILES_DIR)/*)))
50+
4351
#
4452
# This Makefile is included in-line, and not via the "boilermake"
4553
# wrapper. But it's still useful to use the same process for
@@ -90,6 +98,12 @@ crossbuild.help: crossbuild.info
9098
@echo " crossbuild.IMAGE.clean - stop container and tidy up"
9199
@echo " crossbuild.IMAGE.wipe - remove Docker image"
92100
@echo ""
101+
@echo "Profiling targets:"
102+
@echo " crossbuild.IMAGE.profile.regen - regenerate Dockerfile.prof using default profile ($(PROFILE))"
103+
@echo " crossbuild.IMAGE.profile.regen PROFILE=<name> - regenerate using a specific profile"
104+
@echo " crossbuild.IMAGE.profile.build - build profiling image using default profile ($(PROFILE))"
105+
@echo " crossbuild.IMAGE.profile.reset - remove profiling stamp to force rebuild"
106+
@echo ""
93107
@echo "Use 'make NOCACHE=1 ...' to disregard the Docker cache on build"
94108

95109
#
@@ -140,6 +154,20 @@ $(DD)/stamp-image.${1}:
140154
${Q}docker build $(DOCKER_BUILD_OPTS) $(DT)/${1} -f $(DT)/${1}/Dockerfile.cb -t $(CB_IPREFIX)/${1} >$(DD)/build.${1} 2>&1
141155
${Q}touch $(DD)/stamp-image.${1}
142156

157+
#
158+
# Build the profiling image
159+
#
160+
.PHONY: crossbuild.${1}.profile.build
161+
crossbuild.${1}.profile.build: $(DD)/stamp-image.${1}-profile.build
162+
163+
$(DD)/stamp-image.${1}-profile.build: $(DT)/${1}/Dockerfile.prof
164+
${Q}echo "BUILD ${1} (freeradius4-$(PROFILE)/${1}) > $(DD)/build.${1}-profile.build"
165+
${Q}docker build $(DOCKER_BUILD_OPTS) . \
166+
-f $(DT)/${1}/Dockerfile.prof \
167+
-t freeradius4-$(PROFILE)/${1} \
168+
>$(DD)/build.${1}-profile.build 2>&1
169+
${Q}touch $(DD)/stamp-image.${1}-profile.build
170+
143171
#
144172
# Start up the docker container
145173
#
@@ -249,6 +277,29 @@ $(DT)/${1}/Dockerfile.cb: $(DOCKER_TMPL) $(CB_DIR)/m4/crossbuild.deb.m4 $(CB_DIR
249277
${Q}echo REGEN ${1}
250278
${Q}m4 -I $(CB_DIR)/m4 -D D_NAME=${1} -D D_TYPE=crossbuild $$< > $$@
251279

280+
#
281+
# Regenerate Dockerfile.prof from m4 template
282+
#
283+
.PHONY: crossbuild.${1}.profile.regen
284+
crossbuild.${1}.profile.regen: $(DT)/${1}/Dockerfile.prof
285+
286+
$(DT)/${1}/Dockerfile.prof: $(DOCKER_TMPL) $(CB_DIR)/m4/profiling.deb.m4
287+
${Q}echo REGEN ${1}
288+
${Q}m4 -I $(CB_DIR)/m4 \
289+
-D D_NAME=${1} \
290+
-D D_TYPE=profiling \
291+
-D CB_IMAGE=$(CB_IPREFIX)/${1} \
292+
-D PROFILE_NAME=$(PROFILE) \
293+
$$< > $$@
294+
295+
#
296+
# Remove profiling stamp so next profile.build starts clean
297+
#
298+
.PHONY: crossbuild.${1}.profile.reset
299+
crossbuild.${1}.profile.reset:
300+
${Q}echo RESET profiling ${1}
301+
${Q}rm -f $(DD)/stamp-image.${1}-profile.build
302+
252303
#
253304
# Run the build test
254305
#

scripts/docker/m4/profiling.deb.m4

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
ARG from=CB_IMAGE
2+
FROM ${from}
3+
4+
#
5+
# Install profiling tools
6+
#
7+
RUN apt-get update && \
8+
apt-get install -y $APT_OPTS \
9+
libgoogle-perftools-dev \
10+
google-perftools \
11+
valgrind \
12+
heaptrack \
13+
psmisc \
14+
kcachegrind \
15+
kio \
16+
libkf5iconthemes5 \
17+
libkf5parts5 \
18+
libkf5textwidgets5 \
19+
libqt5gui5 \
20+
libqt5widgets5 && \
21+
apt-get clean && \
22+
rm -r /var/lib/apt/lists/*
23+
24+
#
25+
# Set up Ubuntu debug symbol repository and install OS library debug symbols.
26+
# These allow callgrind/valgrind to resolve system library calls (glibc,
27+
# OpenSSL, talloc, etc.) to named symbols instead of hex addresses.
28+
#
29+
RUN apt-get update && \
30+
apt-get install -y $APT_OPTS ubuntu-dbgsym-keyring && \
31+
printf 'deb http://ddebs.ubuntu.com OS_CODENAME main restricted universe multiverse\ndeb http://ddebs.ubuntu.com OS_CODENAME-updates main restricted universe multiverse\n' \
32+
> /etc/apt/sources.list.d/ddebs.list && \
33+
apt-get update && \
34+
apt-get install -y $APT_OPTS \
35+
libc6-dbg \
36+
zlib1g-dbgsym \
37+
libreadline8t64-dbgsym \
38+
libssl3t64-dbgsym \
39+
libsasl2-2-dbgsym \
40+
libpam0g-dbgsym \
41+
libldap2-dbgsym \
42+
libtalloc2-dbgsym \
43+
libpcre2-8-0-dbgsym \
44+
libpcap0.8t64-dbgsym \
45+
libcurl4t64-dbgsym \
46+
libunbound8-dbgsym \
47+
libsqlite3-0-dbgsym \
48+
libpq5-dbgsym \
49+
libmariadb3-dbgsym \
50+
libgdbm6t64-dbgsym \
51+
libjson-c5-dbgsym \
52+
libbrotli1-dbgsym \
53+
libhiredis1.1.0-dbgsym \
54+
librdkafka1-dbgsym \
55+
libwbclient0-dbgsym && \
56+
apt-get clean && \
57+
rm -r /var/lib/apt/lists/*
58+
59+
#
60+
# Rebuild libkqueue from source with full debug
61+
#
62+
RUN apt-get update && \
63+
apt-get install -y $APT_OPTS --no-install-recommends cmake git && \
64+
apt-get clean && \
65+
rm -r /var/lib/apt/lists/* && \
66+
git clone --depth 1 https://github.com/mheily/libkqueue.git /tmp/libkqueue && \
67+
cd /tmp/libkqueue && \
68+
cmake -G "Unix Makefiles" \
69+
-DCMAKE_INSTALL_PREFIX=/usr \
70+
-DCMAKE_INSTALL_LIBDIR=lib \
71+
-DCMAKE_C_FLAGS="-g3 -O1 -fno-omit-frame-pointer" \
72+
. && \
73+
make && \
74+
cpack -G DEB && \
75+
dpkg -i *.deb && \
76+
cd / && rm -rf /tmp/libkqueue
77+
78+
#
79+
# Install FlameGraph scripts
80+
#
81+
RUN git clone --depth 1 https://github.com/brendangregg/FlameGraph /opt/flamegraph \
82+
&& chmod +x /opt/flamegraph/*.pl /opt/flamegraph/*.sh
83+
84+
ENV PATH="/opt/flamegraph:${PATH}" \
85+
DEBUGINFOD_URLS="https://debuginfod.ubuntu.com"
86+
87+
#
88+
# Install Inferno for callgrind → folded conversion
89+
# Inferno is a Rust port of FlameGraph with broader format support
90+
#
91+
RUN apt-get update && \
92+
apt-get install -y $APT_OPTS --no-install-recommends \
93+
cargo && \
94+
cargo install inferno --version 0.11.21 --locked --root /usr/local && \
95+
apt-get clean && \
96+
rm -r /var/lib/apt/lists/*
97+
98+
EXPOSE 1812/udp 1813/udp
99+
CMD ["/bin/sh", "-c", "while true; do sleep 60; done"]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Default server profiling "profile".
2+
3+
Future location of various scripts used to configure the server for profiling, and start profiling tools.

0 commit comments

Comments
 (0)