在Windows上安装taglib-ruby gem

时间:2016-10-11 00:55:28

标签: ruby windows powershell taglib taglib-ruby

我一直在尝试在Windows上为Ruby安装taglib-ruby,但我无法弄清楚如何告诉gem安装程序在哪里查找我的taglib副本。安装程序在/ usr / local /和其他类似的地方查找,但这是一台Windows机器,这些位置不存在,所以我不能只在那里移动taglib。我在gem的github页面上看到了this post,它告诉你使用这种格式指定位置:CONFIGURE_ARGS="--with-opt-dir=Path/to/taglib" gem install taglib-ruby,但这在Windows PowerShell中不起作用。我也试过这个表述:gem install taglib-ruby -- 'CONFIGURE_ARGS="--with-opt-dir=Path/to/taglib/"'。但它同样不起作用。

我看到的错误信息是:

Temporarily enhancing PATH to include DevKit... Building native
extensions with: '--with-opt-dir=/hi/' This could take a while...
ERROR:  Error installing taglib-ruby:
        ERROR: Failed to build gem native extension.

current directory: C:/XXXXXXX/taglib_base C:/XXXXX/ruby.exe -r ./siteconf20161010-10032-1260rq7.rb extconf.rb --with-opt-dir=/hi/
checking for main() in -lstdc++... yes 
checking for main() in -ltag... no 
You must have taglib installed in order to use taglib-ruby.

Debian/Ubuntu: sudo apt-get install libtag1-dev 
Fedora/RHEL: sudo yum install taglib-devel 
Brew: brew install taglib 
MacPorts: sudo port install taglib

*** 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
    --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=C:/Ruby23-x64/bin/$(RUBY_BASE_NAME)
    --with-tag-dir
    --without-tag-dir
    --with-tag-include
    --without-tag-include=${tag-dir}/include
    --with-tag-lib
    --without-tag-lib=${tag-dir}/lib
    --with-stdc++lib
    --without-stdc++lib
    --with-taglib
    --without-taglib

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

你可以看到--with-opt-dir是一个选项,但它没有设置,即使调用显示它是。关于如何使这个工作的任何想法?

注意:我也尝试为“with-opt-dir”和“CONFIGURE_ARGS”设置环境变量,但它们也失败了。

1 个答案:

答案 0 :(得分:0)

我遇到了类似的问题,并通过GitHub问维护者。您是对的,问题是由于本机扩展构建无法找到您的TagLib安装。我能够通过将TagLib移动到路径中没有空格的位置来修复它(默认为C:\Program Files (x86)\taglib,所以我将其移动到C:\lib\taglib),并在设置时忽略任何引号-tag-dir通过环境变量。我不确定使用Ruby的首选文件夹分隔符是否有所作为,但我做到了。

在命令行:

> set CONFIGURE_ARGS="--with-tag-dir=C:/lib/taglib-1.9.1"
> echo %CONFIGURE_ARGS%
  "--with-tag-dir=C:/lib/taglib-1.9.1"
> gem install taglib-ruby
相关问题