Subject: Hello world problem
From: [email-masked] (John Canny)

10 Nov 1996 16:16:02 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Original-To: [email-masked]
Original-CC: [email-masked]
In-reply-to: <[email-masked]> (message from Mumit
	Khan on Sun, 10 Nov 1996 01: 56:04 -0600)
Comments: Hyperbole mail buttons accepted, v3.16.
Original-Sender: [email-masked]

Yep, 
    I had that problem. There is a similar posting from somebody who
cant get hello world to work about once a week, and plenty of others
in the archive. Usually it happens in native compiles, but its a
problem with a Cygwin library. I assume you didnt recompile those.

In my case, the problem was in libstdc++. The Cygwin home page notes
that libstdc++ appears to be completely broken in B16, and that it can
be fixed by replacing it with the B14 version. I tried that, and it
took care of the access violation.

I dont know why the Cygnus guys distribute the buggy libstdc++ in
B16. I guess it must work in some environments. 

Reading the archives it looks to me like dozens of people get 
caught by this bug. Its hard to figure out, because its not obvious
why "Hello world" should need libstdc++. But its used somewhere in
the iostream library, so if you use iostream, you'll get nailed.

-John

   Date: Sun, 10 Nov 1996 01:56:04 -0600
   From: Mumit Khan <[email-masked]>
   Sender: [email-masked]
   Precedence: bulk

   Configuration:
       host: i486-linux (stock RedHat 4.0)
       target: i486-cygwin32

   I successfully built a cross-compiler on my RedHat 4.0 linux, and
   proceeded to build the examples and try them on a Win'95 (OEM, no
   patches), and even a simple "Hello World!" dies at startup. eg.,
   the example program "stu", provided in B16, gives me this:

   ======================================
   bash$ stu
   (stu.exe 1039) In cygwin_except_handler
   (stu.exe 1039) Exception trapped!
   (stu.exe 1039) exception C0000005 at A80000B6
   (stu.exe 1039) exception: ax A80000B6 bx 0 cx 1000647C dx 2A74
   (stu.exe 1039) exception: si 0 di 402090 bp 63F654 sp 63F63C
   (stu.exe 1039) exception is: STATUS_ACCESS_VIOLATION
   (stu.exe 1039) Stack trace:
   (stu.exe 1039) frame 0: sp = 0x63F454, pc = 0x10002C81
   (stu.exe 1039) frame 1: sp = 0x63F470, pc = 0xBFF7663C
   (stu.exe 1039) frame 2: sp = 0x63F494, pc = 0xBFF859D9
   (stu.exe 1039) frame 3: sp = 0x63F52C, pc = 0xFFECBAD7
   (stu.exe 1039) frame 4: sp = 0x63F654, pc = 0x10013764
   (stu.exe 1039) frame 5: sp = 0x63F664, pc = 0x100020E9
   (stu.exe 1039) frame 6: sp = 0x63F670, pc = 0x100192C1
   (stu.exe 1039) frame 7: sp = 0x63F688, pc = 0x10001FCA
   (stu.exe 1039) frame 8: sp = 0x63FE14, pc = 0x10001FDC
   (stu.exe 1039) frame 9: sp = 0x63FE20, pc = 0x401408
   (stu.exe 1039) frame 10: sp = 0x63FE30, pc = 0x401012
   (stu.exe 1039) frame 11: sp = 0x63FE38, pc = 0xBFF88F75
   (stu.exe 1039) frame 12: sp = 0x63FF78, pc = 0xBFF88E23
   (stu.exe 1039) frame 13: sp = 0x63FFF4, pc = 0xBFF8783F
   (stu.exe 1039) frame 14: sp = 0x815FA784, pc = 0x5
   (stu.exe 1039) In cygwin_except_handler
   (stu.exe 1039) Error while dumping state (probably corrupted stack)
   (stu.exe 1039) In cygwin_except_handler
   (stu.exe 1039) Error while dumping state (probably corrupted stack)
   ======================================

   Figured something wrong with my cross-compilation, so pulled the 
   one-five.zip from Cygnus site and tried to run the C compiler from itt
   and here's what I get:

   ======================================
   bash$ c++ -fno-handle-exception -fno-rtti -g -Wall -v test.cc
   gcc -fno-handle-exception -fno-rtti -c -v test.cc
   Reading specs from
   /usr/local/lib/gcc-lib/i386-cygwin32/cygnus-2.7.2-960712/spec
   s
   gcc version cygnus-2.7.2-960712
   /usr/local/lib/gcc-lib/i386-cygwin32/cygnus-2.7.2-960712/cpp.exe
   -lang-c++ -v -
   iprefix
   /usr/local/lib/gcc-lib/i386-cygwin32/cygnus-2.7.2-960712/i386-cygwin32/c
   ygnus-2.7.2-960712/ -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
   -D__GNUC_MINO
   R__=7 -Di386 -D_WIN32 -DPOSIX -D__CYGWIN32__ -DWINNT -D_X86_=1
   -D__STDC__=1 -D__
   stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__))
   -D__i3
   86__ -D_WIN32 -D__POSIX__ -D__CYGWIN32__ -D__WINNT__ -D_X86_=1
   -D__STDC__=1 -D__
   stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__))
   -D__i3
   86 -D__POSIX -D__WINNT -Asystem(winnt) -Acpu(i386) -Amachine(i386) test.cc
   C:\WINDOWS\TEMP/cc001043.ii
   (d:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-960712\cpp.exe
   1044) In cygwin_except_handler
   (d:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-960712\cpp.exe
   1044) Exception trapped!
   (d:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-960712\cpp.exe
   1044) exception C0000005 at B8E58955
   (d:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-960712\cpp.exe
   1044) exception: ax B8E58955 bx FFFFFFFF cx 100069BC dx 826F6C5D
   (d:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-960712\cpp.exe

   [a few lines deleted here ... ]

   (d:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-960712\cpp.exe
   1044) End of stack trace (more stack frames may be present)
   (d:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-960712\cpp.exe
   1044) In cygwin_except_handler
   (d:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-960712\cpp.exe
   1044) Error while dumping state (probably corrupted stack)
   ======================================

   Any ideas?

   regards,
   Mumit -- [email-masked]
   http://www.xraylith.wisc.edu/~khan/
   -
   For help on using this list, send a message to
   "[email-masked]" with one line of text: "help".
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".