Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: libintl.a for Strawberry Perl

by VinsWorldcom (Prior)
on Jan 24, 2019 at 21:30 UTC ( [id://1228947]=note: print w/replies, xml ) Need Help??


in reply to Re^2: libintl.a for Strawberry Perl
in thread libintl.a for Strawberry Perl

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

Replies are listed 'Best First'.
Re^4: libintl.a for Strawberry Perl
by fdesar (Beadle) on Jan 25, 2019 at 10:46 UTC
    I confirm: it works for me too: many, many thanks!
Re^4: libintl.a for Strawberry Perl
by fdesar (Beadle) on Jan 25, 2019 at 10:16 UTC
    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!

Re^4: libintl.a for Strawberry Perl
by fdesar (Beadle) on Jan 25, 2019 at 16:11 UTC

    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^
      If I ldd gettext.xs.dll, I find it has some unknown unresolved references

      I don't understand the ldd output, but yours looks pretty normal compared to other 64-bit strawberry xs.dlls that are not troublesome. For example, for lib/auto/Win32/Win32.xs.dll, I'm seeing:
      $ ldd.exe lib/auto/Win32/Win32.xs.dll ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x76db0000) kernel32.dll => /c/Windows/system32/kernel32.dll (0x76c90000) KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7fefc9 +d0000) ??? => ??? (0x64cc0000)
      What's the error message you're seeing when gettext.xs.dll fails to load ? (It's likely not very helpful ... but worth a try.)
      Are there any pop-ups associated with the failure ? If so, what message so they provide ?

      When I want to build an import library from a dll, I start with gendef.exe (which ships with strawberry) and use it to create a def file:
      gendef -a mydll.dll then, using the generated mydll.def: dlltool --kill-at --input-def mydll.def --output-lib libmydll.a
      I don't know if that is what you need, or if it will provide better mileage than VinsWorldcom's method using pexports.

      If you're using MSYS2 dlls, you'll want the ones that are in the mingw64\bin - and then you might as well just use the associated import lib (.dll.a) in the mingw64\lib folder.
      The mingw64\lib folder also probably provides static (.a) libs if you want to avoid the dll dependency.

      Cheers,
      Rob

      My impression is that both perl and XS module should be compiled with the same compiler (useful discussion here: How to make an XS module with a different C compiler?). Ot at least it removes an uncertainty with your troubleshooting.

      To see what compiler my perl is compiled with I do: perl -MConfig -e 'print $Config{cc}' (likewise print the Config hash to see cppflags and ldflags).

      bw, bliako

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1228947]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found