Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1021049
Update python to 3.11 and rename python build script to 3.11
mpozniak95 Apr 11, 2023
dd24298
Use make altinstall to install python3
mpozniak95 Apr 12, 2023
90f396f
Use LDFLAGS when building python 3.11
mpozniak95 Apr 13, 2023
f5b3061
Update pyinstaller version, link python3.11 to python3 in prepare-stage
mpozniak95 Apr 13, 2023
96392c8
Use one command RUN
mpozniak95 Apr 14, 2023
a5bcd95
Merge remote-tracking branch 'origin/master' into update_python311
mpozniak95 Apr 21, 2023
1a8ef75
Change reference to granulate-utils
mpozniak95 Apr 21, 2023
4d3b58e
Change reference of granulate-utils to commit mpozniak95 fork to chec…
mpozniak95 Apr 27, 2023
1f19205
Change reference to fork
mpozniak95 Apr 27, 2023
b9c14c8
Use latest commit of branch update_grpcio in granulate_utils
mpozniak95 May 4, 2023
64c36a5
Change granulate-utils submodule back to granulate/granulate-utils
mpozniak95 Jun 7, 2023
22d7508
Checkout upgrade-grpcio branch that upgrades grpcio to 1.54.2
mpozniak95 Jun 7, 2023
2f3e4e3
Merge remote-tracking branch 'origin/master' into update_python311
mpozniak95 Jun 7, 2023
89fe43f
Merge remote-tracking branch 'origin/master' into python-3.11
Jongy Jan 4, 2024
5afc0fc
Merge branch 'grpcio-1-62-2' into python-3.11
slicklash Jul 8, 2024
0bc1f97
up
slicklash Jul 8, 2024
0ab1249
up
slicklash Jul 8, 2024
e47b6e5
up
slicklash Jul 8, 2024
47b3e2e
fix segfault when building with staticx 0.14.1
slicklash Jul 9, 2024
2a28657
update staticx version for aarch64
slicklash Jul 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions exe-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
# requirements for the standalone executable
pyinstaller==4.6; platform.machine == "x86_64"
# aarch64 requires a later version due to the use of a newer centos version.
# see https://github.com/pyinstaller/pyinstaller/issues/5540
pyinstaller==4.10; platform.machine == "aarch64" or sys.platform == "win32"
# for aarch64 we build a slightly patched version
# I tried upgrading to 0.13.6 but it crashes when the botoloader is run as non-root :/
# I got this error in gdb:
# (gdb) run
# Starting program: /path/to/build/x86_64/gprofiler
# During startup program terminated with signal SIGSEGV, Segmentation fault.
# staying with 0.12.1 for the mean time...
staticx==0.12.1; platform.machine == "x86_64"
pyinstaller==5.13.2
wheel==0.37.0
scons==4.2.0
32 changes: 11 additions & 21 deletions executable.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ COPY --from=perf-builder /bpftool /bpftool

WORKDIR /bcc
COPY scripts/staticx_for_pyperf_patch.diff .
COPY scripts/staticx_patch.diff .
COPY scripts/bcc_helpers_build.sh .
COPY scripts/pyperf_env.sh .
RUN ./pyperf_env.sh --with-staticx
Expand Down Expand Up @@ -154,7 +153,7 @@ RUN yum install -y epel-release && \
yum install -y libmodulemd && \
yum clean all

# python 3.10 installation
# python 3.11 installation
WORKDIR /python
RUN yum install -y \
bzip2-devel \
Expand All @@ -168,8 +167,8 @@ RUN yum install -y \
yum clean all
COPY ./scripts/openssl_build.sh .
RUN ./openssl_build.sh
COPY ./scripts/python310_build.sh .
RUN ./python310_build.sh
COPY ./scripts/python311_build.sh .
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing ws

RUN ./python311_build.sh

# gProfiler part

Expand All @@ -178,24 +177,17 @@ WORKDIR /app
RUN yum --setopt=skip_missing_names_on_install=False install -y \
gcc \
curl \
glibc-static \
libicu && \
yum clean all

