Discussion:
How to get Text::Iconv on Windows
Tolkin, Steve
2004-03-07 14:41:56 UTC
Permalink
Summary:
XML::SAX::Writer depends on Text::Iconv but I have been
unable to install this on Windows XP
despite trying three different ways.

1. The perl CPAN Iconv distribution is missing iconv.h,
so install Text::Iconv via CPAN fails.

2. I tried running ppm to download
a precompiled Iconv, but got a failure in ppm.bat.
(This might be the easiest fix.)
The ActiveState directory says that Iconv has status FAIL.
But http://theoryx5.uwinnipeg.ca/ppmpackages/ has
Text-Iconv.ppd 19-Dec-2003 00:50 418
Unfortunately this is just the metadata
and I cannot find the actual precompiled module.

3. I tried compiling the gnu programs libiconv and gettext
and got different failures there.

Or, is there any way to turn off this dependency, or
a different module that is similar but which does not have this
dependency.

Please help!

Details:

I am trying to follow the suggestion Kip made below (thanks Kip)
to use XML::SAX::Writer, but this depends on Text::Iconv.

My environment:
I am running perl 5.8.0 and MS VC 98 compiler and tools.
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
My "shell" is just cmd.exe aka command prompt aka the plain old DOS box.

1. I try to install using: perl -MCPAN -e shell
When I say
install XML::SAX::Writer
everything is fine until it stops with:
---- Unsatisfied dependencies detected during
[R/RB/RBERJON/XML-SAX-Writer-0.44.
tar.gz] -----
Text::Iconv
Shall I follow them and prepend them to the queue

If I say yes it fails due to missing iconv.h, as follows
...
CPAN.pm: Going to build M/MP/MPIOTR/Text-Iconv-1.2.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Text::Iconv

Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

cp Iconv.pm blib\lib\Text\Iconv.pm
AutoSplitting blib\lib\Text\Iconv.pm (blib\lib\auto\Text\Iconv)
C:\bin\perl.exe C:\Perl\lib\ExtUtils/xsubpp -typemap
C:\Perl\lib\ExtUti
ls\typemap -typemap typemap Iconv.xs > Iconv.xsc && C:\bin\perl.exe
-MExtUtils:
:Command -e mv Iconv.xsc Iconv.c
cl -c -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE
-DNO_ST
RICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DUSE_PERLIO
-DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERSION=\"1.2\"
-DXS_VERSION=\"
1.2\" "-IC:\Perl\lib\CORE" Iconv.c
Iconv.c
Iconv.xs(15) : fatal error C1083: Cannot open include file: 'iconv.h': No
such f
ile or directory
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2'
Stop.
C:\perl\bin\nmake.EXE -- NOT OK
Running make test
Can't test without successful make

2. Then I tried to get Iconv from the ppm shell
(which in this case is the ppm.bat file in my c:\perl\bin\).
But I hit this problem:
C:\TEMP>ppm
Can't locate XML/ValidatingElement.pm in @INC (@INC contains: c:/Perl/lib
c:/Per
l/site/lib .) at c:/Perl/site/lib/XML/PPD.pm line 8.
BEGIN failed--compilation aborted at c:/Perl/site/lib/XML/PPD.pm line 8.

It looks like it is off a level,
and/or my @INC needs to be modified. So I tried
cd \perl\site\lib\PPM
and then ran it again and got this error:

Can't locate object method "rvalidate" via package
"XML::PPMConfig::PPMCONFIG" a
t c:/Perl/site/lib/PPM.pm line 1620.

3. So I downloaded the gnu versions of libiconv and gettext and
followed the instructions in README.woe32 in libiconv and
successfully make libiconv using
nmake Makefile.msvc -NONLS=1
as stated in step 1.

Most of gettext compiled OK, but then it died,
whle trying to compile msgmerge.c (in gettest-tools/src/)
I think because of a problem in obstack.h.
the make ending with this:

