如何在RHEL 8.6中为Perl 5.36设置环境变量适配OpenSSL编译
解决OpenSSL configure调用旧Perl版本的问题
临时生效方案(单次会话)
先确认Perl 5.36的可执行文件路径:
which perl会输出类似
/home/build/.activestate/bin/perl的路径。方法一:直接指定Perl路径运行OpenSSL的Configure脚本
/home/build/.activestate/bin/perl ./Configure --prefix=/auto/open/linux/openssl no-threads no-ecdh no-ec -fPIC方法二:临时调整PATH环境变量(让系统优先找到Perl 5.36)
export PATH=/home/build/.activestate/bin:$PATH # 接着运行OpenSSL的config命令 ./config --prefix=/auto/open/linux/openssl no-threads no-ecdh no-ec -fPIC
永久生效方案(当前用户)
编辑你的shell配置文件(比如~/.bashrc或~/.bash_profile,根据使用的shell选择),添加以下内容:
# 加载ActiveState Perl的环境配置 source "$HOME/.activestate/activestate.env"
保存文件后,执行以下命令让配置立即生效:
source ~/.bashrc
之后新打开的shell会话都会默认使用Perl 5.36。
特殊情况处理:OpenSSL config脚本硬编码Perl路径
如果上述方法都无效,说明config脚本硬编码了系统Perl的绝对路径。直接修改脚本第一行:
- 打开
config文件:vi ./config - 将第一行的
#!/usr/bin/perl替换为Perl 5.36的绝对路径,比如:#!/home/build/.activestate/bin/perl - 保存后重新运行
./config命令即可。
内容的提问来源于stack exchange,提问作者R Saravanan
相关产品推荐
相关产品推荐