# needed for aarch64 (for staticx)
RUN set -e; \
if [ "$(uname -m)" = "aarch64" ]; then \
yum install -y glibc-static zlib-devel.aarch64 && \
ln -s /usr/lib64/python3.11/lib-dynload /usr/lib/python3.11/lib-dynload && \
yum install -y zlib-devel.aarch64 && \
yum clean all; \
fi
# needed for aarch64, scons & wheel are needed to build staticx
RUN set -e; \
if [ "$(uname -m)" = "aarch64" ]; then \
ln -s /usr/lib64/python3.10/lib-dynload /usr/lib/python3.10/lib-dynload; \
fi
RUN set -e; \
if [ "$(uname -m)" = "aarch64" ]; then \
python3 -m pip install --no-cache-dir 'wheel==0.37.0' 'scons==4.2.0'; \
fi

# we want the latest pip
# hadolint ignore=DL3013
Expand Down Expand Up @@ -227,7 +219,8 @@ COPY granulate-utils/glogger granulate-utils/glogger
RUN python3 -m pip install --no-cache-dir -r requirements.txt

COPY exe-requirements.txt exe-requirements.txt
RUN python3 -m pip install --no-cache-dir -r exe-requirements.txt
RUN python3 -m pip install --no-cache-dir -r exe-requirements.txt && \
python3 -m pip install --no-cache-dir --no-binary=:all: staticx==0.14.1 # fixes gprofiler segfault

# copy PyPerf, licenses and notice file.
RUN mkdir -p gprofiler/resources/ruby && \
Expand Down Expand Up @@ -276,15 +269,12 @@ RUN pyinstaller pyinstaller.spec \
&& test -f build/pyinstaller/warn-pyinstaller.txt \
&& ./check_pyinstaller.sh

# for aarch64 - build a patched version of staticx 0.13.6. we remove calls to getpwnam and getgrnam, for these end up doing dlopen()s which
# crash the staticx bootloader. we don't need them anyway (all files in our staticx tar are uid 0 and we don't need the names translation)
COPY scripts/staticx_patch.diff staticx_patch.diff
# for aarch64 - build a patched version of staticx
# hadolint ignore=DL3003
RUN if [ "$(uname -m)" = "aarch64" ]; then \
git clone -b v0.13.6 https://github.com/JonathonReinhart/staticx.git && \
git clone -b v0.14.1 https://github.com/JonathonReinhart/staticx.git && \
cd staticx && \
git reset --hard 819d8eafecbaab3646f70dfb1e3e19f6bbc017f8 && \
git apply ../staticx_patch.diff && \
git reset --hard 033d694a6fbf0ab0952cf0ff4a476269828167af && \
ln -s libnss_files.so.2 /lib64/libnss_files.so && \
ln -s libnss_dns.so.2 /lib64/libnss_dns.so && \
python3 -m pip install --no-cache-dir . ; \
Expand Down
7 changes: 3 additions & 4 deletions scripts/pyperf_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,14 @@ if [ -n "$with_staticx" ]; then
if [ "$(uname -m)" = "aarch64" ]; then
exit 0;
fi
git clone -b v0.13.6 https://github.com/JonathonReinhart/staticx.git
git clone -b v0.14.1 https://github.com/JonathonReinhart/staticx.git
# We're using staticx to build a distribution-independent binary of PyPerf because PyPerf
# can only build with latest llvm (>10), which cannot be obtained on CentOS.
cd staticx
git reset --hard 819d8eafecbaab3646f70dfb1e3e19f6bbc017f8
git reset --hard 033d694a6fbf0ab0952cf0ff4a476269828167af
# - apply patch to ensure staticx bootloader propagates dump signal to actual PyPerf binary
# - apply patch removing calls to getpwnam and getgrnam,
# to avoid crashing the staticx bootloader on ubuntu:22.04+ and centos:8+
git apply ../staticx_for_pyperf_patch.diff ../staticx_patch.diff
git apply ../staticx_for_pyperf_patch.diff
python3 -m pip install --no-cache-dir .
cd ..
rm -rf staticx
Expand Down
6 changes: 3 additions & 3 deletions scripts/python310_build.sh → scripts/python311_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
#
set -euo pipefail

VERSION=3.10.13
VERSION=3.11.9

wget "https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz"
tar -xzf "Python-$VERSION.tgz"
cd "Python-$VERSION"
./configure --enable-optimizations --enable-shared --prefix=/usr LDFLAGS="-Wl,-rpath /usr/lib" --with-openssl=/usr --with-lto
make python install -j "$(nproc)"
./configure --enable-optimizations --enable-shared --prefix=/usr LDFLAGS="-Wl,-rpath /usr/lib"
make -j "$(nproc)" && make python install -j "$(nproc)"
28 changes: 0 additions & 28 deletions scripts/staticx_patch.diff

This file was deleted.