Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpine linux fails with [Makefile:381: patchelf.o] Segmentation fault (core dumped) docker multiplatform: installing on linux/arm64 #588

Open
marcellodesales opened this issue Feb 13, 2025 · 1 comment
Labels

Comments

@marcellodesales
Copy link

Describe the bug

make[1]: *** [Makefile:381: patchelf.o] Segmentation fault (core dumped)
Steps To Reproduce

  • Create a multistage docker image
FROM alpine

# Install Nuitka version declared
RUN pip install nuitka==2.3.1

# Install dependencies for building patchelf
RUN apk add --update curl unzip autoconf automake libtool

# Install build-base for C compiler, g++ for C++ compiler, and required dev packages
RUN apk add --update build-base g++

# Set C++17 flags for building patchelf, as well as building with C++17
ENV CXXFLAGS="-std=c++17"
ENV LDFLAGS="-lstdc++fs"

# Download and build patchelf, required by amd64
RUN curl -L -o patchelf.tar.gz https://github.com/NixOS/patchelf/archive/refs/tags/0.18.0.tar.gz \
    && tar -xzf patchelf.tar.gz \
    && cd patchelf-0.18.0 \
    && ./bootstrap.sh \
    && ./configure \
    && make \
    && make install \
    && cd .. \
    && rm -rf patchelf.tar.gz patchelf-0.18.0

RUN apk add tree
WORKDIR /company/devsecops/platform/builder
ONBUILD RUN ls -laR /company/devsecops/platform/builder

ONBUILD RUN apk --no-cache add ca-certificates

WORKDIR /company/devsecops/platform/builder/python2bin

ONBUILD COPY Pipfile .
ONBUILD RUN pipenv install --dev --system --deploy --skip-lock
ONBUILD COPY . .

ONBUILD ARG DEVSECOPS_PYTHON_NUITKA_CMD
ONBUILD RUN echo "Will execute nuitka command: ${DEVSECOPS_PYTHON_NUITKA_CMD}"
ONBUILD RUN ${DEVSECOPS_PYTHON_NUITKA_CMD}

ONBUILD RUN echo "Executed nuitka build... listing all files"
ONBUILD RUN tree

Expected behavior

Should work like linux/amd64

patchelf --version output

#21 [linux/arm64 5/8] RUN curl -L -o patchelf.tar.gz https://github.com/NixOS/patchelf/archive/refs/tags/0.18.0.tar.gz     && tar -xzf patchelf.tar.gz     && cd patchelf-0.18.0     && ./bootstrap.sh     && ./configure     && make     && make install     && cd ..     && rm -rf patchelf.tar.gz patchelf-0.18.0
#21 0.231   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#21 0.231                                  Dload  Upload   Total   Spent    Left  Speed
#21 0.232 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
#21 0.683 
100  323k    0  323k    0     0   691k      0 --:--:-- --:--:-- --:--:--  691k
#21 1.309 autoreconf: export WARNINGS=all
#21 1.323 autoreconf: Entering directory '.'
#21 1.326 autoreconf: configure.ac: not using Gettext
#21 2.328 autoreconf: running: aclocal --force 
#21 6.483 autoreconf: configure.ac: tracing
#21 8.408 autoreconf: configure.ac: creating directory build-aux
#21 8.408 autoreconf: configure.ac: not using Libtool
#21 8.408 autoreconf: configure.ac: not using Intltool
#21 8.409 autoreconf: configure.ac: not using Gtkdoc
#21 8.409 autoreconf: running: /usr/bin/autoconf --force
#21 10.73 autoreconf: configure.ac: not using Autoheader
#21 10.73 autoreconf: running: automake --add-missing --copy --force-missing
#21 12.91 configure.ac:14: installing 'build-aux/compile'
#21 12.92 configure.ac:5: installing 'build-aux/install-sh'
#21 12.94 configure.ac:5: installing 'build-aux/missing'
#21 13.19 src/Makefile.am: installing 'build-aux/depcomp'
#21 13.60 parallel-tests: installing 'build-aux/test-driver'
#21 13.85 autoreconf: Leaving directory '.'
#21 14.36 checking for a BSD-compatible install... /usr/bin/install -c
#21 15.49 checking whether sleep supports fractional seconds... yes
#21 15.50 checking filesystem timestamp resolution... 2
#21 15.84 checking whether build environment is sane... yes
#21 15.92 checking for a race-free mkdir -p... /bin/mkdir -p
#21 15.94 checking for gawk... no
#21 15.94 checking for mawk... no
#21 15.94 checking for nawk... no
#21 15.94 checking for awk... awk
#21 15.94 checking whether make sets $(MAKE)... yes
#21 16.05 checking whether make supports nested variables... yes
#21 16.12 checking xargs -n works... yes
#21 16.16 checking for strip... strip
#21 16.16 checking for objdump... objdump
#21 16.16 checking for objcopy... objcopy
#21 16.16 checking for readelf... readelf
#21 16.16 checking whether make supports the include directive... yes (GNU style)
#21 16.26 checking for gcc... gcc
#21 16.57 checking whether the C compiler works... yes
#21 17.11 checking for C compiler default output file name... a.out
#21 17.12 checking for suffix of executables... 
#21 17.67 checking whether we are cross compiling... no
#21 18.29 checking for suffix of object files... o
#21 18.72 checking whether the compiler supports GNU C... yes
#21 19.14 checking whether gcc accepts -g... yes
#21 19.58 checking for gcc option to enable C11 features... none needed
#21 21.12 checking whether gcc understands -c and -o together... yes
#21 21.92 checking dependency style of gcc... gcc3
#21 22.38 checking for g++... g++
#21 22.62 checking whether the compiler supports GNU C++... no
#21 23.03 checking whether g++ accepts -g... yes
#21 23.50 checking for g++ option to enable C++11 features... none needed
#21 24.69 checking dependency style of g++... gcc3
#21 25.17 checking dependency style of gcc... gcc3
#21 25.66 checking whether g++ supports C++17 features with -std=c++17... yes
#21 27.10 checking that generated files are newer than configure... done
#21 27.10 configure: creating ./config.status
#21 27.81 config.status: creating Makefile
#21 27.95 config.status: creating src/Makefile
#21 28.12 config.status: creating tests/Makefile
#21 28.33 config.status: creating patchelf.spec
#21 28.45 config.status: executing depfiles commands
#21 29.42 Making all in src
#21 29.46 make[1]: Entering directory '/root/patchelf-0.18.0/src'
#21 29.46 g++ -std=c++17 -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.18.0\" -DPACKAGE_STRING=\"patchelf\ 0.18.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.18.0\" -DHAVE_CXX17=1 -I.    -Wall -Wextra -Wcast-qual -std=c++17 -D_FILE_OFFSET_BITS=64     -std=c++17 -MT patchelf.o -MD -MP -MF .deps/patchelf.Tpo -c -o patchelf.o patchelf.cc
#21 29.76 make[1]: *** [Makefile:381: patchelf.o] Segmentation fault (core dumped)
#21 29.76 make[1]: Leaving directory '/root/patchelf-0.18.0/src'
#21 29.76 make: *** [Makefile:477: all-recursive] Error 1
#21 ERROR: process "/dev/.buildkit_qemu_emulator /bin/sh -c curl -L -o patchelf.tar.gz https://github.com/NixOS/patchelf/archive/refs/tags/0.18.0.tar.gz     && tar -xzf patchelf.tar.gz     && cd patchelf-0.18.0     && ./bootstrap.sh     && ./configure     && make     && make install     && cd ..     && rm -rf patchelf.tar.gz patchelf-0.18.0" did not complete successfully: exit code: 2
------
 > importing cache manifest from seceng-devsecops-platform.docker.artifactory.company.com/devsecops/platform/builder/python2bin:cache:
