How to fix the ERROR: Failed to build gem native extension in Centos 8

[root@DBAMAXWELL ~]# gem install mongo
Building native extensions. This could take a while...
ERROR:  Error installing mongo:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/share/gems/gems/bson-4.14.1/ext/bson
/usr/bin/ruby -r ./siteconf20220325-427526-vfnj46.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/bson-4.14.1 for inspection.
Results logged to /usr/local/lib64/gems/ruby/bson-4.14.1/gem_make.out

Solution

[root@DBAMAXWELL ~]# yum install ruby-devel
Last metadata expiration check: 1:48:48 ago on Fri 25 Mar 2022 05:54:43 PM CST.
Dependencies resolved.
===============================================================================================================================================================================================================
 Package                                     Architecture                            Version                                                                  Repository                                  Size
===============================================================================================================================================================================================================
Installing:
 ruby-devel                                  x86_64                                  2.5.9-109.module_el8.5.0+1097+b05a0601                                   appstream                                  126 k

Transaction Summary
===============================================================================================================================================================================================================
Install  1 Package

Total download size: 126 k
Installed size: 294 k
Is this ok [y/N]: y
Downloading Packages:
[MIRROR] ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64.rpm: Curl error (28): Timeout was reached for http://centosg9.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/ruby-devel-2.5.9-109.module_el8.5.0%2b1097%2bb05a0601.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64.rpm                                                                                                                   1.6 kB/s | 126 kB     01:17    
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                          1.6 kB/s | 126 kB     01:18     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                       1/1 
  Installing       : ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64                                                                                                                              1/1 
  Running scriptlet: ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64                                                                                                                              1/1 
  Verifying        : ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64                                                                                                                              1/1 

Installed:
  ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64                                                                                                                                                     

Complete!
[root@DBAMAXWELL ~]# gem install mongo
Building native extensions. This could take a while...
Successfully installed bson-4.14.1
Fetching: mongo-2.17.0.gem (100%)
Successfully installed mongo-2.17.0
2 gems installed
[root@DBAMAXWELL ~]# 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值