繁体   English   中英

在ARM64 docker容器中编译typed-ast

[英]Compiling typed-ast in ARM64 docker container

我在一个多体系结构的ubuntu仿生ARM64 docker容器中构建东西。 我正在使用conan进行依赖管理。 到目前为止,一切正常。

由于某些原因,我想从Python2.7柯南切换到Python3柯南。 而不是

ARG CONAN_VERSION=1.13.1
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    python-pip \
    && pip install wheel \
    && pip install "conan==$CONAN_VERSION" \
    && apt-get remove -y python-pip

我现在做

ARG CONAN_VERSION=1.13.1
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    python3-pip \
    && pip3 install setuptools wheel \
    && pip3 install "conan==$CONAN_VERSION" \
    && apt-get remove -y python3-pip

然而这打破了我:

#12 132.3   Running setup.py install for typed-ast: started
#12 134.1     Running setup.py install for typed-ast: finished with status 'error'
#12 134.1     Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-hxn5kzw2/typed-ast/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-me7t6r8v-record/install-record.txt --single-version-externally-managed --compile:
#12 134.1     running install
#12 134.1     running build
#12 134.1     running build_py
#12 134.1     creating build
#12 134.1     creating build/lib.linux-aarch64-3.6
#12 134.1     creating build/lib.linux-aarch64-3.6/typed_ast
#12 134.1     copying typed_ast/ast3.py -> build/lib.linux-aarch64-3.6/typed_ast
#12 134.1     copying typed_ast/__init__.py -> build/lib.linux-aarch64-3.6/typed_ast
#12 134.1     copying typed_ast/ast27.py -> build/lib.linux-aarch64-3.6/typed_ast
#12 134.1     copying typed_ast/conversions.py -> build/lib.linux-aarch64-3.6/typed_ast
#12 134.1     running build_ext
#12 134.1     building '_ast27' extension
#12 134.1     creating build/temp.linux-aarch64-3.6
#12 134.1     creating build/temp.linux-aarch64-3.6/ast27
#12 134.1     creating build/temp.linux-aarch64-3.6/ast27/Parser
#12 134.1     creating build/temp.linux-aarch64-3.6/ast27/Python
#12 134.1     creating build/temp.linux-aarch64-3.6/ast27/Custom
#12 134.1     aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/usr/include/python3.6m -c ast27/Parser/acceler.c -o build/temp.linux-aarch64-3.6/ast27/Parser/acceler.o
#12 134.1     unable to execute 'aarch64-linux-gnu-gcc': No such file or directory
#12 134.1     error: command 'aarch64-linux-gnu-gcc' failed with exit status 1

显然编译认为它需要交叉编译器? gcc已安装:

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    g++-5 gcc-5 make \
    python-dev python-setuptools \
    && rm -rf /var/lib/apt/lists/* \
    && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5

所以我真的不明白这里的问题是什么?

我试图强制使用'gcc',但是没有用:

pip3 install --global-option build_ext --global-option --compiler=gcc "conan==$CONAN_VERSION"

#12 41.88     Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-vt3_j53z/typed-ast/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" build_ext --compiler=gcc install --record /tmp/pip-feshlu87-record/install-record.txt --single-version-externally-managed --compile:
#12 41.88     running build_ext
#12 41.88     error: don't know how to compile C/C++ code on platform 'posix' with 'gcc' compiler

我通过添加aarch64-linux-gnu-gcc的替代方案解决了我的问题

update-alternatives --install /usr/bin/$(gcc -dumpmachine)-gcc $(gcc -dumpmachine)-gcc /usr/bin/gcc 60 --slave /usr/bin/$(gcc -dumpmachine)-g++ $(gcc -dumpmachine)-g++ /usr/bin/g++

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM