in reply to Re: libintl.a for Strawberry Perl
in thread libintl.a for Strawberry Perl
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! :-(
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: libintl.a for Strawberry Perl
by VinsWorldcom (Prior) on Jan 24, 2019 at 21:30 UTC | |
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:
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
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 | [reply] [d/l] [select] |
by fdesar (Beadle) on Jan 25, 2019 at 10:46 UTC | |
| [reply] |
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:
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:
Here is the log of gmake in case it could help:
| [reply] [d/l] [select] |
by syphilis (Archbishop) on Jan 26, 2019 at 06:51 UTC | |
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: 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: 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 | [reply] [d/l] [select] |
by bliako (Abbot) on Jan 26, 2019 at 11:10 UTC | |
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 | [reply] [d/l] |
by fdesar (Beadle) on Jan 25, 2019 at 10:16 UTC | |
Many thanks! | [reply] |
|
Re^3: libintl.a for Strawberry Perl
by bliako (Abbot) on Jan 24, 2019 at 16:10 UTC | |
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 | [reply] [d/l] [select] |
by fdesar (Beadle) on Jan 24, 2019 at 18:18 UTC | |
I even tried:
with the same result. But when I try to link with the libintl.a itself, I get a very different result:
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... | [reply] [d/l] [select] |
by fdesar (Beadle) on Jan 24, 2019 at 19:28 UTC | |
| [reply] |
by bliako (Abbot) on Jan 24, 2019 at 20:54 UTC | |
What does that mean? Can you
| [reply] [d/l] |