in reply to Re^2: unable to install Audio::Scan module from cpan
in thread unable to install Audio::Scan module from cpan

I've just checked with my Strawberry Perl (perl 5, version 18, subversion 2 (v5.18.2) built for MSWin32-x64-multi-thread), using the following patch to the 3 files (specified in the bug report):
--- ../Audio-Scan-0.98-1/Scan.xs 2017-07-12 23:26:41 +1000 +++ Scan.xs 2017-07-12 23:25:17 +1000 @@ -12,7 +12,7 @@ #endif // Headers for stat support -#ifdef _MSC_VER +#ifdef __WIN32__ # include <windows.h> #else # include <sys/stat.h> @@ -185,7 +185,7 @@ uint64_t size = 0; uint32_t hash; -#ifdef _MSC_VER +#ifdef __WIN32__ BOOL fOk; WIN32_FILE_ATTRIBUTE_DATA fileInfo; --- ../Audio-Scan-0.98-1/include/common.h 2017-07-12 23:26:52 +1000 +++ include/common.h 2017-07-12 23:24:48 +1000 @@ -33,7 +33,7 @@ #define DEFAULT_BLOCK_SIZE 4096 -#ifndef _MSC_VER +#ifndef __WIN32__ // We use the built-in GUID type on Windows typedef struct _GUID { uint32_t Data1; --- ../Audio-Scan-0.98-1/src/common.c 2017-07-12 23:27:09 +1000 +++ src/common.c 2017-07-12 23:24:10 +1000 @@ -205,7 +205,7 @@ off_t _file_size(PerlIO *infile) { -#ifdef _MSC_VER +#ifdef __WIN32__ // Win32 doesn't work right with fstat off_t file_size;
Works fine for me.
And it should work fine with any ActiveState Perl for which 'perl-V:cc' reports that 'cc' is 'gcc'.

I must say that I find it exceedingly annoying that the author has done nothing to remove the need for this patching.
Audio-Scan-0.98 was released just 3 months ago, though the bug report was filed over 5 years ago !!

Cheers,
Rob

Replies are listed 'Best First'.
Re^4: unable to install Audio::Scan module from cpan
by Anonymous Monk on Jul 13, 2017 at 03:01 UTC

    I must say that I find it exceedingly annoying that the author has done nothing to remove the need for this patching. Audio-Scan-0.98 was released just 3 months ago, though the bug report was filed over 5 years ago !!

    Annoying traditions have traditional solutions