/out:msgfmt.exe
msgfmt.obj
write-mo.obj
write-java.obj
write-csharp.obj
write-resources.obj
write-tcl.obj
write-qt.obj
plural-eval.obj
gettextsrc.lib
..\lib\gettextlib.lib
..\intl\intl.lib
c:\usr\lib\iconv.lib
cl -I. -I.. -I..\libuniname -I..\lib -I..\intl
-I..\..\gettext-runtime\i
ntl -I..\windows -Ic:\usr\include -W1 -D_NDEBUG -O1 -DHAVE_CONFIG_H
-DLOCALEDIR
=\"c:\\usr\\share\\locale\" -DLOCALE_ALIAS_PATH=\"\"
-DGETTEXTJAR=\"c:\\usr\\sha
re\\gettext\\gettext.jar\" -DLIBDIR=\"c:\\usr\\lib\"
-DGETTEXTDATADIR=\"c:\\usr\
\share\\gettext\" -DPROJECTSDIR=\"c:\\usr\\share\\gettext\\projects\"
-DINSTALLP
REFIX=\"c:\\usr\" -DINSTALLDIR=\"c:\\usr\\bin\" -c -Tp msgmerge.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

msgmerge.c
msgmerge.c(413) : warning C4508: 'main' : function should return a value;
'void'
return type assumed
msgmerge.c(677) : error C2660: '_obstack_begin' : function does not take 5
param
eters
msgmerge.c(693) : error C2660: '_obstack_newchunk' : function does not take
2 pa
rameters
msgmerge.c(722) : error C2660: '_obstack_newchunk' : function does not take
2 pa
rameters
msgmerge.c(752) : error C2660: '_obstack_newchunk' : function does not take
2 pa
rameters
msgmerge.c(782) : error C2660: '_obstack_newchunk' : function does not take
2 pa
rameters
msgmerge.c(824) : error C2660: '_obstack_free' : function does not take 2
parame
ters
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~3\VC98\BIN\NMAKE.EXE' :
return co
de '0x2'
Stop.
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~3\VC98\BIN\NMAKE.EXE' :
return co
de '0x2'
Stop.

But note that obstack.c did build succesfully.
(I do wonder why obstack.h is in the lib directory.)

Directory of C:\TEMP\gettext-0.14.1\gettext-tools\lib

11/05/2002 11:41 AM 19,711 obstack.c
08/24/2003 10:05 AM 23,630 obstack.h
03/07/2004 12:48 AM 3,104 obstack.obj


Thanks-in-advance-again-ly yours,
Steve
-----Original Message-----
Sent: Sunday, March 07, 2004 3:07 AM
To: Tolkin, Steve
Subject: Re: Parsing a record oriented file into XML
<snip/>
Kip Hampton's 2001 article "Writing SAX Drivers for Non-XML Data"
_http://www.xml.com/lpt/a/2001/09/19/sax-non-xml-data.html_
suggests a general technique, but there does not seem to be
a module
that does this.
Try XML::Generator::PerlData (that generates SAX2 events from
Perl data
structures) and connect it up to any SAX2 Writer.
use XML::Generator::PerlData;
use XML::SAX::Writer;
my $writer = XML::SAX::Writer->new();
my $generator = XML::Generator::PelData->new( Handler =? $writer );
open(FH, "your.wacky.file") || die "Nope: $!";
$generator->parse_starr();
while (<FH>) {
# process and munge each line from the
# file into some perl data structure--
my $hash_ref = process_record($_);
$generator->parse_chunk( $hash_ref );
}
$generator->parse_end();
close FH;
That's it. Generator::PerlData also offers a ton of options
to control
how your data gets translated; check out the perldoc for details.
Cheers,
-kip
Randy Kobes
2004-03-07 14:49:25 UTC
Permalink
Post by Tolkin, Steve
XML::SAX::Writer depends on Text::Iconv but I have been
unable to install this on Windows XP
despite trying three different ways.
1. The perl CPAN Iconv distribution is missing iconv.h,
so install Text::Iconv via CPAN fails.
2. I tried running ppm to download
a precompiled Iconv, but got a failure in ppm.bat.
(This might be the easiest fix.)
The ActiveState directory says that Iconv has status FAIL.
But http://theoryx5.uwinnipeg.ca/ppmpackages/ has
Text-Iconv.ppd 19-Dec-2003 00:50 418
Unfortunately this is just the metadata
and I cannot find the actual precompiled module.
You should just be able to say, from a command line,
ppm install http://theoryx5.uwinnipeg.ca/ppms/Text-Iconv.ppd
and ppm will fetch the binary archive for you (as specified
in the CODEBASE of the .ppd file).
Post by Tolkin, Steve
3. I tried compiling the gnu programs libiconv and gettext
and got different failures there.
I forget the details, but I recall I had to do some
fiddling with the sources to get it to compile.
--
best regards,
randy kobes
Tolkin, Steve
2004-03-07 17:59:40 UTC
Permalink
Dear Randy,
I wish think worked.
In the details section of my original email I explained
that my ppm is broken and I don't know how to fix it.

