public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Reuben Thomas <rrt1001@cam.ac.uk>
To: cygwin@sources.redhat.com
Subject: Linking problem
Date: Thu, 23 Nov 2000 04:20:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.21.0011231155400.28587-100000@localhost.localdomain> (raw)

I have a bunch of DLLs which I'm linking executables against (as it happens,
the libraries for the Glasgow Haskell Compiler (www.haskell.org/ghc/), of
which I'm a developer).

My problem is as follows: I have a hello-worldy sort of program. I have two
identical copies of the (Haskell) import libraries I want to link against,
in different directory structures. The strange thing is that though the
libraries are identical, and though the collect2 command-lines issued to
link the binaries are identical (up to directory names; the order is the
same), the resulting binaries have different cygcheck outputs:

[11:18:53 tests]$ cygcheck exc3.exe
Found: .\exc3.exe
.\exc3.exe
  C:\WINNT\System32\KERNEL32.dll
    C:\WINNT\System32\NTDLL.DLL
  C:\WINNT\System32\crtdll.dll
  C:\ghc\ghc-4.08.1\bin\HSlang.dll
    C:\ghc\ghc-4.08.1\bin\HSstd_cbits.dll
      C:\ghc\ghc-4.08.1\bin\HSrts.dll
        C:\ghc\ghc-4.08.1\bin\HSstd.dll
          C:\ghc\ghc-4.08.1\bin\gmp.dll
      C:\WINNT\System32\WSOCK32.DLL
        C:\WINNT\System32\WS2_32.DLL
          C:\WINNT\System32\MSVCRT.DLL
          C:\WINNT\System32\ADVAPI32.DLL
            C:\WINNT\System32\RPCRT4.DLL
          C:\WINNT\System32\WS2HELP.DLL
    C:\ghc\ghc-4.08.1\bin\HSlang_cbits.dll

Use -h to see help about each section
[11:58:27 tests]$ cygcheck except.exe
Found: .\except.exe
.\except.exe
  C:\ghc\ghc-4.08.1\bin\HSstd.dll
    C:\ghc\ghc-4.08.1\bin\gmp.dll
      C:\WINNT\System32\crtdll.dll
        C:\WINNT\System32\KERNEL32.dll
          C:\WINNT\System32\NTDLL.DLL
    C:\ghc\ghc-4.08.1\bin\HSrts.dll
    C:\ghc\ghc-4.08.1\bin\HSstd_cbits.dll
      C:\WINNT\System32\WSOCK32.DLL
        C:\WINNT\System32\WS2_32.DLL
          C:\WINNT\System32\MSVCRT.DLL
          C:\WINNT\System32\ADVAPI32.DLL
            C:\WINNT\System32\RPCRT4.DLL
          C:\WINNT\System32\WS2HELP.DLL
  C:\ghc\ghc-4.08.1\bin\HSlang.dll
    C:\ghc\ghc-4.08.1\bin\HSlang_cbits.dll

Use -h to see help about each section

(The DLLs starting with HS are the Haskell libraries.)

The first binary (exc3.exe) doesn't work, and crashes with the infamous

Application Error
The application failed to initialize properly (0xc0000005). Click on OK to
terminate the application

message in a Windows pop-up message box.

The second version (except.exe) runs correctly, producing "hi".

If I run exc3.exe in gdb (gdb --nw exc3.exe, then run) I get three SIGSEGVs,
before the error "Program exited with code 0200", then the rather bizarre
"You can't do that without a process to debug."

The only difference between the two sets of libraries used is the order in
which the directories holding them were created. If I create a third set of
directories in the same order as those used to link except.exe, and copy the
import libraries into them, everything works.

As far as I can discover, the error I'm getting means that the DLLs aren't
initialising properly. The Haskell library DLLs don't provide DllMain, so
they use the default Cygwin version.

Surely the order in which the directories holding the import libraries were
created shouldn't affect the binaries created by the linker?!

I'm using Cygwin 1.1.5 on Win2K SP1; the output of cygcheck -s follows:

Cygnus Win95/NT Configuration Diagnostics
Current System Time: Thu Nov 23 12:14:53 2000

WinNT Ver 5.0 build 2195 

Path:	/usr/bin
	/usr/local/bin
	/WINNT/system32
	/WINNT
	/WINNT/system32/WBEM
	/usr/bin
	/usr/local/bin
	/ghc/ghc-4.08.1/bin
	/happy/happy-1.8/bin
	/Program Files/Microsoft Visual Studio/Common/Tools/WinNT
	/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin
	/Program Files/Microsoft Visual Studio/Common/Tools
	/Program Files/Microsoft Visual Studio/VC98/bin
	/texmf/miktex/bin
	/gstools/gs5.03
	/gstools/gsview
	/jade

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

PWD = `/TEMP/tests'
CYGWIN32 = `tty'
MAKE_MODE = `unix'
HOME = `/Winnt/Profiles/v-reubth'

Use `-r' to scan registry

a:  fd           N/A    N/A                    
c:  hd  NTFS    3796Mb  84% CP CS UN PA FC     
d:  hd  NTFS     337Mb  61% CP CS UN PA FC     Local Disk
e:  cd           N/A    N/A                    
f:  fd           N/A    N/A                    

C:\bin  /usr/bin  user    textmode
C:\lib  /usr/lib  user    textmode
\\.\a:  /dev/fd0  user    textmode
C:    /        user    textmode

Found: C:\bin\bash.exe
Found: \bin\bash.exe
Found: C:\bin\cat.exe
Found: \bin\cat.exe
Found: C:\bin\cpp.exe
Found: \bin\cpp.exe
Found: C:\bin\find.exe
Found: \bin\find.exe
Found: C:\bin\gcc.exe
Found: \bin\gcc.exe
Found: C:\bin\gdb.exe
Found: \bin\gdb.exe
Found: C:\bin\ld.exe
Found: \bin\ld.exe
Found: C:\bin\ls.exe
Found: \bin\ls.exe
Found: C:\bin\make.exe
Found: \bin\make.exe
Found: C:\bin\sh.exe
Found: \bin\sh.exe

   18k 2000/10/23 C:\bin\cyggdbm.dll
   83k 2000/06/11 C:\bin\cygitcl30.dll
   35k 2000/06/11 C:\bin\cygitk30.dll
   45k 2000/10/22 C:\bin\cygjbig1.dll
  119k 2000/10/23 C:\bin\cygjpeg6b.dll
  162k 2000/10/23 C:\bin\cygpng2.dll
  402k 2000/06/11 C:\bin\cygtcl80.dll
    5k 2000/06/11 C:\bin\cygtclpip80.dll
   10k 2000/06/11 C:\bin\cygtclreg80.dll
  243k 2000/10/23 C:\bin\cygtiff3.dll
  639k 2000/06/11 C:\bin\cygtk80.dll
   49k 2000/10/23 C:\bin\cygz.dll
  609k 2000/11/11 C:\bin\cygwin1.dll
    Cygwin DLL version info:
        dll major: 1001
        dll minor: 5
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        dll malloc env: 28
        api major: 0
        api minor: 30
        shared data: 3
        dll identifier: cygwin1
        mount registry: 2
        cygnus registry name: Cygnus Solutions
        cygwin registry name: Cygwin
        program options name: Program Options
        cygwin mount registry name: mounts v2
        cygdrive flags: cygdrive flags
        cygdrive prefix: cygdrive prefix
        cygdrive default prefix: 
        build date: Sat Nov 11 01:49:33 EST 2000
        shared id: cygwin1S3

   18k 2000/10/23 \bin\cyggdbm.dll
   83k 2000/06/11 \bin\cygitcl30.dll
   35k 2000/06/11 \bin\cygitk30.dll
   45k 2000/10/22 \bin\cygjbig1.dll
  119k 2000/10/23 \bin\cygjpeg6b.dll
  162k 2000/10/23 \bin\cygpng2.dll
  402k 2000/06/11 \bin\cygtcl80.dll
    5k 2000/06/11 \bin\cygtclpip80.dll
   10k 2000/06/11 \bin\cygtclreg80.dll
  243k 2000/10/23 \bin\cygtiff3.dll
  639k 2000/06/11 \bin\cygtk80.dll
   49k 2000/10/23 \bin\cygz.dll
  609k 2000/11/11 \bin\cygwin1.dll
    Cygwin DLL version info:
        dll major: 1001
        dll minor: 5
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        dll malloc env: 28
        api major: 0
        api minor: 30
        shared data: 3
        dll identifier: cygwin1
        mount registry: 2
        cygnus registry name: Cygnus Solutions
        cygwin registry name: Cygwin
        program options name: Program Options
        cygwin mount registry name: mounts v2
        cygdrive flags: cygdrive flags
        cygdrive prefix: cygdrive prefix
        cygdrive default prefix: 
        build date: Sat Nov 11 01:49:33 EST 2000
        shared id: cygwin1S3


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

             reply	other threads:[~2000-11-23  4:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-23  4:20 Reuben Thomas [this message]
2000-11-24  5:25 ` Reuben Thomas
  -- strict thread matches above, loose matches on Subject: below --
2004-11-26  7:20 向阳 韩
2004-11-26 18:45 ` Larry Hall
2002-01-04  4:50 linking problem Guenther Sohler
2002-01-07  5:37 ` Pavel Tsekov
2001-08-24 15:10 Linking Problem Heribert Dahms
2001-08-23 22:06 Krishna, Buska (IE10)
2000-11-27  7:11 Linking problem Earnie Boyd
2000-11-26 17:53 Earnie Boyd
1998-09-18 22:21 linking problem Frankie Ramos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.21.0011231155400.28587-100000@localhost.localdomain \
    --to=rrt1001@cam.ac.uk \
    --cc=cygwin@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).