This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Linking problem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]