Subject: | Ext-lib: libiconv, libintl - change proposal |
Hi,
I have an idea concerning libiconv included in strawberry perl.
The main reason for posting this proposal is the fact that it is not
possible to install perl module Text::Iconv from cpan even if we already
have iconv library included in strawberry.
The problem is that you have included both:
- static lib "libiconv.a"
- dynamic lib "libiconv.dll.a"
However libiconv headers are unfortunately designed in the following way:
- for using static lib you need to use:
gcc -DLIBICONV_STATIC example.c c:/strawberry/lib/libiconv.a -o e1.exe
- for using dynamic lib you need to use:
gcc example.c -liconv -o e2.exe
So libiconv.a expects the source to be compiled with defined
LIBICONV_STATIC whereas libiconv.dll.a not (it seems to be a sort of
Win32 specific hack).
Another issue - if a perl module has Makefile.PL like this:
***
use ExtUtils::MakeMaker;
WriteMakefile( LIBS => '-liconv' );
***
ExtUtils::MakeMaker converts '-liconv' option specified in INC param of
WriteMakefile into full paths to corresponding
*.a file - in this case c:/strawberry/lib/libiconv.a. However libiconv.a
is a static lib but ExtUtils::MakeMaker does not add necessary
-DLIBICONV_STATIC (as it is Win32 specific) to gcc command in generated
Makefile.
So in the end:
1) if you try "cpan Text::Iconv" with clean strawberry you will
experience an error like this:
Iconv.o:Iconv.c:(.text+0xb2): undefined reference to `_imp__libiconv'
Iconv.o:Iconv.c:(.text+0x135): undefined reference to `_imp__libiconv'
Iconv.o:Iconv.c:(.text+0x54d): undefined reference to `_imp__libiconvctl'
Iconv.o:Iconv.c:(.text+0x934): undefined reference to `_imp__libiconv_open'
Iconv.o:Iconv.c:(.text+0xaca): undefined reference to `_imp__libiconv_open'
Iconv.o:Iconv.c:(.text+0x191b): undefined reference to
`_imp__libiconv_close'
collect2: ld returned 1 exit status
dmake.exe: Error code 129, while making
'blib\arch\auto\Text\Iconv\Iconv.dll'
2) after renaming c:\strawberry\c\lib\libiconv.dll.a to
c:\strawberry\c\lib\libiconv.a Text::Iconv compiles OK and pass all tests.
SUGGESTION 1) - ICONV (libiconv)
- I propose to remove currently installed c:/strawberry/lib/libiconv.a
- and rename c:/strawberry/lib/libiconv.dll.a => libiconv.a
- so all '-liconv' or direct 'libiconv.a' linking will always be dynamic
(the result will have a dependency to libiconv2.dll)
SUGGESTION 2) - ICONV (libcharset)
- exactly the same *.a vs. *.dll.a issue
- I propose to remove currently installed c:/strawberry/lib/libcharset.a
- and rename c:/strawberry/lib/libcharset.dll.a => libcharset.a
SUGGESTION 3) - ICONV (libiconv2.dll)
- what was the reason to duplicate libiconv2.dll into iconv.dll?
- I am not sure if iconv.dll is really required by something.
SUGGESTION 4) - LIBINTL
- we have just libintl3.dll in strawberry (no dev files *.a/*.h)
- I propose an upgrade to the latest version (0.14.4) of libintl3.dll
from http://gnuwin32.sourceforge.net/packages/libintl.htm
- but maybe there were some reason for keeping slightly old version 0.14.1
--
kmx