Amazon ec2 Eventmachine 1.2.7在Amazon Linux AMI上使用Ruby 2.5.1构建失败;“莱尔软呢帽”;

Amazon ec2 Eventmachine 1.2.7在Amazon Linux AMI上使用Ruby 2.5.1构建失败;“莱尔软呢帽”;,amazon-ec2,centos,eventmachine,ruby-2.5,Amazon Ec2,Centos,Eventmachine,Ruby 2.5,在AmazonLinuxAMI上安装EventMachineGem时遇到问题,在ruby-2.3.6上运行良好,在ruby-2.5.1上中断 步骤: gem安装eventmachine 注:gcc版本7.2.1 20170915(Red Hat 7.2.1-2)(gcc) 错误日志: Building native extensions. This could take a while... ERROR: Error installing eventmachine: ERROR: Faile

在AmazonLinuxAMI上安装EventMachineGem时遇到问题,在ruby-2.3.6上运行良好,在ruby-2.5.1上中断
步骤:
gem安装eventmachine


注:
gcc版本7.2.1 20170915(Red Hat 7.2.1-2)(gcc)

错误日志:

Building native extensions. This could take a while...
ERROR:  Error installing eventmachine:
ERROR: Failed to build gem native extension.
current directory: /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/eventmachine-1.2.7/ext
/home/ec2-user/.rvm/rubies/ruby-2.5.1/bin/ruby -r ./siteconf20180724- 
3006-y7es83.rb extconf.rb
checking for -lcrypto... yes
checking for -lssl... yes
checking for openssl/ssl.h... yes

checking for CLOCK_MONOTONIC in time.h... yes
CXXFLAGS=$(cxxflags)

creating Makefile
current directory: /home/ec2-user/.rvm/gems/ruby 2.5.1/gems/eventmachine-1.2.7/ext
make "DESTDIR=" clean
current directory: /home/ec2-user/.rvm/gems/ruby- 
2.5.1/gems/eventmachine-1.2.7/ext
make "DESTDIR="

compiling binder.cpp
g++: error: unrecognized command line option ‘-Wmisleading-indentation’
g++: error: unrecognized command line option ‘-Wimplicit-fallthrough=0’
g++: error: unrecognized command line option ‘-Wduplicated-cond’
g++: error: unrecognized command line option ‘-Wrestrict’

make: *** [binder.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/eventmachine-1.2.7 for inspection.
Results logged to /home/ec2-user/.rvm/gems/ruby-2.5.1/extensions/x86_64-linux/2.5.0/eventmachine-1.2.7/gem_make.out

这似乎是因为AWS内核更新后,AWS上的gcc和g++版本不匹配。解决方案是运行:

sudo yum remove gcc48-c++
sudo yum install gcc72-c++

请参见

@shivam_v花时间发表评论,但不投票或接受答案。。。对此表示歉意,但我确实向你投了赞成票:)只是因为我的声誉低于15票,所以我的赞成票不公开。我想你可以帮我把我的问题投上去帮你?