jun*_*arn 3 c python cpython clang
我正在尝试使用 Clang 构建 CPython,具有非常具体的要求:
我尝试将 env 变量设置CC为我的 clang 可执行位置(即/opt/llvm/5/bin/clang,但该./configure命令失败并显示以下内容:
configure: error: C compiler cannot create executables
我应该设置哪些标志才能使此构建工作?
正如 OP 帖子的评论者指出的那样,您可以使用 clang 编译 cpython。以下是 Dockerfile 形式的可重现指令。
FROM ubuntu:16.04
WORKDIR /opt/cpython-2.7.14
RUN apt-get update -qq \
&& apt-get install --yes build-essential curl \
# Install clang
&& curl -fsSL https://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu16.04.tar.xz \
| tar xJ -C /usr/local --strip-components 1 \
&& curl -fsSL https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgz \
| tar xz --strip-components 1 \
&& CC=/usr/local/bin/clang ./configure --prefix /usr/local/cpython-2.7.14 \
&& make \
&& make install
ENTRYPOINT ["/usr/local/cpython-2.7.14/bin/python"]
Run Code Online (Sandbox Code Playgroud)
docker build --tag cpython:2.7 .
docker run --rm cpython:2.7 --version
# Python 2.7.14
Run Code Online (Sandbox Code Playgroud)
很难说 OP 最初的问题是什么,因为它似乎是 clang 安装的问题。查看配置日志将提供更多信息。
免责声明:Python 2 已结束生命周期,ubuntu 16.04 将于 2021 年 4 月结束生命周期。
| 归档时间: |
|
| 查看次数: |
2797 次 |
| 最近记录: |