momo's Blog.

alpine系统安装常用C编译环境

字数统计: 212阅读时长: 1 min
2021/10/19 Share

安装

主要是alpine使用的是musl-dev模块.

1
apk add --no-cache libffi-dev gcc musl-dev make

安装 cryptography 报错

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
running build_ext
generating cffi module 'build/temp.linux-x86_64-2.7/_padding.c'
creating build/temp.linux-x86_64-2.7
generating cffi module 'build/temp.linux-x86_64-2.7/_constant_time.c'
generating cffi module 'build/temp.linux-x86_64-2.7/_openssl.c'
building '_openssl' extension
creating build/temp.linux-x86_64-2.7/build
creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
gcc -fno-strict-aliasing -Os -fomit-frame-pointer -g -DNDEBUG -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o -Wconversion -Wno-error=sign-conversion
build/temp.linux-x86_64-2.7/_openssl.c:493:30: fatal error: openssl/opensslv.h: No such file or directory
#include <openssl/opensslv.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1

解决

1
apk add gcc musl-dev python3-dev libffi-dev openssl-dev

如果安装openssl-dev 没有用, 则安装libressl-dev

CATALOG
  1. 1. 安装
    1. 1.1. 安装 cryptography 报错
      1. 1.1.1. 解决