尝试将stock_quote
gem添加到我的gemfile时,我收到一个奇怪的错误。
错误是:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/home/cabox/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/unf_ext-0.0.7.5/ext/unf_ext
/home/cabox/.rbenv/versions/2.4.2/bin/ruby -r ./siteconf20180611-2823-17z0ly6.rb extconf.rb
checking for -lstdc++... no
creating Makefile
current directory:
/home/cabox/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/unf_ext-0.0.7.5/ext/unf_ext
make "DESTDIR=" clean
current directory:
/home/cabox/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/unf_ext-0.0.7.5/ext/unf_ext
make "DESTDIR="
compiling unf.cc
make: g++: Command not found
make: *** [unf.o] Error 127
make failed, exit code 2
Gem files will remain installed in
/home/cabox/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/unf_ext-0.0.7.5 for inspection.
Results logged to
/home/cabox/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/unf_ext-0.0.7.5/gem_make.out
An error occurred while installing unf_ext (0.0.7.5), and Bundler cannot continue.
Make sure that `gem install unf_ext -v '0.0.7.5'` succeeds before bundling.
In Gemfile:
stock_quote was resolved to 2.0.0, which depends on
rest-client was resolved to 2.0.2, which depends on
http-cookie was resolved to 1.0.3, which depends on
domain_name was resolved to 0.5.20180417, which depends on
unf was resolved to 0.1.4, which depends on
unf_ext
看到之后,我尝试在其上安装gem install unf_ext -v '0.0.7.5
,但收到了类似的错误。
我发现有类似错误的帖子,但我无法按照这些错误解决此问题。
也许问题是我使用的是CodeAnywhere Firehose box
除此之外,我不太确定它会是什么。如果您想查看我的回购请告诉我,或者如果需要更多信息,请告诉我。
答案 0 :(得分:1)
您的系统上未安装C ++编译器。如果您正在使用Ubuntu,请运行以下命令:
sudo apt-get install build-essential
通常我会安装其他几个在软件开发过程中可能会有用的软件包。
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn