diff --git a/3.12/alpine3.20/Dockerfile b/3.12/alpine3.20/Dockerfile index 734c041f7..64d3773b9 100644 --- a/3.12/alpine3.20/Dockerfile +++ b/3.12/alpine3.20/Dockerfile @@ -84,6 +84,8 @@ RUN set -eux; \ # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.12/alpine3.21/Dockerfile b/3.12/alpine3.21/Dockerfile index 4bc600f39..c3a26e9ec 100644 --- a/3.12/alpine3.21/Dockerfile +++ b/3.12/alpine3.21/Dockerfile @@ -84,6 +84,8 @@ RUN set -eux; \ # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.12/bookworm/Dockerfile b/3.12/bookworm/Dockerfile index 1582f2c25..b5634f086 100644 --- a/3.12/bookworm/Dockerfile +++ b/3.12/bookworm/Dockerfile @@ -56,6 +56,8 @@ RUN set -eux; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.12/bullseye/Dockerfile b/3.12/bullseye/Dockerfile index 4c29d1c8a..c51f159a4 100644 --- a/3.12/bullseye/Dockerfile +++ b/3.12/bullseye/Dockerfile @@ -56,6 +56,8 @@ RUN set -eux; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.12/slim-bookworm/Dockerfile b/3.12/slim-bookworm/Dockerfile index d5510b6f5..674888053 100644 --- a/3.12/slim-bookworm/Dockerfile +++ b/3.12/slim-bookworm/Dockerfile @@ -82,6 +82,8 @@ RUN set -eux; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.12/slim-bullseye/Dockerfile b/3.12/slim-bullseye/Dockerfile index 1b0527ac7..05117f943 100644 --- a/3.12/slim-bullseye/Dockerfile +++ b/3.12/slim-bullseye/Dockerfile @@ -82,6 +82,8 @@ RUN set -eux; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.13/alpine3.20/Dockerfile b/3.13/alpine3.20/Dockerfile index a3400bc7e..5b8dc14c3 100644 --- a/3.13/alpine3.20/Dockerfile +++ b/3.13/alpine3.20/Dockerfile @@ -79,6 +79,8 @@ RUN set -eux; \ # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.13/alpine3.21/Dockerfile b/3.13/alpine3.21/Dockerfile index 47fda0dbc..32176b817 100644 --- a/3.13/alpine3.21/Dockerfile +++ b/3.13/alpine3.21/Dockerfile @@ -79,6 +79,8 @@ RUN set -eux; \ # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.13/bookworm/Dockerfile b/3.13/bookworm/Dockerfile index 7c1086995..7d87ca8e3 100644 --- a/3.13/bookworm/Dockerfile +++ b/3.13/bookworm/Dockerfile @@ -51,6 +51,8 @@ RUN set -eux; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.13/bullseye/Dockerfile b/3.13/bullseye/Dockerfile index 88fbc5fdd..7a1aab1a1 100644 --- a/3.13/bullseye/Dockerfile +++ b/3.13/bullseye/Dockerfile @@ -51,6 +51,8 @@ RUN set -eux; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.13/slim-bookworm/Dockerfile b/3.13/slim-bookworm/Dockerfile index bba18e9ab..4c8ad75e6 100644 --- a/3.13/slim-bookworm/Dockerfile +++ b/3.13/slim-bookworm/Dockerfile @@ -77,6 +77,8 @@ RUN set -eux; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.13/slim-bullseye/Dockerfile b/3.13/slim-bullseye/Dockerfile index 1afd61621..8d3fd48c6 100644 --- a/3.13/slim-bullseye/Dockerfile +++ b/3.13/slim-bullseye/Dockerfile @@ -77,6 +77,8 @@ RUN set -eux; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.14-rc/alpine3.20/Dockerfile b/3.14-rc/alpine3.20/Dockerfile index e8d8627cb..67f077549 100644 --- a/3.14-rc/alpine3.20/Dockerfile +++ b/3.14-rc/alpine3.20/Dockerfile @@ -72,6 +72,8 @@ RUN set -eux; \ # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.14-rc/alpine3.21/Dockerfile b/3.14-rc/alpine3.21/Dockerfile index 0f2357e03..d0448784a 100644 --- a/3.14-rc/alpine3.21/Dockerfile +++ b/3.14-rc/alpine3.21/Dockerfile @@ -72,6 +72,8 @@ RUN set -eux; \ # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.14-rc/bookworm/Dockerfile b/3.14-rc/bookworm/Dockerfile index a5daf968a..450881d13 100644 --- a/3.14-rc/bookworm/Dockerfile +++ b/3.14-rc/bookworm/Dockerfile @@ -44,6 +44,8 @@ RUN set -eux; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.14-rc/bullseye/Dockerfile b/3.14-rc/bullseye/Dockerfile index b869fcfa7..671b71014 100644 --- a/3.14-rc/bullseye/Dockerfile +++ b/3.14-rc/bullseye/Dockerfile @@ -44,6 +44,8 @@ RUN set -eux; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.14-rc/slim-bookworm/Dockerfile b/3.14-rc/slim-bookworm/Dockerfile index 3d51543d6..61a8bd6c3 100644 --- a/3.14-rc/slim-bookworm/Dockerfile +++ b/3.14-rc/slim-bookworm/Dockerfile @@ -70,6 +70,8 @@ RUN set -eux; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/3.14-rc/slim-bullseye/Dockerfile b/3.14-rc/slim-bullseye/Dockerfile index afc7b3fd4..539b93be3 100644 --- a/3.14-rc/slim-bullseye/Dockerfile +++ b/3.14-rc/slim-bullseye/Dockerfile @@ -70,6 +70,8 @@ RUN set -eux; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \ LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \ diff --git a/Dockerfile-linux.template b/Dockerfile-linux.template index ecb9c5416..3f4a0b12a 100644 --- a/Dockerfile-linux.template +++ b/Dockerfile-linux.template @@ -198,6 +198,13 @@ RUN set -eux; \ {{ if is_slim or is_alpine then ( -}} LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \ {{ ) else "" end -}} +{{ + # Enabling frame-pointer only makes sense for Python 3.12 and newer as those have perf profiler support + if rcVersion | IN("3.9", "3.10", "3.11") then "" else ( +-}} +# https://docs.python.org/3.12/howto/perf_profiling.html + EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \ +{{ ) end -}} make -j "$nproc" \ "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ "LDFLAGS=${LDFLAGS:-}" \