Re: ld: fatal error - cmalloc would have returned NULL

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: ld: fatal error - cmalloc would have returned NULL

Rainer Emrich-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Any news on this issue?

At the moment it's impossible to build libgcj during bootstrap of gcc!

I tried 1.7.7-1 and the snapshot 20110227.

Here some diagnostic:

$ /SCRATCH/tmp.ALIlKIg0qU/gcc-4.5.0-1/gcc-4.5.0-1/./gcc/xgcc -shared-libgcc
- -B/SCRATCH/tmp.ALIlKIg0qU/gcc-4.5.0-1/gcc-4.5.0-1/./gcc -nostdinc++
-
-L/SCRATCH/tmp.ALIlKIg0qU/gcc-4.5.0-1/gcc-4.5.0-1/i686-pc-cygwin/libstdc++-v3/src -L/SCRATCH/tmp.ALIlKIg0qU/gcc-4.5.0-1/gcc-4.5.0-1/i686-pc-cygwin/libstdc++-v3/src/.libs
-
-B/opt/devel/gnu/gcc/CYGWIN_NT-5.2-WOW64/i686-pc-cygwin/cygwin-1.7.7-1/gcc-4.5.0-1/i686-pc-cygwin/bin/
-
-B/opt/devel/gnu/gcc/CYGWIN_NT-5.2-WOW64/i686-pc-cygwin/cygwin-1.7.7-1/gcc-4.5.0-1/i686-pc-cygwin/lib/
- -isystem
/opt/devel/gnu/gcc/CYGWIN_NT-5.2-WOW64/i686-pc-cygwin/cygwin-1.7.7-1/gcc-4.5.0-1/i686-pc-cygwin/include
- -isystem
/opt/devel/gnu/gcc/CYGWIN_NT-5.2-WOW64/i686-pc-cygwin/cygwin-1.7.7-1/gcc-4.5.0-1/i686-pc-cygwin/sys-include
   -shared -nostdlib
/SCRATCH/tmp.ALIlKIg0qU/gcc-4.5.0-1/gcc-4.5.0-1/./gcc/crtbegin.o
.libs/libgcj.la.lnkscript -Wl,--whole-archive ./libltdl/.libs/libltdlc.a
classpath/native/fdlibm/.libs/libfdlibm.a ../libffi/.libs/libffi_convenience.a
../zlib/.libs/libzgcj_convenience.a ../boehm-gc/.libs/libgcjgc_convenience.a
- -Wl,--no-whole-archive
-
-L/SCRATCH/tmp.ALIlKIg0qU/gcc-4.5.0-1/gcc-4.5.0-1/i686-pc-cygwin/libstdc++-v3/src -L/SCRATCH/tmp.ALIlKIg0qU/gcc-4.5.0-1/gcc-4.5.0-1/i686-pc-cygwin/libstdc++-v3/src/.libs
- -L/SCRATCH/tmp.ALIlKIg0qU/gcc-4.5.0-1/gcc-4.5.0-1/i686-pc-cygwin/libjava
/usr/lib/libiconv.dll.a -lrt -ldl
- -L/SCRATCH/tmp.ALIlKIg0qU/gcc-4.5.0-1/gcc-4.5.0-1/./gcc
-
-L/opt/devel/gnu/gcc/CYGWIN_NT-5.2-WOW64/i686-pc-cygwin/cygwin-1.7.7-1/gcc-4.5.0-1/i686-pc-cygwin/bin
-
-L/opt/devel/gnu/gcc/CYGWIN_NT-5.2-WOW64/i686-pc-cygwin/cygwin-1.7.7-1/gcc-4.5.0-1/i686-pc-cygwin/lib
- -lgcc_s -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc_s -lgcc
/SCRATCH/tmp.ALIlKIg0qU/gcc-4.5.0-1/gcc-4.5.0-1/./gcc/crtend.o
-
-Wl,--version-script=/opt/devel/gnu/src/gcc-cygwin/gcc-4.5.0-1/libjava/libgcj.ver -Wl,-u
- -Wl,__ZN3org4ietf4jgss10GSSManagerC1Ev -Wl,-L.. -Wl,-lgcj-noncore-dummy
- -Wl,-Bsymbolic-functions   -o .libs/cyggcj-11.dll -Wl,--enable-auto-image-base
- -Xlinker --out-implib -Xlinker .libs/libgcj.dll.a
collect2: ld terminated with signal 1 [Hangup]


A strace for ld is really huge, here the last few lines:

 4115 117491814 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd
- -1, off 0
  292 117492106 [main] ld 5884 mmap64: 0x60100000 = mmap()
 4006 117496112 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd
- -1, off 0
  290 117496402 [main] ld 5884 mmap64: 0x600F0000 = mmap()
 3530 117499932 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd
