Hi,
Here's a hack to build and install Encode-Detect-1.01 from source.

1) Copy include/nscore.h and include/prmem.h to src/nscore.h and src/prmem.h
2) Move Detect.pm from the top level source folder to 'lib/Encode/Detect.pm'. (You'll need to first create the lib/Encode directory.)
3) In Build.PL change  dist_version_from => 'Detect.pm', to dist_version_from => 'lib/Encode/Detect.pm', 4) In the MANIFEST file change Detect.pm to lib/Encode/Detect.pm.
5) Create My_Makefile.PL in the top level source folder (alongside existing Makefile.PL)

My_Makefile.PL looks like this:
use ExtUtils::MakeMaker; use Config; die "Wrong platform" if $Config{cc} ne 'cl' && $Config{cc} ne 'gcc'; WriteMakefile( NAME => 'Encode::Detect::Detector', CC => $Config{cc} eq 'cl' ? 'cl -TP' : 'g++', VERSION_FROM => 'Detector.pm', LIBS => $Config{make} eq 'nmake' ? '-L. -lns': '-L./src -lns', INC => '-I./src', );
With Microsoft Compilers and nmake:
Then build the library by running, in turn:
a) perl Makefile.PL CC="cl -TP"
b) nmake (terminates with error, but compiles the src/*.cpp files)
c) lib /out:libns.lib *.obj
d) nmake realclean (restores to what we started with + libns.lib + object files)
Now that we have the library, let's build the module:
e) perl My_Makefile.PL
f) nmake test (should pass test suite)
g) nmake install
h) nmake realclean (to return to what we started with)

With MinGW and dmake:
Then build the library by running, in turn:
a) perl Makefile.PL CC=g++
b) dmake (terminates with error, but compiles the src/*.cpp files)
c) cd src
d) ar -rc libns.a *.o
e) ranlib libns.a
f) cd ..
g) dmake realclean (restores to what we started with + src/libns.a)
Now that we have the library, let's build the module:
h) perl My_Makefile.PL
i) dmake test (should pass test suite)
j) dmake install
k) dmake realclean (to return to what we started with + src/libns.a)

Note that, for me, when building with nmake, the object files were all built in the top level source folder (instead of the 'src' folder, as happens with dmake). I can't guarantee that the behaviour in this regard will be the same for all versions of EU::MM - if it differs you will need to modify the above instructions acccordingly.

Cheers,
Rob

In reply to Re: Cannot compile Encode::Detect on Windows by syphilis
in thread Cannot compile Encode::Detect on Windows by gvr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.