Ubuntu22.04无法安装Ruby 2.7.6

使用Rvm在Ubuntu22.04系统中无法安装ruby2.7版本,因为Ubuntu22.04使用了OpenSSl3.0而非1.1.x系列版本所以必须使用ruby3.0以上版本。

报错如下:

cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
compiling raddrinfo.c
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
make[2]: 离开目录“/home/k/.rvm/src/ruby-2.7.2/ext/json/generator”
compiling ifaddr.c
In file included from option.c:1:
rubysocket.h:118:36: warning: argument 2 of type ‘char *’ declared as a pointer [-Warray-parameter=]
  118 | char *if_indextoname(unsigned int, char *);
      |                                    ^~~~~~
In file included from rubysocket.h:97,
                 from option.c:1:
/usr/include/net/if.h:195:35: note: previously declared as an array ‘char[16]’
  195 |                              char __ifname[IF_NAMESIZE]) __THROW
      |                              ~~~~~^~~~~~~~~~~~~~~~~~~~~
installing default socket libraries
In file included from raddrinfo.c:11:
rubysocket.h:118:36: warning: argument 2 of type ‘char *’ declared as a pointer [-Warray-parameter=]
  118 | char *if_indextoname(unsigned int, char *);
      |                                    ^~~~~~
In file included from rubysocket.h:97,
                 from raddrinfo.c:11:
/usr/include/net/if.h:195:35: note: previously declared as an array ‘char[16]’
  195 |                              char __ifname[IF_NAMESIZE]) __THROW
      |                              ~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from ancdata.c:1:
rubysocket.h:118:36: warning: argument 2 of type ‘char *’ declared as a pointer [-Warray-parameter=]
  118 | char *if_indextoname(unsigned int, char *);
      |                                    ^~~~~~
In file included from rubysocket.h:97,
                 from ancdata.c:1:
/usr/include/net/if.h:195:35: note: previously declared as an array ‘char[16]’
  195 |                              char __ifname[IF_NAMESIZE]) __THROW
      |                              ~~~~~^~~~~~~~~~~~~~~~~~~~~
linking shared-object bigdecimal.so
In file included from ifaddr.c:1:
rubysocket.h:118:36: warning: argument 2 of type ‘char *’ declared as a pointer [-Warray-parameter=]
  118 | char *if_indextoname(unsigned int, char *);
      |                                    ^~~~~~
In file included from rubysocket.h:97,
                 from ifaddr.c:1:
/usr/include/net/if.h:195:35: note: previously declared as an array ‘char[16]’
  195 |                              char __ifname[IF_NAMESIZE]) __THROW
      |                              ~~~~~^~~~~~~~~~~~~~~~~~~~~
make[2]: 离开目录“/home/k/.rvm/src/ruby-2.7.2/ext/bigdecimal”
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
linking shared-object zlib.so
make[2]: 离开目录“/home/k/.rvm/src/ruby-2.7.2/ext/zlib”
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
linking shared-object socket.so
make[2]: 离开目录“/home/k/.rvm/src/ruby-2.7.2/ext/socket”
make[1]: 离开目录“/home/k/.rvm/src/ruby-2.7.2”
make: *** [uncommon.mk:295:build-ext] 错误 2
++ return 2

如果必须安装旧版的情况加使用

rvm pkg install openssl

rvm reinstall 2.7.6 --with-openssl-dir=/home/$(whoami)/.rvm/usr

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值