0

I have been trying to install taglib-ruby for Ruby on Windows, but I cannot figure out how to tell the gem installer where to look for my copy of taglib. The installer looks in /usr/local/ and other places like that, but this being a Windows machine, those locations don't exist and so I can't just move taglib there. I have seen this post on the github page for the gem, which tells you to specify the location using this format: CONFIGURE_ARGS="--with-opt-dir=Path/to/taglib" gem install taglib-ruby, but that does not work in the Windows powershell. I have also tried this formulation: gem install taglib-ruby -- 'CONFIGURE_ARGS="--with-opt-dir=Path/to/taglib/"'. But it likewise doesn't work.

The error message I see is:

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:...

You can see that --with-opt-dir is an option, but it is not set, even though the call shows that it was. Any ideas as to how to get this working?

Note: I've also tried setting environment variables for "with-opt-dir", and "CONFIGURE_ARGS", but they also failed.

Ben Russell
  • 127
  • 1
  • 6
soulish
  • 51
  • 7

1 Answers1

0

I ran into a similar issue and asked the maintainer via GitHub. You're right that the issue is due to the native extension build not being able to find your TagLib install. I was able to fix it by moving TagLib to a location that didn't have spaces in the path (default is C:\Program Files (x86)\taglib, so I moved it to C:\lib\taglib), and omit any quotes when setting the with-tag-dir via environment variable. I'm not sure if it makes a difference to use Ruby's preferred folder separator, but I did.

At the command line:

> 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
Ben Russell
  • 127
  • 1
  • 6