robinst / taglib-ruby

Ruby interface for the TagLib C++ library, for reading and writing meta-data (tags) of many audio formats
https://robinst.github.io/taglib-ruby/
MIT License
253 stars 26 forks source link

Problems installing 1.0.1 gem on Windows 10 (0.7.1 works fine) #102

Open Mcgeecorp opened 3 years ago

Mcgeecorp commented 3 years ago

I am using rubyinstaller 2.7.2 with the msys2 devkit but have tried this with 2.4, 2.5 and 2.6 as well.

I am able to get a taglib-ruby gem to build and install if I specify version 0.7.1 but I get some "crazy errors" with version 1.0.1.

Any ideas?

Sigill commented 3 years ago

What version of taglib do you have? taglib-ruby >= 1.0 requires taglib >= 1.11.1, as mentioned in the readme: https://github.com/robinst/taglib-ruby#installation. If you don't have taglib 1.11.1, stick with taglib v0.7.1.

Mcgeecorp commented 3 years ago

Yep, I am using 1.11.1

$ pacman -Qs taglib local/mingw-w64-x86_64-taglib 1.11.1-1 A Library for reading and editing the meta-data of several popular audio formats (mingw-w64)

Sigill commented 3 years ago

Looks like the Filename type is a simple const char* on every platform, except on Windows where it is a custom class: https://github.com/taglib/taglib/blob/e36a9cabb9882e61276161c23834d966d62073b7/taglib/toolkit/tiostream.h#L35

Unfortunately, this class lack some stuff in order to behave like a const char*. The taglib-ruby wrapper generated by Swig expects the Filename type:

Hopefully, this should be an easy fix, but it must be fixed in taglib.

robinst commented 3 years ago

@Sigill Have you reported this to taglib?

Sigill commented 3 years ago

No, I have not.

s0nspark commented 6 months ago

I reported this in the hope of getting Ruby bindings to build again on Windows ;-)

Can anyone speak to what combination of taglib-ruby / taglib will build or work on Windows in the meantime? I'm using Ruby 3.3 along with MSys2...

ufleisch commented 6 months ago

Sorry for the trouble with TagLib. Version 2.0 has breaking changes. Converting a file name on Windows to char * is probably not a good idea when you want to support file names with non-ASCII characters. You should make some conditional compilation for the Windows case as has been done in VLC MR #4877

// fileName is a TagLib::FileName
#if defined(_WIN32) && TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
    std::string filename = fileName.toString().to8Bit(true);
#else
    std::string filename = std::string(fileName);
#endif

Concerning TagLib::FileName result;: I would be surprised if this was ever building on Windows since TagLib::FileName never had a default constructor.