Skip Menu |

This queue is for tickets about the Audio-TagLib CPAN distribution.

Report information
The Basics
Id: 79280
Status: resolved
Priority: 0/
Queue: Audio-TagLib

People
Owner: GLEACH [...] cpan.org
Requestors: sisyphus [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.61
Fixed in: 1.62



Subject: [Win32] compilation problems using mingw port of g++
Hi, In order to build 1.61 on MS Windows, I applied this patch to TagLib.xs ######################## --- TagLib.xs_orig 2012-08-24 13:42:24 +1000 +++ TagLib.xs 2012-08-26 20:36:17 +1000 @@ -17,17 +17,30 @@ #include "iconv_wrap.h" -#ifdef do_open(a,b,c,d,e,f,g) -#undef do_open(a,b,c,d,e,f,g) +#ifdef do_open +/* #undef do_open(a,b,c,d,e,f,g) */ #undef do_open -#undef do_close(a,b) +/* #undef do_close(a,b) */ #undef do_close #endif + +#ifdef __MINGW32__ +#ifdef read +#undef read +#endif +#ifdef write +#undef write +#endif +#ifdef setbuf +#undef setbuf +#endif +#endif + #include "apeitem.h" #ifndef do_open -#define do_open Perl_do_open +/* #define do_open Perl_do_open */ #define do_open(a,b,c,d,e,f,g) Perl_do_open(aTHX_ a,b,c,d,e,f,g) -#define do_close Perl_do_close +/* #define do_close Perl_do_close */ #define do_close(a,b) Perl_do_close(aTHX_ a,b) #endif ############################ That should be portable - though that's untested. The changes to the re-defining of do_open and do_close are probably not necessary - I think they serve merely to quiet some warnings. However the undeffing of read, write and setbuf are necessary. There's another problem ... iconv_wrap.h assumes that the second arg to libiconv's iconv function (in iconv.h) is 'char **', but sometimes it can be 'const char **'. (I don't know what determines the presence/absence of the 'const' qualifier - it's something that configure determines during the building of libiconv.) Whenn the 'const' qualifier is in place, I need to also apply the following patch: ########################### --- include/iconv_wrap.h_orig 2012-08-24 13:34:03 +1000 +++ include/iconv_wrap.h_new 2012-08-26 20:38:07 +1000 @@ -26,7 +26,7 @@ #else size_t iconv_wrap(iconv_t cd, - char **inbuf, + const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) --- xs/tstring.xs_orig 2012-08-25 17:36:48 +1000 +++ xs/tstring.xs_new 2012-08-25 17:52:56 +1000 @@ -18,7 +18,8 @@ enum TagLib::String::Type t; bool is_copy_from_string = TRUE; iconv_t codec; - char *inbuf, *outbuf; + const char *inbuf; + char *outbuf; size_t inlen, outlen, utf8len; char *utf8; char *errmsg; @@ -324,7 +325,8 @@ PREINIT: iconv_t codec; char mb[8]; - char *inbuf, *outbuf; + const char *inbuf; + char *outbuf; size_t inlen, outlen; INIT: outlen = 8; --- xs/stringiterator.xs_orig 2012-08-25 17:53:38 +1000 +++ xs/stringiterator.xs_new 2012-08-25 17:54:52 +1000 @@ -53,7 +53,8 @@ iconv_t codec = iconv_open("UTF8", "WCHAR_T"); if(codec == (iconv_t)(-1)) croak("iconv_open failed"); - char *inbuf, *outbuf; + const char *inbuf; + char *outbuf; char utf8[1024]; size_t inlen, outlen; inlen = sizeof(wchar_t); ########################### Otherwise the build croaks with the diagnostic: error: invalid conversion from 'const char**' to 'char**' (With gcc, I think that conversion merely triggers a warning - but g++ apparently considers it to be a fatal error.) The annoying thing is that, if you apply that patch and the 'const' qualifier is *not* present, then the build fails - so you need to know which rendition of iconv() is to be found in iconv.h in order to know whether that patch ought to be applied. Anyway, with appropriate patches in place, Audio::TagLib then builds fine. There are some test failures - TagLib_String.t and TagLib_String_Iterator.t (on all perls that I tested) and additionally, on *some* perls only, TagLib_ID3v2_FrameList.t. I'll try to put together a bug report for those once I've had a chance to take a bit of a look. Cheers, Rob
Thanks for the patch. When you're comfortable with it, I'd like to see your Makefile.PL as well.
On Wed Aug 29 09:35:26 2012, GLEACH wrote: Show quoted text
> Thanks for the patch. When you're comfortable with it, I'd like to see > your Makefile.PL as well.
The actual Makefile.PL that I used was: #################################### use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Audio::TagLib', MIN_PERL_VERSION => '5.008001', VERSION_FROM => 'lib/Audio/TagLib.pm', LICENSE => 'perl', XSOPT => '-C++ -hiertype', DEFINE => '-DTAGLIB_STATIC', ( $Config{'version'} >= 5.005 ? ( ABSTRACT_FROM => 'lib/Audio/TagLib.pm', AUTHOR => 'Geoffrey Leach <gleach@cpan.org>' ) : () ), PREREQ_PM => { "Encode" => 0, "Test::Deep" => 0, "File::Slurp" => 0, "Test::More" => 0, "Test::Output" => 0, }, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "Config" => 0, }, ); #################################### Note that I'm building against a static libtag.a, not the shared library - hence the need to define TAGLIB_STATIC. With that Makefile.PL, I supply the INC, LIBS and CC args at the command line: perl Makefile.PL INC="-I... -I..." LIBS="-L... -ltag -liconv -lz" CC=g++ Although my build of the libtag C++ library creates and installs a taglib-config file, it's not executable in the cmd.exe shell (in which Win32 users generally run perl, and build perl extensions). For the taglib-config commands found in your to Makefile.PL to work, I think I'd have to create a taglib-config.exe that outputs the appropriate values ... or maybe I could have the Makefile.PL instead run: system 'sh', '/full/path_to/taglib-config', '--version' Let's see: ####################### C:\>sh \_64\msys\1.0\local_470\bin\taglib-config --version 1.7.2 ####################### Yep, that would work. Unfortunately, most Win32 folk wouldn't have sh.exe in their path. Many wouldn't even have it on their computer. Anyway, to keep a long story short, I can use the Makefile.PL that ships with the Audio-TagLib-1.61 source, so long as I: 1) Supply appropriate INC, LIBS and CC args on the command line; 2) DEFINE => '-DTAGLIB_STATIC', (iff I'm using a static lib); 3) Comment out the bail() test near the beginning of the Makefile.PL. (The fact that other 'taglib-config' commands don't run, doesn't seem to matter.) Btw, '/dev/null' is OS-specific. Better to instead use the portable File::Spec->devnull() in any system() commands whose output you wish to hide from view. Cheers, Rob
On Wed Aug 29 22:21:01 2012, SISYPHUS wrote: Show quoted text
> Anyway, to keep a long story short, I can use the Makefile.PL that ships > with the Audio-TagLib-1.61 source, so long as I: > 1) Supply appropriate INC, LIBS and CC args on the command line; > 2) DEFINE => '-DTAGLIB_STATIC', (iff I'm using a static lib); > 3) Comment out the bail() test near the beginning of the Makefile.PL.
I expect this could be simplified to: 1) Supply appropriate INC, LIBS, DEFINE and CC args on the command line; 2) Comment out the bail() test near the beginning of the Makefile.PL. Cheers, Rob
Subject: Re: [rt.cpan.org #79280] [Win32] compilation problems using mingw port of g++
Date: Sat, 08 Sep 2012 16:14:00 -0700
To: bug-Audio-TagLib [...] rt.cpan.org
From: Geoffrey Leach <geoff [...] hughes.net>
Rob, thanks for the updates. The iconv problem is addressed here: https://rt.cpan.org/Ticket/ Display.html?id=79280 I'd appreciate feedback. Your changes to TagLib.xs are attached. Please verify. I'm still puzzling over Makefile.PL

Message body is not shown because sender requested not to inline it.

On Sat Sep 08 19:14:23 2012, geoff@hughes.net wrote: Hi Geoff, Sorry about the delay. Show quoted text
> The iconv problem is addressed here: https://rt.cpan.org/Ticket/ > Display.html?id=79280 I'd appreciate feedback.
These changes don't seem to help me - though I don't think they do any damage either. With my 32-bit compiler I still get: C:/sisyphusion/Audio-Taglib-1.61/include/iconv_wrap.h:38:30: error: invalid conversion from 'char**' to 'const char**' and, with the patched tstring.xs: ./xs/tstring.xs: In function 'void XS_Audio__TagLib__String_getChar(PerlInterpreter*, CV*)': ./xs/tstring.xs:357:55: error: invalid conversion from 'char**' to 'const char** I'll try to do some more digging about this. Show quoted text
> Your changes to TagLib.xs are attached. Please verify.
These are ok. I still get the following warnings: TagLib.xs:44:0: warning: "do_open" redefined TagLib.xs:43:0: note: this is the location of the previous definition TagLib.xs:46:0: warning: "do_close" redefined TagLib.xs:45:0: note: this is the location of the previous definition but I can live with that :-) Cheers, Rob