------
------
 > [linux/arm64 5/8] RUN curl -L -o patchelf.tar.gz https://github.com/NixOS/patchelf/archive/refs/tags/0.18.0.tar.gz     && tar -xzf patchelf.tar.gz     && cd patchelf-0.18.0     && ./bootstrap.sh     && ./configure     && make     && make install     && cd ..     && rm -rf patchelf.tar.gz patchelf-0.18.0:
27.95 config.status: creating src/Makefile
28.12 config.status: creating tests/Makefile
28.33 config.status: creating patchelf.spec
28.45 config.status: executing depfiles commands
29.42 Making all in src
29.46 make[1]: Entering directory '/root/patchelf-0.18.0/src'
29.46 g++ -std=c++17 -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.18.0\" -DPACKAGE_STRING=\"patchelf\ 0.18.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.18.0\" -DHAVE_CXX17=1 -I.    -Wall -Wextra -Wcast-qual -std=c++17 -D_FILE_OFFSET_BITS=64     -std=c++17 -MT patchelf.o -MD -MP -MF .deps/patchelf.Tpo -c -o patchelf.o patchelf.cc
29.76 make[1]: *** [Makefile:381: patchelf.o] Segmentation fault (core dumped)
29.76 make[1]: Leaving directory '/root/patchelf-0.18.0/src'
29.76 make: *** [Makefile:477: all-recursive] Error 1
------
Dockerfile:29
--------------------
  28 |     # Download and build patchelf
  29 | >>> RUN curl -L -o patchelf.tar.gz https://github.com/NixOS/patchelf/archive/refs/tags/0.18.0.tar.gz \
  30 | >>>     && tar -xzf patchelf.tar.gz \
  31 | >>>     && cd patchelf-0.18.0 \
  32 | >>>     && ./bootstrap.sh \
  33 | >>>     && ./configure \
  34 | >>>     && make \
  35 | >>>     && make install \
  36 | >>>     && cd .. \
  37 | >>>     && rm -rf patchelf.tar.gz patchelf-0.18.0
  38 |     
--------------------
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c curl -L -o patchelf.tar.gz https://github.com/NixOS/patchelf/archive/refs/tags/0.18.0.tar.gz     && tar -xzf patchelf.tar.gz     && cd patchelf-0.18.0     && ./bootstrap.sh     && ./configure     && make     && make install     && cd ..     && rm -rf patchelf.tar.gz patchelf-0.18.0" did not complete successfully: exit code: 2
Build references
Check build summary support
Error: buildx bake failed with: ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c curl -L -o patchelf.tar.gz https://github.com/NixOS/patchelf/archive/refs/tags/0.18.0.tar.gz     && tar -xzf patchelf.tar.gz     && cd patchelf-0.18.0     && ./bootstrap.sh     && ./configure     && make     && make install     && cd ..     && rm -rf patchelf.tar.gz patchelf-0.18.0" did not complete successfully: exit code: 2

Additional context

Add any other context about the problem here.

@Patryk27
Copy link
Member

Btw, this might be actually a bug in QEMU itself (as per #544 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants