public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Building a vendor perl module with gcc under cygwin
@ 2011-05-18 13:38 Philip Kime
  2011-05-19 16:51 ` Reini Urban
  0 siblings, 1 reply; 2+ messages in thread
From: Philip Kime @ 2011-05-18 13:38 UTC (permalink / raw)
  To: cygwin

Greetings,
  I am having a hell of time trying to build a vendor-supplied perl
module under gcc in cygwin. I know it compiles with gcc under Linux
and Unix, as well as with VC under windows. I'm using cygwin 1.7.9 and
gcc 4.3.4. This is 64-bit windows.

The module creates a .dll which needs to link to one other vendor
supplied library for which I have the .dll and .lib import library.
I'm using the 32-bit version of the library I need.

I have managed to get as far as building the module .dll but when I
try to load it, I get (module is called "MOD" below):

Can't load 'blib/arch/auto/MOD/MOD.dll' for module MOD: Exec format
error at /usr/lib/perl5/5.10/i686-cygwin/DynaLoader.pm line 200.

When I look at the MOD.dll with ldd, I get:

        ntdll.dll => /cygdrive/c/Windows/SysWOW64/ntdll.dll (0x77c40000)
        kernel32.dll => /cygdrive/c/Windows/syswow64/kernel32.dll (0x76020000)
        KERNELBASE.dll => /cygdrive/c/Windows/syswow64/KERNELBASE.dll
(0x77420000)

        ??? => ??? (0x6e300000)

which doesn't look good. It's not clear to me which flags I need to
pass to gcc. I believe that I shouldn't use "-mdll" any more. I tried
"-shared" but this gives me undefined SSP symbols.

nm output for MOD.dll looks normal.

Any ideas appreciated.

-- 
Dr Philip Kime

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Building a vendor perl module with gcc under cygwin
  2011-05-18 13:38 Building a vendor perl module with gcc under cygwin Philip Kime
@ 2011-05-19 16:51 ` Reini Urban
  0 siblings, 0 replies; 2+ messages in thread
From: Reini Urban @ 2011-05-19 16:51 UTC (permalink / raw)
  To: Philip, cygwin

"Exec format error" is the returned error string from dlopen, which
tried to load your dll.
So it looks like either your cflags or ldflags are wrong, or the lib
you are linking against cannot be loaded by cygwin's perl.

Easiest would be to link both dll's statically, your MOD.dll and the
??? lib you are linking against. Maybe both libc versions are not
compatible. e.g. msvcrt and cygwin.
Or the PE header of the 3rd dll is not matching, 64bit maybe.
-- 
Reini Urban
http://phpwiki.org/           http://murbreak.at/

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-19 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-18 13:38 Building a vendor perl module with gcc under cygwin Philip Kime
2011-05-19 16:51 ` Reini Urban

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).