in reply to libintl.a for Strawberry Perl

I'm desperately seeking a libintl.a for Strawberry Perl...

If you have MSYS2, then pacman will be able to install libintl - and that library will then be accessible to Strawberry Perl.
It's a bit of a process getting MSYS2 installed, and I'm not the best candidate for providing guidance - but there is the wiki.
BTW, if Strawberry's perl -V:archname output matches 'x64' then you want the "64 bit" MSYS2. Otherwise you want the 32 bit version.

Other than that, if you provide me with the output of perl -V:archname I might be able to help out.

For which perl module are you wanting libintl ?

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: libintl.a for Strawberry Perl
by fdesar (Beadle) on Jan 24, 2019 at 14:25 UTC

    Great: I finally found it as you said in in MSYS2: libintl.a (and libintl.h too)

    But that doesn't seem sufficient: when I compile and link a simple program calling gettext(), I get a linking error :

    Program:

    #include "libintl.h" int main() { gettext("abc"); }

    Compiling:

    C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\Moi\test>gcc -o t +est test.c C:\Users\Moi\AppData\Local\Temp\ccCWWHXa.o:test.c:(.text+0x15): undefi +ned reference to `libintl_gettext' collect2.exe: error: ld returned 1 exit status

    I'm puzzled for now...

    BTW, the module I want to get working is Locale::gettext which does exactly what I need under Linux and macOS.

    I tried the Gido's pure Perl version of Locale::gettext_pp but his code doen't understand the windows pseudo-locale so it doesn't work.

    PS: before, I hated Windows but I think now I abhor it! :-(

      Your problem is the supplied library from Developer Files is in 32-bit format and your using 64-bit Strawberry Perl; and thus, 64-bit gcc. Your test program above compiles fine for me with Strawberry 5.18 32-bit:

      gcc .\test.c -I.\include -L.\lib -lintl -o test.exe

      Try a 32-bit Perl (and thus 32-bit gcc) or try the following.

      Using your existing 64-bit Strawberry (and thus 64-bit gcc), from a cmd.exe prompt in the directory where you unzip both the Developer files (from above) link and the Binaries

      pexports .\bin\libintl3.dll > intl.def dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libintl.a --inp +ut-def intl.def gcc .\test.c -I .\include -L . -lintl -o test.exe

      The above worked for me - creating my own 64-bit libintl.a from the provided libintl3.dll and then compiling test.exe linking that created libintl.a

        I confirm: it works for me too: many, many thanks!
        Sounds logical, thanks. I’ll try that asap. Curiously, the libintl. a I copied was from MSY2 mingwing 64 (and it neither works on it!). So they it seems they do have a bug in their 64bit distribution too...

        Many thanks!

        OK, now I can compile Locale::gettext correctly. But unfortunatly, the gettext.xs.dll it builds up won't load.

        I used the Strawberry portable Perl 64 with the standard build method (as cpan fails) by downloading the module and doing perl Makefile.PL; gmake to generate it. And it fails on gmake test.

        If I ldd gettext.xs.dll, I find it has some unknown unresolved references:

        ldd.exe gettext.xs.dll ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ffb4d030000) KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ffb4ac300 +00) KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ffb49 +e50000) ??? => ??? (0x67a00000) ??? => ??? (0x7ffb4a490000)

        but "???" doesn't really help to identify the problem. I suspect it still has something to do with 32bit vs 64bit but don't really know what to do next. Searching... :-)

        I think the two unknown references should have been:

        apphelp.dll => /c/Windows/SYSTEM32/apphelp.dll (0x7ffb47210000) msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ffb4a490000)

        Here is the log of gmake in case it could help:

        "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\perl\bin\perl.ex +e" -MExtUtils::Command::MM -e cp_nonempty -- gettext.bs blib\arch\aut +o\Locale\gettext\gettext.bs 644^M "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\perl\bin\perl.ex +e" "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\Ext +Utils/xsubpp" -typemap C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-p +ortable\perl\lib\ExtUtils\typemap gettext.xs > gettext.xsc^M Please specify prototyping behavior for gettext.xs (see perlxs manual) +^M "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\perl\bin\perl.ex +e" -MExtUtils::Command -e mv -- gettext.xsc gettext.c^M gcc -c -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDI +O -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS + -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2 -D +VERSION=\"1.07\" -DXS_VERSION=\"1.07\" "-IC:\Users\Moi\strawberry-pe +rl-5.28.1.1-64bit-portable\perl\lib\CORE" gettext.c^M "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\perl\bin\perl.ex +e" -MExtUtils::Mksymlists \^M -e "Mksymlists('NAME'=>\"Locale::gettext\", 'DLBASE' => 'gettext' +, 'DL_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' +=> []);"^M g++.exe gettext.def -o blib\arch\auto\Locale\gettext\gettext.xs.dll -m +dll -s -L"C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\perl\l +ib\CORE" -L"C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\c\li +b" gettext.o "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\ +perl\lib\CORE\libperl528.a" "C:\Users\Moi\strawberry-perl-5.28.1.1-64 +bit-portable\c\lib\libintl.a" "C:\Users\Moi\strawberry-perl-5.28.1.1- +64bit-portable\c\x86_64-w64-mingw32\lib\libmoldname.a" "C:\Users\Moi\ +strawberry-perl-5.28.1.1-64bit-portable\c\x86_64-w64-mingw32\lib\libk +ernel32.a" "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\c\x8 +6_64-w64-mingw32\lib\libuser32.a" "C:\Users\Moi\strawberry-perl-5.28. +1.1-64bit-portable\c\x86_64-w64-mingw32\lib\libgdi32.a" "C:\Users\Moi +\strawberry-perl-5.28.1.1-64bit-portable\c\x86_64-w64-mingw32\lib\lib +winspool.a" "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\c\x +86_64-w64-mingw32\lib\libcomdlg32.a" "C:\Users\Moi\strawberry-perl-5. +28.1.1-64bit-portable\c\x86_64-w64-mingw32\lib\libadvapi32.a" "C:\Use +rs\Moi\strawberry-perl-5.28.1.1-64bit-portable\c\x86_64-w64-mingw32\l +ib\libshell32.a" "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portabl +e\c\x86_64-w64-mingw32\lib\libole32.a" "C:\Users\Moi\strawberry-perl- +5.28.1.1-64bit-portable\c\x86_64-w64-mingw32\lib\liboleaut32.a" "C:\U +sers\Moi\strawberry-perl-5.28.1.1-64bit-portable\c\x86_64-w64-mingw32 +\lib\libnetapi32.a" "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-port +able\c\x86_64-w64-mingw32\lib\libuuid.a" "C:\Users\Moi\strawberry-per +l-5.28.1.1-64bit-portable\c\x86_64-w64-mingw32\lib\libws2_32.a" "C:\U +sers\Moi\strawberry-perl-5.28.1.1-64bit-portable\c\x86_64-w64-mingw32 +\lib\libmpr.a" "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\ +c\x86_64-w64-mingw32\lib\libwinmm.a" "C:\Users\Moi\strawberry-perl-5. +28.1.1-64bit-portable\c\x86_64-w64-mingw32\lib\libversion.a" "C:\User +s\Moi\strawberry-perl-5.28.1.1-64bit-portable\c\x86_64-w64-mingw32\li +b\libodbc32.a" "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\ +c\x86_64-w64-mingw32\lib\libodbccp32.a" "C:\Users\Moi\strawberry-perl +-5.28.1.1-64bit-portable\c\x86_64-w64-mingw32\lib\libcomctl32.a" -Wl, +--enable-auto-image-base^M "C:\Users\Moi\strawberry-perl-5.28.1.1-64bit-portable\perl\bin\perl.ex +e" -MExtUtils::Command -e chmod -- 755 blib\arch\auto\Locale\gettext\ +gettext.xs.dll^

      Try gcc -o test test.c -lintl assuming libintl.* is in the libraries search path, alternatively tell gcc where to find it using -L blahblahlocation

        I even tried:

        gcc -o test -lintl -I. test.c

        with the same result.

        But when I try to link with the libintl.a itself, I get a very different result:

        gcc -o test test.c libintl.a libintl.a(dcigettext.o):(.text+0x4bf): undefined reference to `__errno +' libintl.a(dcigettext.o):(.text+0xb7d): undefined reference to `__errno +' libintl.a(dcigettext.o):(.text+0xcf6): undefined reference to `__errno +' libintl.a(dcigettext.o):(.text+0xd25): undefined reference to `__errno +' libintl.a(dcigettext.o):(.text+0xdc9): undefined reference to `stpcpy' libintl.a(dcigettext.o):(.text+0xede): undefined reference to `__errno +' libintl.a(dcigettext.o):(.text+0x10b1): undefined reference to `__errn +o' libintl.a(dcigettext.o):(.text+0x113a): undefined reference to `__errn +o' libintl.a(dcigettext.o):(.text+0x1149): undefined reference to `getuid +' libintl.a(dcigettext.o):(.text+0x1150): undefined reference to `geteui +d' libintl.a(dcigettext.o):(.text+0x1315): undefined reference to `getgid +' libintl.a(dcigettext.o):(.text+0x131c): undefined reference to `getegi +d' libintl.a(localcharset.o):(.text+0xb): undefined reference to `nl_lang +info' libintl.a(localename.o):(.text+0x7): undefined reference to `uselocale +' libintl.a(localename.o):(.text+0x27): undefined reference to `uselocal +e' libintl.a(localename.o):(.text+0xca): undefined reference to `uselocal +e' libintl.a(setlocale.o):(.text+0x36b): undefined reference to `newlocal +e' libintl.a(setlocale.o):(.text+0x39b): undefined reference to `__errno' libintl.a(setlocale.o):(.text+0x3a5): undefined reference to `freeloca +le' libintl.a(setlocale.o):(.text+0x3aa): undefined reference to `__errno' libintl.a(setlocale.o):(.text+0x459): undefined reference to `newlocal +e' libintl.a(setlocale.o):(.text+0x55a): undefined reference to `newlocal +e' libintl.a(setlocale.o):(.text+0x346): undefined reference to `newlocal +e' libintl.a(loadmsgcat.o):(.text+0xb9): undefined reference to `mmap' libintl.a(loadmsgcat.o):(.text+0x2a7): undefined reference to `__errno +' libintl.a(loadmsgcat.o):(.text+0x45f): undefined reference to `munmap' libintl.a(loadmsgcat.o):(.text+0x9be): undefined reference to `munmap' libintl.a(localealias.o):(.text+0x9f): undefined reference to `__fsetl +ocking' libintl.a(localealias.o):(.text+0xbe): undefined reference to `fgets_u +nlocked' libintl.a(localealias.o):(.text+0xe5): undefined reference to `__local +e_ctype_ptr' libintl.a(localealias.o):(.text+0x11a): undefined reference to `__loca +le_ctype_ptr' libintl.a(localealias.o):(.text+0x134): undefined reference to `__loca +le_ctype_ptr' libintl.a(localealias.o):(.text+0x147): undefined reference to `__loca +le_ctype_ptr' libintl.a(localealias.o):(.text+0x17c): undefined reference to `__loca +le_ctype_ptr' libintl.a(localealias.o):(.text+0x2be): undefined reference to `fgets_ +unlocked' libintl.a(l10nflist.o):(.text+0x12b): undefined reference to `stpcpy' libintl.a(l10nflist.o):(.text+0x322): undefined reference to `argz_nex +t' libintl.a(l10nflist.o):(.text+0x40b): undefined reference to `stpcpy' libintl.a(l10nflist.o):(.text+0x424): undefined reference to `stpcpy' libintl.a(l10nflist.o):(.text+0x440): undefined reference to `stpcpy' libintl.a(l10nflist.o):(.text+0x460): undefined reference to `stpcpy' libintl.a(l10nflist.o):(.text+0x48d): undefined reference to `argz_str +ingify' libintl.a(l10nflist.o):(.text+0x4aa): undefined reference to `argz_cou +nt' libintl.a(l10nflist.o):(.text+0x55b): undefined reference to `__locale +_ctype_ptr' libintl.a(l10nflist.o):(.text+0x56a): undefined reference to `__locale +_ctype_ptr' libintl.a(l10nflist.o):(.text+0x5b5): undefined reference to `__locale +_ctype_ptr' libintl.a(l10nflist.o):(.text+0x5d1): undefined reference to `__locale +_ctype_ptr' libintl.a(l10nflist.o):(.text+0x5e3): undefined reference to `__locale +_ctype_ptr' libintl.a(plural-exp.o):(.text+0x5a): more undefined references to `__ +locale_ctype_ptr' follow collect2.exe: error: ld returned 1 exit status

        It seems another peace of code is missing (glibc maybe ? I'll have a look in MSY2 to see that)... But I still don't understand why the gcc -o test -lintl -I. test.c with libintl.a in the current directory doesn't work...

        ... and those undefined symbols should be defined by msvcrt ! And I neither can link with libintl.a on MSYS2.