[root@iZbp1ehco2fi1l7bj6hhphZ ~]# gem install mongo
Fetching: bson-4.12.1.gem (100%)
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.12.1/ext/bson
/usr/bin/ruby -r ./siteconf20211129-113231-1bhlyj1.rb extconf.rb
creating Makefile

current directory: /usr/local/share/gems/gems/bson-4.12.1/ext/bson
make "DESTDIR=" clean
rm -f
rm -f bson_native.so  *.o  *.bak mkmf.log .*.time

current directory: /usr/local/share/gems/gems/bson-4.12.1/ext/bson
make "DESTDIR="
gcc -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I.   -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -Wall -g -std=c99 -m64 -o bytebuf.o -c bytebuf.c
gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
make: *** [Makefile:243: bytebuf.o] Error 1

make failed, exit code 2

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

 解决方案:

[root@iZbp1ehco2fi1l7bj6hhphZ ~]# dnf install redhat-rpm-config

[root@iZbp1ehco2fi1l7bj6hhphZ ~]# dnf install redhat-rpm-config
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Last metadata expiration check: 1:28:59 ago on Mon 29 Nov 2021 07:45:33 AM CST.
Dependencies resolved.
========================================================================================================================================================================
 Package                                         Architecture                      Version                                   Repository                            Size
========================================================================================================================================================================
Installing:
 redhat-rpm-config                               noarch                            125-1.el8                                 appstream                             86 k
Installing dependencies:
 annobin                                         x86_64                            9.72-1.el8_5.2                            appstream                            111 k
 dwz                                             x86_64                            0.12-10.el8                               appstream                            109 k
 efi-srpm-macros                                 noarch                            3-3.el8                                   appstream                             22 k
 ghc-srpm-macros                                 noarch                            1.4.2-7.el8                               appstream                            9.3 k
 go-srpm-macros                                  noarch                            2-17.el8                                  appstream                             13 k
 ocaml-srpm-macros                               noarch                            5-4.el8                                   appstream                            9.4 k
 openblas-srpm-macros                            noarch                            2-2.el8                                   appstream                            7.9 k
 perl-srpm-macros                                noarch                            1-25.el8                                  appstream                             11 k
 qt5-srpm-macros                                 noarch                            5.15.2-1.el8                              appstream                             11 k
 rust-srpm-macros                                noarch                            5-2.el8                                   appstream                            9.2 k

Transaction Summary
========================================================================================================================================================================
Install  11 Packages

Total download size: 398 k
Installed size: 552 k
Is this ok [y/N]: y
Downloading Packages:
(1/11): efi-srpm-macros-3-3.el8.noarch.rpm                                                                                              1.0 MB/s |  22 kB     00:00
(2/11): dwz-0.12-10.el8.x86_64.rpm                                                                                                      3.5 MB/s | 109 kB     00:00
(3/11): ghc-srpm-macros-1.4.2-7.el8.noarch.rpm                                                                                          513 kB/s | 9.3 kB     00:00
(4/11): ocaml-srpm-macros-5-4.el8.noarch.rpm                                                                                            659 kB/s | 9.4 kB     00:00
(5/11): go-srpm-macros-2-17.el8.noarch.rpm                                                                                              399 kB/s |  13 kB     00:00
(6/11): openblas-srpm-macros-2-2.el8.noarch.rpm                                                                                         395 kB/s | 7.9 kB     00:00
(7/11): perl-srpm-macros-1-25.el8.noarch.rpm                                                                                            388 kB/s |  11 kB     00:00
(8/11): qt5-srpm-macros-5.15.2-1.el8.noarch.rpm                                                                                         455 kB/s |  11 kB     00:00
(9/11): redhat-rpm-config-125-1.el8.noarch.rpm                                                                                          4.6 MB/s |  86 kB     00:00
(10/11): rust-srpm-macros-5-2.el8.noarch.rpm                                                                                            542 kB/s | 9.2 kB     00:00
(11/11): annobin-9.72-1.el8_5.2.x86_64.rpm                                                                                              651 kB/s | 111 kB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                    25 kB/s | 398 kB     00:15
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                1/1
  Installing       : rust-srpm-macros-5-2.el8.noarch                                                                                                               1/11
  Installing       : qt5-srpm-macros-5.15.2-1.el8.noarch                                                                                                           2/11
  Installing       : perl-srpm-macros-1-25.el8.noarch                                                                                                              3/11
  Installing       : openblas-srpm-macros-2-2.el8.noarch                                                                                                           4/11
  Installing       : ocaml-srpm-macros-5-4.el8.noarch                                                                                                              5/11
  Installing       : go-srpm-macros-2-17.el8.noarch                                                                                                                6/11
  Installing       : ghc-srpm-macros-1.4.2-7.el8.noarch                                                                                                            7/11
  Installing       : efi-srpm-macros-3-3.el8.noarch                                                                                                                8/11
  Installing       : dwz-0.12-10.el8.x86_64                                                                                                                        9/11
  Installing       : annobin-9.72-1.el8_5.2.x86_64                                                                                                                10/11
  Installing       : redhat-rpm-config-125-1.el8.noarch                                                                                                           11/11
  Running scriptlet: redhat-rpm-config-125-1.el8.noarch                                                                                                           11/11
  Verifying        : annobin-9.72-1.el8_5.2.x86_64                                                                                                                 1/11
  Verifying        : dwz-0.12-10.el8.x86_64                                                                                                                        2/11
  Verifying        : efi-srpm-macros-3-3.el8.noarch                                                                                                                3/11
  Verifying        : ghc-srpm-macros-1.4.2-7.el8.noarch                                                                                                            4/11
  Verifying        : go-srpm-macros-2-17.el8.noarch                                                                                                                5/11
  Verifying        : ocaml-srpm-macros-5-4.el8.noarch                                                                                                              6/11
  Verifying        : openblas-srpm-macros-2-2.el8.noarch                                                                                                           7/11
  Verifying        : perl-srpm-macros-1-25.el8.noarch                                                                                                              8/11
  Verifying        : qt5-srpm-macros-5.15.2-1.el8.noarch                                                                                                           9/11
  Verifying        : redhat-rpm-config-125-1.el8.noarch                                                                                                           10/11
  Verifying        : rust-srpm-macros-5-2.el8.noarch                                                                                                              11/11

Installed:
  annobin-9.72-1.el8_5.2.x86_64             dwz-0.12-10.el8.x86_64                   efi-srpm-macros-3-3.el8.noarch            ghc-srpm-macros-1.4.2-7.el8.noarch
  go-srpm-macros-2-17.el8.noarch            ocaml-srpm-macros-5-4.el8.noarch         openblas-srpm-macros-2-2.el8.noarch       perl-srpm-macros-1-25.el8.noarch
  qt5-srpm-macros-5.15.2-1.el8.noarch       redhat-rpm-config-125-1.el8.noarch       rust-srpm-macros-5-2.el8.noarch

Complete!

 

等上面安装成功了,再执行 gem install mongo,成功安装。如图下所示:

[root@iZbp1ehco2fi1l7bj6hhphZ ~]# ruby -v
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
[root@iZbp1ehco2fi1l7bj6hhphZ ~]# gem -v
2.7.6.3
[root@iZbp1ehco2fi1l7bj6hhphZ ~]# gem install mongo
Building native extensions. This could take a while...
Successfully installed bson-4.12.1
Fetching: mongo-2.17.0.gem (100%)
Successfully installed mongo-2.17.0
2 gems installed
[root@iZbp1ehco2fi1l7bj6hhphZ ~]#

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