indygreg/PyOxidizer

Cannot compile kapitan project - cffi dependency

jkrzemin opened this issue · 0 comments

I'm trying to compile to static binary https://github.com/kapicorp/kapitan.

Dynamic build works fine, but when trying to make a static binary I just can't work around this error:

  musl-clang -fno-strict-aliasing -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -I/tools/deps/libedit/include -static -fPIC -DFFI_BUILDING=1 -DUSE__THREAD -I/root/.cache/pyoxidizer/python_distributions/python.771eaf1ed737/python/install/include/python3.10 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.10/c/_cffi_backend.o
  clang: warning: argument unused during compilation: '-fuse-ld=musl-clang' [-Wunused-command-line-argument]
  clang: warning: argument unused during compilation: '-static-libgcc' [-Wunused-command-line-argument]
  clang: warning: argument unused during compilation: '-L-user-start' [-Wunused-command-line-argument]
  clang: warning: argument unused during compilation: '-L/usr/lib' [-Wunused-command-line-argument]
  clang: warning: argument unused during compilation: '-L-user-end' [-Wunused-command-line-argument]
  In file included from c/_cffi_backend.c:2:
  In file included from /root/.cache/pyoxidizer/python_distributions/python.771eaf1ed737/python/install/include/python3.10/Python.h:11:
  /usr/include/limits.h:26:10: fatal error: 'bits/libc-header-start.h' file not found
  #include <bits/libc-header-start.h>
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  error: command '/usr/bin/musl-clang' failed with exit code 1
  error: subprocess-exited-with-error

Environment in which I'm trying to build is a docker container - Dockefile is below.

FROM rust:latest
ENV DEBIAN_FRONTEND noninteractive
RUN apt update && apt install -y clang binutils --no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN curl -LO http://www.musl-libc.org/releases/musl-1.2.2.tar.gz && tar -xvf musl-1.2.2.tar.gz
WORKDIR musl-1.2.2
RUN ./configure --prefix=/usr --enable-wrapper=all && make && make install
WORKDIR /opt/pyoxidizer
ADD https://github.com/indygreg/PyOxidizer/releases/download/pyoxidizer%2F0.24.0/pyoxidizer-0.24.0-x86_64-unknown-linux-musl.tar.gz /opt/pyoxidizer/pyoxidizer-0.24.0-x86_64-unknown-linux-musl.tar.gz
RUN tar xzvf /opt/pyoxidizer/pyoxidizer-0.24.0-x86_64-unknown-linux-musl.tar.gz
RUN cp -v /opt/pyoxidizer/pyoxidizer-0.24.0-x86_64-unknown-linux-musl/pyoxidizer /usr/bin/pyoxidizer
RUN rustup target add x86_64-unknown-linux-musl

WORKDIR /src

Can anyone point me in some direction?