Here I repeat what I said:

2. Then I tried to get Iconv from the ppm shell
(which in this case is the ppm.bat file in my c:\perl\bin\).
But I hit this problem:
C:\TEMP>ppm
Can't locate XML/ValidatingElement.pm in @INC (@INC contains: c:/Perl/lib
c:/Per
l/site/lib .) at c:/Perl/site/lib/XML/PPD.pm line 8.
BEGIN failed--compilation aborted at c:/Perl/site/lib/XML/PPD.pm line 8.

It looks like it is off a level,
and/or my @INC needs to be modified. So I tried
cd \perl\site\lib\PPM
and then ran it again and got this error:

Can't locate object method "rvalidate" via package
"XML::PPMConfig::PPMCONFIG" a
t c:/Perl/site/lib/PPM.pm line 1620.



When I go to http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/
it says that: "PPM is included with every ActivePerl release."
And similarly on the FAQ
http://aspn.activestate.com/ASPN/docs/ActivePerl/faq/ActivePerl-faq2.html#ho
w_do_i_install_ppm
it says:
"How do I install PPM?
PPM (ppm) is installed when you install ActivePerl."

If there is no better way I will re-install perl,
but I prefer not to -- I am concerned that may break even more things.
I could not find a way to just install ppm.

Is there a way to just reinstall ppm?
Or to diagnose and repair the one I have?


Thanks,
Steve
-----Original Message-----
Sent: Sunday, March 07, 2004 9:49 AM
To: Tolkin, Steve
Subject: Re: How to get Text::Iconv on Windows
Post by Tolkin, Steve
XML::SAX::Writer depends on Text::Iconv but I have been
unable to install this on Windows XP
despite trying three different ways.
1. The perl CPAN Iconv distribution is missing iconv.h,
so install Text::Iconv via CPAN fails.
2. I tried running ppm to download
a precompiled Iconv, but got a failure in ppm.bat.
(This might be the easiest fix.)
The ActiveState directory says that Iconv has status FAIL.
But http://theoryx5.uwinnipeg.ca/ppmpackages/ has
Text-Iconv.ppd 19-Dec-2003 00:50 418
Unfortunately this is just the metadata
and I cannot find the actual precompiled module.
You should just be able to say, from a command line,
ppm install http://theoryx5.uwinnipeg.ca/ppms/Text-Iconv.ppd
and ppm will fetch the binary archive for you (as specified
in the CODEBASE of the .ppd file).
Post by Tolkin, Steve
3. I tried compiling the gnu programs libiconv and gettext
and got different failures there.
I forget the details, but I recall I had to do some
fiddling with the sources to get it to compile.
--
best regards,
randy kobes
Randy Kobes
2004-03-07 21:01:31 UTC
Permalink
Post by Tolkin, Steve
Dear Randy,
I wish think worked.
In the details section of my original email I explained
that my ppm is broken and I don't know how to fix it.
2. Then I tried to get Iconv from the ppm shell
(which in this case is the ppm.bat file in my c:\perl\bin\).
C:\TEMP>ppm
c:/Perl/site/lib .) at c:/Perl/site/lib/XML/PPD.pm line 8.
BEGIN failed--compilation aborted at c:/Perl/site/lib/XML/PPD.pm line 8.
Is there a way to just reinstall ppm?
Or to diagnose and repair the one I have?
[ ... ]

