Skip to content

Commit 3073469

Browse files
committed
fix segfault when building with staticx 0.14.1
1 parent e47b6e5 commit 3073469

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

exe-requirements.txt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
# requirements for the standalone executable
2-
pyinstaller==5.6; platform.machine == "x86_64"
3-
# aarch64 requires a later version due to the use of a newer centos version.
4-
# see https://github.com/pyinstaller/pyinstaller/issues/5540
5-
pyinstaller==4.10; platform.machine == "aarch64" or sys.platform == "win32"
6-
# for aarch64 we build a slightly patched version
7-
# I tried upgrading to 0.13.6 but it crashes when the botoloader is run as non-root :/
8-
# I got this error in gdb:
9-
# (gdb) run
10-
# Starting program: /path/to/build/x86_64/gprofiler
11-
# During startup program terminated with signal SIGSEGV, Segmentation fault.
12-
# staying with 0.12.1 for the mean time...
13-
staticx==0.12.1; platform.machine == "x86_64"
2+
pyinstaller==5.13.2
3+
wheel==0.37.0
4+
scons==4.2.0

executable.Dockerfile

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ RUN yum install -y \
169169
COPY ./scripts/openssl_build.sh .
170170
RUN ./openssl_build.sh
171171
COPY ./scripts/python311_build.sh .
172-
RUN ./python311_build.sh && \
173-
ln -s /usr/bin/python3.11 /usr/bin/python3
172+
RUN ./python311_build.sh
174173

175174
# gProfiler part
176175

@@ -179,24 +178,17 @@ WORKDIR /app
179178
RUN yum --setopt=skip_missing_names_on_install=False install -y \
180179
gcc \
181180
curl \
181+
glibc-static \
182182
libicu && \
183183
yum clean all
184184

185185
# needed for aarch64 (for staticx)
186186
RUN set -e; \
187187
if [ "$(uname -m)" = "aarch64" ]; then \
188-
yum install -y glibc-static zlib-devel.aarch64 && \
188+
ln -s /usr/lib64/python3.11/lib-dynload /usr/lib/python3.11/lib-dynload && \
189+
yum install -y zlib-devel.aarch64 && \
189190
yum clean all; \
190191
fi
191-
# needed for aarch64, scons & wheel are needed to build staticx
192-
RUN set -e; \
193-
if [ "$(uname -m)" = "aarch64" ]; then \
194-
ln -s /usr/lib64/python3.11/lib-dynload /usr/lib/python3.11/lib-dynload; \
195-
fi
196-
RUN set -e; \
197-
if [ "$(uname -m)" = "aarch64" ]; then \
198-
python3 -m pip install --no-cache-dir 'wheel==0.37.0' 'scons==4.2.0'; \
199-
fi
200192

201193
# we want the latest pip
202194
# hadolint ignore=DL3013
@@ -228,7 +220,8 @@ COPY granulate-utils/glogger granulate-utils/glogger
228220
RUN python3 -m pip install --no-cache-dir -r requirements.txt
229221

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

233226
# copy PyPerf, licenses and notice file.
234227
RUN mkdir -p gprofiler/resources/ruby && \
@@ -281,6 +274,7 @@ RUN pyinstaller pyinstaller.spec \
281274
# 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)
282275
COPY scripts/staticx_patch.diff staticx_patch.diff
283276
# hadolint ignore=DL3003
277+
# TODO: fix me
284278
RUN if [ "$(uname -m)" = "aarch64" ]; then \
285279
git clone -b v0.13.6 https://github.com/JonathonReinhart/staticx.git && \
286280
cd staticx && \

scripts/python311_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ VERSION=3.11.9
2121
wget "https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz"
2222
tar -xzf "Python-$VERSION.tgz"
2323
cd "Python-$VERSION"
24-
./configure --enable-optimizations --enable-shared --prefix=/usr LDFLAGS="-Wl,-rpath /usr/lib" --with-openssl=/usr --with-lto
24+
./configure --enable-optimizations --enable-shared --prefix=/usr LDFLAGS="-Wl,-rpath /usr/lib"
2525
make -j "$(nproc)" && make python install -j "$(nproc)"

0 commit comments

Comments
 (0)