我正在尝试对django应用程序进行坞化,并且使用高寒:edge作为基本映像。而pycosat安装出现错误。
In file included from pycosat.c:19:
picosat.c:8150:10: fatal error: sys/unistd.h: No such file or directory
#include <sys/unistd.h>
^~~~~~~~~~~~~~
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1这里我的Dockerfile是什么样子?
FROM alpine:edge
ENV PYTHONBUFFERED 1
RUN apk update && \
apk add --virtual build-deps gcc python3-dev musl-dev \
libffi-dev openssl-dev python3 py3-zmq build-base libzmq zeromq-dev \
curl g++ make zlib-dev linux-headers openssl ca-certificates libevent-dev
RUN pip3 install --upgrade pip setuptools
RUN mkdir /config
ADD /config/requirements.txt /config/
RUN easy_install pyzmq
RUN easy_install pycosat
RUN mkdir /src
WORKDIR /src如何才能安装这个库呢?我是不是错过了一些包裹或工具什么的?
另外,我正在使用docker-组合来构建它。
发布于 2018-10-19 15:52:15
看起来pycosat与musl是不兼容的,musl是阿尔卑斯使用的libc库实现。
musl的unistd.h头位于系统标头根文件夹/usr/include,而不是像glibc中的/usr/include/sys (glibc是事实上的Linux标准),因此fatal error: sys/unistd.h: No such file or directory编译失败。
作为一种解决方法,您可以在sys/unistd.h下创建自己的头,它将只包含本机unistd.h,然后再进行pycosat构建步骤:
RUN echo "#include <unistd.h>" > /usr/include/sys/unistd.hhttps://stackoverflow.com/questions/52894632
复制相似问题