在 Linux Mint 上安装杯子 Gem 时出错

Error Installing cups Gem on Linux Mint

我在安装 cups 0.1.10 gem 时遇到问题。 当我的项目文件夹中的 运行 bundle install 过程因以下错误而中断:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /tmp/bundler20170801-5492-c0toxgcups-0.1.10/gems/cups-0.1.10/ext
/usr/bin/ruby2.3 -r ./siteconf20170801-5492-1frgnir.rb extconf.rb
checking for main() in -lcups... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/$(RUBY_BASE_NAME)2.3
    --with-cupslib
    --without-cupslib
Couldn't find CUPS libraries on your system. Check they're installed and in your path.

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /tmp/bundler20170801-5492-c0toxgcups-0.1.10/extensions/x86_64-linux/2.3.0/cups-0.1.10/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20170801-5492-c0toxgcups-0.1.10/gems/cups-0.1.10 for inspection.
Results logged to /tmp/bundler20170801-5492-c0toxgcups-0.1.10/extensions/x86_64-linux/2.3.0/cups-0.1.10/gem_make.out

An error occurred while installing cups (0.1.10), and Bundler cannot continue.
Make sure that `gem install cups -v '0.1.10'` succeeds before bundling.

我已经在 OS X Sierra 10.12.6 上克隆了存储库,完全没有问题。我已经尝试使用 rvm 安装和使用安装在 OS X 上的相同版本的 ruby,但仍然没有成功。

Ruby在LinuxMint上的系统版本是ruby2.3.1pp112,我也用sudo apt-get install ruby2.3-dev安装了ruby-dev,因为我已经在很多地方都读到这是解决问题的合适方法,但它仍然存在。

错误信息是:

Couldn't find CUPS libraries on your system. Check they're installed and in your path.

安装 CUPS 库并重试 bundle install:

sudo apt-get install libcups2-dev
sudo apt-get install libcupsimage2-dev

这是 Ruby 安装 gem 时的常见模式;如果它必须编译依赖第三方库的本机扩展,那么您需要先安装第三方库。 mysql2pgnokogiri 等其他 gem 都具有相同的行为,需要安装适当的库。