编译与安装 OpenSSL
这篇文章将演示如何从源代码编译并安装 OpenSSL。
获取并解压源代码
1 | wget -c https://github.com/openssl/openssl/releases/download/openssl-3.5.0/openssl-3.5.0.tar.gz |
Configure
一些常见的选项有:
选项 | 描述 |
---|---|
--prefix=<path> | 指定安装目录 |
如果需要指定编译器,则添加环境变量 CC
和 CXX
.
1 | CC=clang CXX=clang++ CFLAGS="-march=native" CXXFLAGS="-march=native" ./Configure --prefix=/opt/openssl-3.5.0 |
编译并安装
1 | make -j$(nproc) |
找不到 pod2man
?
当您在特定的系统 (如 archlinux) 上执行 make install
时,可能会遇到 pod2man
找不到的错误。
请寻找该命令的位置并创建 symlink。
1 | sudo find / -name pod2man |
安装结束后删除对应的 symlink 即可。
添加到环境变量
由于使用 make install
安装到 /opt/openssl-3.5.0
,并不会自动添加到 PATH
中,因此需要手动添加。
相关资料
- OpenSSL Build and Install