python静态编译器_用OpenSSL静态编译python3.6

我试图用OpenSSL在Linux上静态编译python3.6。在

我的构建是在dockerfile中进行的,但实际上是:$ ./configure --prefix=/task/build --disable-shared LDFLAGS="-static"

$ make altinstall

通过对Modules/Setup.local的更新使其看起来像:

^{pr2}$

但是,在配置步骤中,我得到错误:Step 9/14 : RUN ./configure --prefix=/task/build --disable-shared LDFLAGS="-static"

---> Running in cb79ee47052b

checking for git... found

checking build system type... x86_64-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu

checking for python3.6... no

checking for python3... no

checking for python... python

checking for --enable-universalsdk... no

checking for --with-universal-archs... no

checking MACHDEP... linux

checking for --without-gcc... no

checking for --with-icc... no

checking for gcc... gcc

checking whether the C compiler works... no

configure: error: in `/task/cpython':

configure: error: C compiler cannot create executables

See `config.log' for more details

The command '/bin/sh -c ./configure --prefix=/task/build --disable-shared LDFLAGS="-static"' returned a non-zero code: 77

如果我将configure命令更改为:$ ./configure --prefix=/task/build --disable-shared

我得到了一个编译后的二进制文件,但它没有静态链接到OpenSSL。在

我做错什么了?在

谢谢!在

构建dockerfile:FROM amazonlinux:2017.03.1.20170812

ARG python_version=3.6.8

WORKDIR /task

COPY Modules-Setup.local /task/Modules-Setup.local

# Install requirements

RUN yum install -y \

gcc \

git \

gzip \

openssl-devel \

tar \

zlib \

zlib-devel

# Get openssl and python source

RUN git clone https://github.com/python/cpython.git

WORKDIR /task/cpython

RUN git checkout tags/v${python_version}

# Configure the build

RUN ./configure --prefix=/task/build --disable-shared LDFLAGS="-static"

# append modules setup with custom values

RUN cat /task/Modules-Setup.local >> /task/cpython/Modules/Setup.local

RUN cat /task/cpython/Modules/Setup.local

# Build

RUN make altinstall

# Zip the results

WORKDIR /task/build

RUN tar --create --gzip --file=/task/python-${python_version}.tar.gz \

lib/ bin/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值