indygreg / indygreg/PyOxidizer

Cannot compile kapitan project - cffi dependency

Open
#685 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

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
^~~~~~~~~~~~~~~~~~~~~~~~~~
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?

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue provides a Dockerfile and the failing c/_cffi_backend.c compile command; start by reproducing the static build in that container and checking the libc headers used by musl-clang. Done means identifying a supported build setup or dependency fix that lets the PyOxidizer build complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, docker, python, rust
Domain
build-system, devops, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.