Re^4: unable to install Audio::Scan module from cpan
by vamank (Initiate) on Jul 14, 2017 at 11:22 UTC

    tried the above patch @syphilis. It still doesnt work. I am using active perl. Following is what i am getting still:

    C:\vaman\Audio-Scan-0.98\Audio-Scan-0.98>nmake Microsoft (R) Program Maintenance Utility Version 12.00.21005.1 Copyright (C) Microsoft Corporation. All rights reserved. Skip blib\lib\Audio\Scan.pm (unchanged) Running Mkbootstrap for Audio::Scan () C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod -- 644 Scan. +bs C:\Perl\bin\perl.exe C:\Perl\lib\ExtUtils\xsubpp -typemap C:\ +Perl\lib\ExtUtils\typemap Scan.xs > Scan.xsc && C:\Perl\bin\perl.exe + -MExtUtils::Command -e mv -- Scan.xsc Scan.c Please specify prototyping behavior for Scan.xs (see perlxs manual) gcc -c -Iinclude -Isrc -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPT +S -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DU +SE_PERLIO -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"0 +.98\" -DXS_VERSION=\"0.98\" "-IC:\Perl\lib\CORE" Scan.c In file included from src/common.c:17:0, from Scan.xs:21: include/common.h:49:16: error: redefinition of 'struct _GUID' c:\perl\site\lib\auto\mingw\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../. +./../../i686-w64-mingw32/include/guiddef.h:8:16: note: originally def +ined here include/common.h:54:11: error: conflicting types for 'GUID' c:\perl\site\lib\auto\mingw\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../. +./../../i686-w64-mingw32/include/guiddef.h:13:3: note: previous decla +ration of 'GUID' was here In file included from src/common.c:18:0, from Scan.xs:21: src/buffer.c:798:1: error: conflicting types for 'buffer_get_guid' include/buffer.h:106:6: note: previous declaration of 'buffer_get_guid +' was here In file included from src/asf.c:42:0, from Scan.xs:26: include/asf.h:30:0: warning: "IsEqualGUID" redefined [enabled by defau +lt] c:\perl\site\lib\auto\mingw\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../. +./../../i686-w64-mingw32/include/guiddef.h:145:0: note: this is the l +ocation of the previous definition NMAKE : fatal error U1077: 'C:\Perl\site\bin\gcc.EXE' : return code '0 +x1' stop.

    The error it gives is redefinition of 'struct _GUID'. It is present in \include\common.c of AudioScan project as well as in compiler at C:\Perl\site\lib\auto\MinGW\i686-w64-mingw32\include\guiddef.h.

    What do i do next.

    Just for a try, i commented 'struct_GUID' from common.h. It gave the following error:

    C:\vaman\Audio-Scan-0.98\Audio-Scan-0.98>nmake Microsoft (R) Program Maintenance Utility Version 12.00.21005.1 Copyright (C) Microsoft Corporation. All rights reserved. C:\Perl\bin\perl.exe C:\Perl\lib\ExtUtils\xsubpp -typemap C:\ +Perl\lib\ExtUtils\typemap Scan.xs > Scan.xsc && C:\Perl\bin\perl.exe + -MExtUtils::Command -e mv -- Scan.xsc Scan.c Please specify prototyping behavior for Scan.xs (see perlxs manual) gcc -c -Iinclude -Isrc -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPT +S -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DU +SE_PERLIO -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"0 +.98\" -DXS_VERSION=\"0.98\" "-IC:\Perl\lib\CORE" Scan.c In file included from src/asf.c:42:0, from Scan.xs:26: include/asf.h:30:0: warning: "IsEqualGUID" redefined [enabled by defau +lt] c:\perl\site\lib\auto\mingw\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../. +./../../i686-w64-mingw32/include/guiddef.h:145:0: note: this is the l +ocation of the previous definition C:\Perl\bin\perl.exe -MExtUtils::Mksymlists -e "Mksymlists('N +AME'=>\"Audio::Scan\", 'DLBASE' => 'Scan', 'DL_FUNCS' => { }, 'FUNCL +IST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" dlltool --def Scan.def --output-exp dll.exp g++ -o blib\arch\auto\Audio\Scan\Scan.dll -Wl,--base-file -Wl, +dll.base -mdll -s -static-libgcc -static-libstdc++ -L"C:\Perl\lib\COR +E" -L"C:\MinGW\i686-w64-mingw32\lib" Scan.o C:\Perl\lib\CORE\libper +l518.a -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 - +ladvapi32 -lshell32 -lo le32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lo +dbc32 -lodbccp32 -lcomctl32 dll.exp Scan.o:Scan.c:(.text+0x8d00): undefined reference to `uncompress' Scan.o:Scan.c:(.text+0x950e): undefined reference to `uncompress' c:/perl/site/lib/auto/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../. +./../../i686-w64-mingw32/bin/ld.exe: Scan.o: bad reloc address 0x0 in + section `.data' c:/perl/site/lib/auto/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../. +./../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid opera +tion collect2: ld returned 1 exit status NMAKE : fatal error U1077: 'C:\Perl\site\bin\g++.EXE' : return code '0 +x1' Stop.

    Also, the readmewin32 file of Audio-scan-.98 says:

    "nmake -f win32/Makefile.msc Copy zlib.lib, zlib.h, zconf.h into the Audio::Scan win32 directory (o +verwriting latter two files)".

    I downloaded audioscan.98.tar multiple times from cpan. After extract the project doesn't have any win32 folder. I want to install any working version of audio scan urgently.

    Thanks in advance.

      The error it gives is redefinition of 'struct _GUID'. It is present in \include\common.c of AudioScan project as well as in compiler at ...

      I see it in include/common.h:
      #ifndef __WIN32__ // We use the built-in GUID type on Windows typedef struct _GUID { uint32_t Data1; uint16_t Data2; uint16_t Data3; uint8_t Data4[8]; } _PACKED GUID; #endif
      However, the C pre-processor will remove that code because __WIN32__ is defined (and hence violates the "#ifndef __WIN32__" condition).
      In other words, it should not be necessary to comment out that section of code in common.h, and commenting out that code should make no difference.
      Did you perhaps incorrectly replace "#ifndef _MSC_VER" with "#ifdef __WIN32__" ?

      Scan.o:Scan.c:(.text+0x8d00): undefined reference to `uncompress'

      This happens because you need to link to libz. It seems the link has been removed - probably by the 'perl Makefile.PL' step because libz.a could not be found.
      To install libz, download the libz source, unzip it, then cd to the top level folder and run:
      mingw32-make -f win32/Makefile.gcc
      (The Audio::Scan source does not contain a win32 folder - but the libz source does.)
      Then copy the generated libz.a to one of your $Config{libpth} directories. Enter perl -V:libpth to see where those directories are.
      Your using a mingw compiler (not a micrsoft one), so you don't build libz with 'nmake', and you don't use Makefile.msc.

      Cheers,
      Rob

        the first patch u gave me said,

        --- ../Audio-Scan-0.98-1/Scan.xs 2017-07-12 23:26:41 +1000 +++ Scan.xs 2017-07-12 23:25:17 +1000 @@ -12,7 +12,7 @@ #endif // Headers for stat support -#ifdef _MSC_VER +#ifdef __WIN32__ ----

        but my scan.xs contained,

        // Headers for stat support #ifndef _MSC_VER # include <windows.h> ---

        so i have just replaced _MSC_VER with __WIN32__ at whatever files and locations you mentioned in that patch. Gave the previous output "Scan.o:Scan.c:(.text+0x8d00): undefined reference to `uncompress'" and ending up in fatal error as mentioned in above mails.

        Now regarding this reply:

        I downloaded zlib and unzipped it at "C:\vaman\zlib-1.2.8" (vaman directory also has audio scan project @C:\vaman\Audio-Scan-0.98). I executed this: C:\vaman\zlib-1.2.8\zlib-1.2.8>mingw32-make -f win32/Makefile.gcc as you said above. The generated libz.a i moved to the following location.

        @Enter perl -V:libpth :

        It gave libpth='C:\MinGW\i686-w64-mingw32\lib. So i moved libz.a to the above location.

        But still it does not get thru successfully.

        C:\vaman\Audio-Scan-0.98\Audio-Scan-0.98>nmake Microsoft (R) Program Maintenance Utility Version 12.00.21005.1 Copyright (C) Microsoft Corporation. All rights reserved. Skip blib\lib\Audio\Scan.pm (unchanged) Running Mkbootstrap for Audio::Scan () C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod -- 644 Scan. +bs gcc -c -Iinclude -Isrc -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPT +S -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DU +SE_PERLIO -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"0 +.98\" -DXS_VERSION=\"0.98\" "-IC:\Perl\lib\CORE" Scan.c In file included from src/asf.c:42:0, from Scan.xs:26: include/asf.h:30:0: warning: "IsEqualGUID" redefined [enabled by defau +lt] c:\perl\site\lib\auto\mingw\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../. +./../../i686-w64-mingw32/include/guiddef.h:145:0: note: this is the l +ocation of the previous definition dlltool --def Scan.def --output-exp dll.exp g++ -o blib\arch\auto\Audio\Scan\Scan.dll -Wl,--base-file -Wl, +dll.base -mdll -s -static-libgcc -static-libstdc++ -L"C:\Perl\lib\COR +E" -L"C:\MinGW\i686-w64-mingw32\lib" Scan.o C:\Perl\lib\CORE\libper +l518.a -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 - +ladvapi32 -lshell32 -lo le32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lo +dbc32 -lodbccp32 -lcomctl32 dll.exp Scan.o:Scan.c:(.text+0x8d00): undefined reference to `uncompress' Scan.o:Scan.c:(.text+0x950e): undefined reference to `uncompress' c:/perl/site/lib/auto/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../. +./../../i686-w64-mingw32/bin/ld.exe: Scan.o: bad reloc address 0x0 in + section `.data' c:/perl/site/lib/auto/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../. +./../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid opera +tion collect2: ld returned 1 exit status NMAKE : fatal error U1077: 'C:\Perl\site\bin\g++.EXE' : return code '0 +x1' Stop.

        Tried with dmake, but it was just to find the same issue again.

      I want to install any working version of audio scan urgently

      I've just uploaded a ppm package for it.
      You can either add http://www.sisyphusion.tk/ppm to your ppm repo list and then run:
      ppm install Audio::Scan --force
      or you could run the following 2 ppm commands in the given order:
      ppm install http://www.sisyphusion.tk/ppm/PPM-Sisyphusion.ppd --force ppm install http://www.sisyphusion.tk/ppm/Audio-Scan.ppd --force
      (The "--force" might not be needed, but it won't do any harm.)

      Tonight, I'll try to work out how you can successfully build (from source) the module on your ActivePerl.

      Cheers,
      Rob
        Hi syphilis, many thanks to you as the solution you gave above worked for me: ppm install http://www.sisyphusion.tk/ppm/PPM-Sisyphusion.ppd --force ppm install http://www.sisyphusion.tk/ppm/Audio-Scan.ppd --force When i tried to use the same to set it up on another machine and use the audio scan module, it throws the following error: The program can not run because libgcc_x86_470.dll is missing. And i don't know where did i get those libraries from in the first place. Tried typing libgcc_x86_470 in cmd to check if it exists on the machine,negative. Tried google, most of the answers are about libgcc_s_dw2-1.dll missing or msvcr110.dll missing. Any help is highly appreciated. Also, to install and use audio::scan module, are there any prerequisites from machine? First time around as well I had faced lot of problems. Can you suggest me something which can resolve general dependency issues (may be some extra installations) or some steps to successfully install audio::scan as the straight installation from ppm install or cpan is not working. Thanks in advance!