I'm not sure what the problem here is - do you have an
XML/ValidatingElement.pm somewhere under C:\Perl?
By chance, did you install the PPM package from CPAN
on top of an ActivePerl distribution? If so, it may
be that some of these files are getting mixed up.
Did ppm ever work for you?

What might be easiest in the long term is to reinstall
Perl, unfortuately, as such configuration problems may
be indicative of something more fundamentally askew.
--
best regards,
randy
Tolkin, Steve
2004-03-07 23:16:19 UTC
Permalink
Summary:
I did manage to get Text::Iconv -- as shown below.
However I think there is a bug in ppm3.
ppm3 told me that it had successfully installed
several modules but it had not -- they were not installed!
The fix was to manually install IO::Zlib from CPAN.
You can regard this as a bug report.
(Perhaps I should reinstall perl, and see if this bug goes
away, but to test it I would also need to uninstall IO::Zlib
and I don't want to do that either.)

Details:
In my c:\perl\bin there was also a ppm3.bat and I ran that.
Unlike ppm.bat, this did work.
In it I ran the command you suggested
and it seemed to work, i.e. it said it succeeded.
But in fact it had not! I believe the problem is
that I needed IO::Zlib and could not use ppm3 to
install it. Ultimately I installed this
using CPAN, and then afterwards ppm3 worked.

C:\Perl\lib>ppm3
PPM - Programmer's Package Manager version 3.0.1.
Copyright (c) 2001 ActiveState SRL. All Rights Reserved.

Entering interactive shell. Using Term::ReadLine::Perl as readline library.
...
Profile tracking is not enabled. If you save and restore profiles manually,
your profile may be out of sync with your computer. See 'help profile' for
more information.

Type 'help' to get started.

SetConsoleMode failed, LastError=|6| at c:/Perl/site/lib/Term/ReadKey.pm
line 26
8.
ppm> install http://theoryx5.uwinnipeg.ca/ppms/Text-Iconv.ppd
====================
Install 'Text-Iconv' version 1.2 in ActivePerl 5.8.0.805.
====================
Downloaded 638177 bytes.
Compression not available - Install IO::Zlib! at
c:/Perl/site/lib/PPM/Archive/Ta
r.pm line 25
Successfully installed Text-Iconv version 1.2 in ActivePerl 5.8.0.805.
ppm>

So I said

ppm> install http://theoryx5.uwinnipeg.ca/ppms/IO-Zlib.ppd
====================
Install 'IO-Zlib' version 1.01 in ActivePerl 5.8.0.805.
====================
Downloaded 4119 bytes.
Compression not available - Install IO::Zlib! at
c:/Perl/site/lib/PPM/Archive/Ta
r.pm line 25
Successfully installed IO-Zlib version 1.01 in ActivePerl 5.8.0.805.
ppm>


After installing a few more modules I said query * to see what I had

ppm> query *
Querying target 1 (ActivePerl 5.8.0.805)
1. Archive-Tar [0.072] module for manipulation of tar archives.
2. Compress-Zlib [1.16] Interface to zlib compression library
...
12. IO-Zlib [1.01] IO:: style interface to L<Compress::Zlib>
...
18. Text-Iconv [1.2] Perl interface to iconv() codeset
conversion ~
...

And iit really looks like I have installed it, e.g.


ppm> prop Text-Iconv
====================
Name: Text-Iconv
Version: 1.2
Author: Michael Piotrowski <***@dynalabs.de>
Title: Text-Iconv
Abstract: Perl interface to iconv() codeset conversion function
InstDate: Sun Mar 7 14:17:55 2004
Location: http://theoryx5.uwinnipeg.ca/ppms
Available Platforms:
1. MSWin32-x86-multi-thread-5.8
====================


But then I tried to use a module that depended on it
and I got an error. So continuing to investigate
it looks like the Iconv.pm file is nowhere to be found,
and certainly not where it ought to be.

C:\Perl\site\lib>cd ppm-conf

C:\Perl\site\lib\ppm-conf>more Text-Iconv.pkg
INSTDATE: Sun Mar 7 14:17:55 2004
INSTPACKLIST: C:\Perl\site\lib\auto\Text\Iconv\.packlist
INSTROOT: C:\Perl
LOCATION: http://theoryx5.uwinnipeg.ca/ppms
dependents: @
: XML-SAX-Writer

C:\Perl\site\lib\ppm-conf>more C:\Perl\site\lib\auto\Text\Iconv\.packlist
Cannot access file C:\Perl\site\lib\auto\Text\Iconv\.packlist

C:\Perl\site\lib\ppm-conf>dir C:\Perl\site\lib\auto\Text\Iconv\.packlist
The system cannot find the file specified.

C:\Perl\site\lib\ppm-conf>dir C:\Perl\site\lib\auto\Text\Iconv
Volume in drive C has no label.
Volume Serial Number is D83D-627F

Directory of C:\Perl\site\lib\auto\Text

File Not Found

C:\Perl\site\lib\ppm-conf>dir C:\Perl\site\lib\auto\Text
Volume in drive C has no label.
Volume Serial Number is D83D-627F

Directory of C:\Perl\site\lib\auto\Text

03/06/2004 10:52 PM <DIR> .
03/06/2004 10:52 PM <DIR> ..
04/05/2003 09:49 PM <DIR> Autoformat
03/06/2004 10:52 PM <DIR> FixedLength
0 File(s) 0 bytes
4 Dir(s) 10,592,145,408 bytes free

And when I run ppm2 again and say query * again indeed
Text-Iconv is NOT THERE ANYMORE!!
Nor are several other modules I had just installed
including IO::Zlib.

So I manually installed IO::Zlib from CPAN.
I again did the
install http://theoryx5.uwinnipeg.ca/ppms/Text-Iconv.ppd
and this time I got much more output, as follows:

ppm> install http://theoryx5.uwinnipeg.ca/ppms/Text-Iconv.ppd
====================
Install 'Text-Iconv' version 1.2 in ActivePerl 5.8.0.805.
====================
Downloaded 638177 bytes.
Extracting 26/26: blib
Installing C:\Perl\site\lib\auto\Text\Iconv\Iconv.bs
Installing C:\Perl\site\lib\auto\Text\Iconv\Iconv.dll
Installing C:\Perl\site\lib\auto\Text\Iconv\Iconv.exp
Installing C:\Perl\site\lib\auto\Text\Iconv\Iconv.lib
Installing C:\Perl\html\site\lib\Text\Iconv.html
Installing C:\Perl\site\lib\Text\Iconv.pm
Installing C:\Perl\site\lib\auto\Text\Iconv\autosplit.ix
Successfully installed Text-Iconv version 1.2 in ActivePerl 5.8.0.805.
ppm>

Now it is really there!

--
Hopefully-helpfully yours,
Steve
-----Original Message-----
Sent: Sunday, March 07, 2004 4:02 PM
To: Tolkin, Steve
Subject: RE: How to get Text::Iconv on Windows
Post by Tolkin, Steve
Dear Randy,
I wish think worked.
In the details section of my original email I explained
that my ppm is broken and I don't know how to fix it.
2. Then I tried to get Iconv from the ppm shell
(which in this case is the ppm.bat file in my c:\perl\bin\).
C:\TEMP>ppm
contains: c:/Perl/lib
Post by Tolkin, Steve
c:/Perl/site/lib .) at c:/Perl/site/lib/XML/PPD.pm line 8.
BEGIN failed--compilation aborted at
c:/Perl/site/lib/XML/PPD.pm line 8.
Post by Tolkin, Steve
Is there a way to just reinstall ppm?
Or to diagnose and repair the one I have?
[ ... ]
I'm not sure what the problem here is - do you have an
XML/ValidatingElement.pm somewhere under C:\Perl?
By chance, did you install the PPM package from CPAN
on top of an ActivePerl distribution? If so, it may
be that some of these files are getting mixed up.
Did ppm ever work for you?
What might be easiest in the long term is to reinstall
Perl, unfortuately, as such configuration problems may
be indicative of something more fundamentally askew.
--
best regards,
randy
Loading...