- -1, off 0
  288 117500220 [main] ld 5884 mmap64: 0x600E0000 = mmap()
 4283 117504503 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd
- -1, off 0
  306 117504809 [main] ld 5884 mmap64: 0x600D0000 = mmap()
 4296 117509105 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd
- -1, off 0
  290 117509395 [main] ld 5884 mmap64: 0x600C0000 = mmap()
 3883 117513278 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd
- -1, off 0
  416 117513694 [main] ld 5884 mmap64: 0x600B0000 = mmap()
 4503 117518197 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd
- -1, off 0
  490 117518687 [main] ld 5884 seterrno_from_win_error:
/ext/build/netrel/src/cygwin-snapshot-20110227-1/winsup/cygwin/cygheap.cc:145
windows error 487
   41 117518728 [main] ld 5884 geterrno_from_win_error: windows error 487 ==
errno 22
   42 117518770 [main] ld 5884 __set_errno: void* creturn(cygheap_types,
cygheap_entry*, unsigned int, const char*):265 val 12
   45 117518815 [main] ld 5884 mmap64: 0xFFFFFFFF = mmap()
   40 117518855 [main] ld 5884 __set_errno: void* sbrk(int):167 val 12
   36 117518891 [main] ld 5884 __set_errno: void __set_ENOMEM():304 val 12
- --- Process 5884, exception C0000005 at 0042903A
  312 117519203 [main] ld 5884 exception::handle: In cygwin_except_handler exc
0xC0000005 at 0x42903A sp 0x119C360
   36 117519239 [main] ld 5884 exception::handle: In cygwin_except_handler sig
11 at 0x42903A
   33 117519272 [main] ld 5884 exception::handle: In cygwin_except_handler
calling 0x0
117519314 [main] ld 5884 exception::handle: Exception: STATUS_ACCESS_VIOLATION
   42 117519314 [main] ld 5884 exception::handle: Exception: STATUS_ACCESS_VIOLATION
  636 117519950 [main] ld 5884 try_to_debug: debugger_command ''
117520189 [main] ld 5884 open_stackdumpfile: Dumping stack trace to ld.exe.stackdump
  239 117520189 [main] ld 5884 open_stackdumpfile: Dumping stack trace to
ld.exe.stackdump
14841 117535030 [main] ld 5884 _cygtls::inside_kernel: pc 0x42903A, h 0x400000,
inside_kernel 0
   53 117535083 [main] ld 5884 normalize_posix_path: src /dev/kmsg
   37 117535120 [main] ld 5884 normalize_posix_path: /dev/kmsg =
normalize_posix_path (/dev/kmsg)
   47 117535167 [main] ld 5884 mount_info::conv_to_win32_path:
conv_to_win32_path (/dev/kmsg)
   40 117535207 [main] ld 5884 mount_info::conv_to_win32_path: src_path
/dev/kmsg, dst \Device\MailSlot\cygwin\dev\kmsg, flags 0x2, rc 0
   50 117535257 [main] ld 5884 build_fh_pc: fh 0x61247A9C
  106 117535363 [main] ld 5884 seterrno_from_win_error:
/ext/build/netrel/src/cygwin-snapshot-20110227-1/winsup/cygwin/cygheap.cc:145
windows error 487
   38 117535401 [main] ld 5884 geterrno_from_win_error: windows error 487 ==
errno 22
  142 117535543 [main] ld 5884
D:\cygwin\opt\devel\gnu\gcc\CYGWIN_NT-5.2-WOW64\i686-pc-cygwin\cygwin-1.7.7-1\gcc-4.5.0-1\bin\ld.exe:
*** fatal error - cmalloc would have returned NULL
30191 117565734 [main] ld 5884 sigproc_terminate: entering
   47 117565781 [main] ld 5884 sig_send: sendsig 0x314, pid 5884, signal -42,
its_me 1
   55 117565836 [main] ld 5884 sig_send: Not waiting for sigcomplete.  its_me 1
signal -42
   63 117565899 [main] ld 5884 sig_send: returning 0x0 from sending signal -42
    0 117565899 [sig] ld 5884 wait_sig: saw __SIGEXIT
   45 117565944 [main] ld 5884 proc_terminate: nprocs 0
   99 117566043 [main] ld 5884 proc_terminate: leaving
   45 117566088 [sig] ld 5884 wait_sig: signal thread exiting
   61 117566149 [main] ld 5884 __to_clock_t: dwHighDateTime 0, dwLowDateTime
492187500
   52 117566201 [main] ld 5884 __to_clock_t: total 00000000 0000C042
   36 117566237 [main] ld 5884 __to_clock_t: dwHighDateTime 0, dwLowDateTime
