Subject: Cygwin DLL init error
From: Doru Carastan <[email-masked]>
To: [email-masked]
Date: Mon, 23 Jun 2003 14:31:41 -0700

Hello,

Maybe I am missing something here but I am getting consistent errors 
when I try to run apps linked against a cygwin1.dll built from sources. 
I have tried with source from cvs, cygwin-1.3.22-1-src.tar.bz2 and 
cygwin-snapshot-20030617-1 without success.

The build commands I used are:

mkdir ~/src
cd ~/src
wget -q http://cygwin.com/snapshots/cygwin-src-20030617.tar.bz2
tar -jxf ~/src/cygwin-src-20030617.tar.bz2
mkdir ~/BUILD
cd ~/BUILD
~/src/cygwin-snapshot-20030617-1/configure --enable-debugging
make
make install prefix=/install.dbg

I then kill all Cygwin processes, open a DOS shell in the DOS equivalent 
of /install/dbg/bin and run mount expecting to see the current mount 
table. This generates the message:

"The aplication failed to initialize properly (0xc0000022). Click on OK 
to terminate the application."

The same message is displayed when running 'strace mount.exe'.
I have read the how-to-debug-cygwin but couldn't find any reference 
about debugging the early DLL initialization phase.

---------
(gdb)
(gdb) exec mount.exe
(gdb) dll cygmv.dll
(gdb) l dll_entry
15
16      int NO_COPY dynamically_loaded;
17
18      extern "C" int
19      WINAPI dll_entry (HANDLE h, DWORD reason, void *static_load)
20      {
21        switch (reason)
22          {
23          case DLL_PROCESS_ATTACH:
24            cygwin_hmodule = (HMODULE) h;
(gdb) b 21
Breakpoint 1 at 0x61042769: file /src/cygwin/winsup/cygwin/init.cc, line 21.
(gdb) r
Starting program: /install.dbg/bin/mount.exe
Program received signal SIGSEGV, Segmentation fault.
Program received signal SIGSEGV, Segmentation fault.
Program exited with code 0200.
You can't do that without a process to debug.
(gdb)
----------

The cygwin1.dll built from sources is clearly faulty. 'cp 
/install.dbg/cygwin1.dll /bin/cygwin1.dll' allows running mount and the 
other tools without a glitch. The same goes when starting 
/install/dbg/bin/mount from a BASH shell. Being already loaded by bash, 
the good /bin/cygwin1.dll DLL is used and mount works fine.

Please let me know if you see the problem.

Thank you,
Doru Carastan
WinHost Engineer
MontaVista Linux

Cygwin Win95/NT Configuration Diagnostics
Current System Time: Mon Jun 23 13:49:15 2003

Windows XP Professional Ver 5.1 Build 2600 Service Pack 1

Path:	C:\cygwin\usr\local\bin
	C:\cygwin\bin
	C:\cygwin\bin
	c:\WINDOWS\system32
	c:\WINDOWS
	c:\WINDOWS\System32\Wbem
	c:\Program Files\tools
	"C
	C:\cygwin\Program Files\MAKEMSI\"
	h:\uh\bin

C:\cygwin\bin\id.exe output (nontsec)
UID: 11629(dcarastan)  GID: 10513(mvista)
544(Administrators)    545(Users)
10513(mvista)

C:\cygwin\bin\id.exe output (ntsec)
UID: 11629(dcarastan)  GID: 10513(mvista)
544(Administrators)    545(Users)
10513(mvista)

SysDir: C:\WINDOWS\System32
WinDir: C:\WINDOWS

CYGWIN = `codepage:oem'
HOME = `h:\uh'
MAKE_MODE = `unix'
PWD = `/src/BUILD'
USER = `dcarastan'

Use `-r' to scan registry

a:  fd           N/A    N/A                    
c:  hd  NTFS   38162Mb  33% CP CS UN PA FC     DRIVE
d:  cd           N/A    N/A                    
h:  net NTFS   34469Mb  96% CP CS    PA        dcarastan

C:\cygwin      /          system  binmode
C:\cygwin/bin  /usr/bin   system  binmode
C:\cygwin/lib  /usr/lib   system  binmode
.              /cygdrive  system  binmode,cygdrive

Found: C:\cygwin\bin\awk.exe
Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cp.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: C:\cygwin\bin\gcc.exe
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\grep.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: C:\cygwin\bin\mv.exe
Found: C:\cygwin\bin\rm.exe
Found: C:\cygwin\bin\sed.exe
Found: C:\cygwin\bin\sh.exe
Found: C:\cygwin\bin\tar.exe

   58k 2002/05/07 C:\cygwin\bin\cygbz2-1.dll
   13k 2003/06/18 C:\cygwin\bin\cygcharset-1.dll
  848k 2003/04/11 C:\cygwin\bin\cygcrypto-0.9.7.dll
  645k 2003/04/11 C:\cygwin\bin\cygcrypto.dll
  551k 2003/04/02 C:\cygwin\bin\cygcurl-2.dll
  380k 2002/07/24 C:\cygwin\bin\cygdb-3.1.dll
  487k 2002/07/24 C:\cygwin\bin\cygdb_cxx-3.1.dll
   45k 2001/04/25 C:\cygwin\bin\cygform5.dll
   35k 2002/01/09 C:\cygwin\bin\cygform6.dll
   76k 2003/03/09 C:\cygwin\bin\cygform7.dll
   28k 2003/03/22 C:\cygwin\bin\cyggdbm-3.dll
   19k 2003/03/22 C:\cygwin\bin\cyggdbm.dll
   15k 2003/03/22 C:\cygwin\bin\cyggdbm_compat-3.dll
  490k 2002/09/21 C:\cygwin\bin\cygguile-12.dll
   63k 2002/09/21 C:\cygwin\bin\cygguile-srfi-srfi-13-14-v-1-1.dll
   24k 2002/09/21 C:\cygwin\bin\cygguile-srfi-srfi-4-v-1-1.dll
   14k 2002/09/21 C:\cygwin\bin\cygguilereadline-v-12-12.dll
   17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll
   20k 2002/10/10 C:\cygwin\bin\cyghistory5.dll
  945k 2003/06/18 C:\cygwin\bin\cygiconv-2.dll
   22k 2001/12/13 C:\cygwin\bin\cygintl-1.dll
   28k 2002/09/20 C:\cygwin\bin\cygintl-2.dll
   21k 2001/06/20 C:\cygwin\bin\cygintl.dll
   61k 2003/03/05 C:\cygwin\bin\cygkpathsea-3.dll
   32k 2003/04/16 C:\cygwin\bin\cygltdl-3.dll
   26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll
   20k 2002/01/09 C:\cygwin\bin\cygmenu6.dll
   48k 2003/03/09 C:\cygwin\bin\cygmenu7.dll
  156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll
  175k 2002/01/09 C:\cygwin\bin\cygncurses++6.dll
  226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll
  202k 2002/01/09 C:\cygwin\bin\cygncurses6.dll
  284k 2003/03/09 C:\cygwin\bin\cygncurses7.dll
   15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll
   12k 2002/01/09 C:\cygwin\bin\cygpanel6.dll
   31k 2003/03/09 C:\cygwin\bin\cygpanel7.dll
   66k 2003/06/17 C:\cygwin\bin\cygpcre-0.dll
   63k 2003/04/11 C:\cygwin\bin\cygpcre.dll
   15k 2003/06/17 C:\cygwin\bin\cygpcreposix-0.dll
   61k 2003/04/11 C:\cygwin\bin\cygpcreposix.dll
 1069k 2003/06/02 C:\cygwin\bin\cygperl5_8_0.dll
  173k 2003/02/23 C:\cygwin\bin\cygpng12.dll
   22k 2002/06/09 C:\cygwin\bin\cygpopt-0.dll
  108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll
  127k 2002/10/10 C:\cygwin\bin\cygreadline5.dll
   66k 2001/11/20 C:\cygwin\bin\cygregex.dll
  176k 2003/04/11 C:\cygwin\bin\cygssl-0.9.7.dll
  165k 2003/04/11 C:\cygwin\bin\cygssl.dll
  601k 2003/05/19 C:\cygwin\bin\cygwin-ruby16.dll
   50k 2002/03/12 C:\cygwin\bin\cygz.dll
  948k 2003/03/18 C:\cygwin\bin\cygwin1.dll
    Cygwin DLL version info:
        DLL version: 1.3.22
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 78
        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: Tue Mar 18 09:20:11 EST 2003
        CVS tag: dontuse-21
        Shared id: cygwin1S3

Cygwin Package Information
Package              Version
_update-info-dir     00170-1
agetty               2.1-1
ash                  20020731-1
autoconf             2.54-1
autoconf-devel       2.57-1
autoconf-stable      2.13-4
automake             1.7.1-1
automake-devel       1.7.5-1
automake-stable      1.4p5-5
base-files           1.3-1
base-passwd          1.1-1
bash                 2.05b-9
binutils             20030307-1
bison                20030307-1
byacc                1.9-1
bzip2                1.0.2-2
ccache               1.9-1
chkconfig            1.2.24h-1
clear                1.0-1
cmake                1.6.7-1
cpio                 2.5-1
crypt                1.0-1
ctags                5.5-4
curl                 7.10.4-1
cvs                  1.11.5-1
cygrunsrv            0.96-1
cygutils             1.1.4-2
cygwin               1.3.22-1
cygwin-doc           1.3-4
dejagnu              20021217-2
diff                 1.0-1
diffutils            2.8.1-1
doxygen              1.2.18-1
expect               20030128-1
file                 4.02-1
fileutils            4.1-1
findutils            4.1.7-4
flex                 2.5.4-2
gawk                 3.1.2-3
gcc                  3.2-3
gcc-mingw            20020817-5
gdb                  20030303-1
gdbm                 1.8.3-1
gettext              0.11.5-1
grep                 2.5-1
groff                1.18.1-2
guile                1.6.0-1
gzip                 1.3.3-4
indent               2.2.8-1
inetutils            1.3.2-22
initscripts          0.9-1
keychain             1.9-1
less                 378-1
libbz2_1             1.0.2-2
libcharset1          1.8-3
libdb3.1             3.1.17-2
libgdbm              1.8.0-5
libgdbm-devel        1.8.3-1
libgdbm3             1.8.3-1
libguile12           1.6.0-1
libiconv             1.8-3
libiconv2            1.8-3
libintl              0.10.38-3
libintl1             0.10.40-1
libintl2             0.11.5-1
libkpathsea3         2.0.2-1
libltdl3             1.5-1
libncurses5          5.2-1
libncurses6          5.2-8
libncurses7          5.3-1
libpcre              4.1-1
libpcre0             4.3-1
libpng12             1.2.5-1
libpopt0             1.6.4-4
libreadline4         4.1-2
libreadline5         4.3-2
libtool              20020705-1
libtool-devel        1.5-1
libtool-stable       1.4.3-1
login                1.9-5
m4                   1.4-1
make                 3.80-1
man                  1.5j-2
mc                   4.6.0-4
mingw-runtime        3.0-1
mktemp               1.4-1
nasm                 0.98.36-1
ncurses              5.3-1
netcat               1.10-1
newlib-man           20020801
openssh              3.6.1p1-2
openssl              0.9.7b-1
openssl096           0.9.6j-1
par                  1.52-1
patch                2.5.8-3
pcre-doc             4.3-1
perl                 5.8.0-3
perl_manpages        5.8.0-3
pkgconfig            0.15.0-1
popt                 1.6.4-4
python               2.2.3-1
rcs                  5.7-3
readline             4.3-2
rebase               2.2-2
regex                4.4-2
rpm                  4.1-1
rpm-build            4.1-1
rpm-doc              4.1-1
rsync                2.5.6-1
ruby                 1.6.8-2
rxvt                 2.7.10-3
sed                  4.0.7-1
sh-utils             2.0.15-3
sharutils            4.2.1-2
shutdown             1.3-1
splint               3.1.1-1
sysvinit             2.84-3
tar                  1.13.25-1
tcltk                20030214-1
termcap              20020930-1
terminfo             5.3-2
texinfo              4.2-4
textutils            2.0.21-1
tidy                 030201-1
time                 1.7-1
ucl                  1.01-1
units                1.77-1
unzip                5.50-2
upx                  1.24-1
w32api               2.3-1
wget                 1.8.2-2
which                1.5-1
whois                4.6.2-1
zip                  2.3-2
zlib                 1.1.4-1

Use -h to see help about each section

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