vamank has asked for the wisdom of the Perl Monks concerning the following question:

hello, i am using "perl 5, version 18, subversion 2 (v5.18.2) built for MSWin32-x86-multi-thread-64int" on windows 7 enterprise(SP1).

I am trying to compile and install a perl module Audio::Scan (.71 version). I downloaded the module from cpan.org, extracted it locally in my machine. It contains readme.win32 text file which states the following:

zlib ---- The included zlib.lib should just work, if not: Download zlib from htt +p://www.zlib.net/zlib123.zip. Build from projects/visualc6/zlib.dsw. Build Win32_LIB_Release Copy zlib.lib into the Audio::Scan win32 direc +tory. Audio::Scan ----------- Install ActivePerl 5.8.8 or 5.10.0. Open command prompt. Run the vcvar +s file, for example C:\Program Files\Microsoft Visual Studio 8\VC\vcv +arsall.bat perl Makefile.PL nmake nmake test ------- END

I followed all the steps till nmake. The step before nmake i executed like this "perl Makefile.PL make=nmake" as it was generating it dmake style by default. This step goes well. But in nmake step, i get a lot of warnings followed by the following error:

win32/zlib.lib(./Win32_LIB_Release/crc32.obj):(.text$mn+0x22): undefin +ed reference to `@__security_check_cookie@4' win32/zlib.lib(./Win32_L +IB_Release/crc32.obj):(.text$mn+0x1be): undefined reference to `@__se +curity_check_cookie@4' c:/perl/site/lib/auto/mingw/bin/../lib/gcc/i68 +6-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: win32/zl +ib.lib(./Win32_LIB_Release/crc32.obj): bad reloc address 0x1be in sec +tion `.text$mn' 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:\Per +l\site\bin\g++.EXE' : return code '0x1' Stop.

I read this thread Not able to compile perl modules in windows checked the compiler used to compile perl as follows:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC>perl -V:cc

it returned,

cc='gcc';

I am stuck at this point. Any help would be highly appreciated. Sorry for typos if any.

Replies are listed 'Best First'.
Re: unable to install Audio::Scan module from cpan
by syphilis (Archbishop) on Jul 12, 2017 at 13:05 UTC
    ... as it was generating it dmake style by default

    Start afresh.
    Try correcting the source and then building it manually by running 'perl Makefile.PL' then 'dmake test' then 'dmake install' (if 'dmake test' goes ok.)
    I haven't tested to see how that goes ...

    Cheers,
    Rob

      dmake also ends in a pretty similar fashion in the following way:

      win32/zlib.lib(./Win32_LIB_Release/crc32.obj):(.text$mn+0x22): undefin +ed reference to `@__security_check_cookie@4' win32/zlib.lib(./Win32_LIB_Release/crc32.obj):(.text$mn+0x1be): undefi +ned reference to `@__security_check_cookie@4' c:/perl/site/lib/auto/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../. +./../../i686-w64-mingw32/bin/ld.exe: win32/zlib.lib(./Win32_LIB_Relea +se/crc32.obj): bad reloc address 0x1be in section `.text$mn' 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 dmake.exe: Error code 129, while making 'blib\arch\auto\Audio\Scan\Sc +an.dll'

      When i went to scan folder, there is no scan.dll present inside.

      I did a little google search, it says this arise when i have both active and strawberry perl installed. But i have only active perl installed.

        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