602343750
   50 117566287 [main] ld 5884 __to_clock_t: total 00000000 0000EB4A
   96 117566383 [main] ld 5884 pinfo::exit: Calling ExitProcess n 0x1, exitcode
0x100


There are a lot of mmap64 calls, the memory consumption at fault is about 900
MBytes.

Any Idea, Christopher, Yaakov?

Rainer

P.S.: I have the complete strace if that helps
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1tLEEACgkQoUhjsh59BL7I3ACfTRxFPwXEtFlwzKh0yxtWGgzQ
GXEAoMMY6Wp772m1nFv3n5luNWSNpFpJ
=/frj
-----END PGP SIGNATURE-----

--
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

Reply | Threaded
Open this post in threaded view
|

Re: ld: fatal error - cmalloc would have returned NULL

Corinna Vinschen-2
On Mar  1 18:26, Rainer Emrich wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Any news on this issue?
>
> At the moment it's impossible to build libgcj during bootstrap of gcc!
>
> I tried 1.7.7-1 and the snapshot 20110227.
>
> Here some diagnostic:
>
>   288 117500220 [main] ld 5884 mmap64: 0x600E0000 = mmap()
>  4283 117504503 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd
> - -1, off 0
>   306 117504809 [main] ld 5884 mmap64: 0x600D0000 = mmap()
>  4296 117509105 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd
> - -1, off 0
>   290 117509395 [main] ld 5884 mmap64: 0x600C0000 = mmap()
>  3883 117513278 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd
> - -1, off 0
>   416 117513694 [main] ld 5884 mmap64: 0x600B0000 = mmap()
>  4503 117518197 [main] ld 5884 mmap64: addr 0, len 65536, prot 3, flags 22, fd
> - -1, off 0

This looks like a problem in ld.  It uses mmap a lot.  In fact it uses
mmap so much that the memory allocation (which goes from top to bottom
addresses) reaches the end of the Cygwin DLL itself and beyond that.
And it doesn't mmap in a few big chunks, but rather in many small
chunks.

>   490 117518687 [main] ld 5884 seterrno_from_win_error:
> /ext/build/netrel/src/cygwin-snapshot-20110227-1/winsup/cygwin/cygheap.cc:145
> windows error 487
>    41 117518728 [main] ld 5884 geterrno_from_win_error: windows error 487 ==
> errno 22
>    42 117518770 [main] ld 5884 __set_errno: void* creturn(cygheap_types,
> cygheap_entry*, unsigned int, const char*):265 val 12

Every mmap call needs space on the cygheap, which is a special heap to
keep inforamtion for later fork or exec calls.  The cygheap resides at
the end of the Cygwin DLL.  If it's space is insufficient, the Cygwin
DLL tries to extend it.  But it can't, because the memory slot is already
taken by one of the many mmap calls.

>    45 117518815 [main] ld 5884 mmap64: 0xFFFFFFFF = mmap()
>    40 117518855 [main] ld 5884 __set_errno: void* sbrk(int):167 val 12
>    36 117518891 [main] ld 5884 __set_errno: void __set_ENOMEM():304 val 12

Therefore, the last mmap call fails and returns MAP_FAILED with errno
set to ENOMEM.

> - --- Process 5884, exception C0000005 at 0042903A

And then ld crashes, because, apparently, it neglects to check the
return value of mmap.


Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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

Reply | Threaded
Open this post in threaded view
|

Re: ld: fatal error - cmalloc would have returned NULL

Rainer Emrich-2
In reply to this post by Rainer Emrich-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Corinna,

I'm not so sure if that's a ld problem, see the following thread:

http://sourceware.org/ml/cygwin/2010-12/msg00448.html

I haven't tried 1.7.6, but as Yaakov mentions there is a change in behaviour in
August last year.

Rainer

P.S.: please CC me, because I'm not on the list
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1tM3UACgkQoUhjsh59BL5AHwCeJk7W0/vc+WM8PfzZ+lXQqbMS
3GAAnjQSDdpvjBm/W0n6dtPxB6/aJEtV
=S9LO
-----END PGP SIGNATURE-----

--
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

Reply | Threaded
Open this post in threaded view
|

Re: ld: fatal error - cmalloc would have returned NULL

Corinna Vinschen-2
On Mar  1 18:57, Rainer Emrich wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Corinna,
>
> I'm not so sure if that's a ld problem, see the following thread:
>
> http://sourceware.org/ml/cygwin/2010-12/msg00448.html
>
> I haven't tried 1.7.6, but as Yaakov mentions there is a change in behaviour in
> August last year.

I only commented on what happens according to the strace.  Nobody
affected by this behaviour really tried to debug this problem,
apparently.


Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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