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

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CTs or Cygwins 'fault': fork: can't reserve memory for stack...


Martin Egholm Nielsen wrote:

I'm trying to link a huge bunch of crosscompiled .o files into a main-file. However, I (suddenly) get the following fault message from collect2.exe:

C:\cygwin\opt\crosstool\powerpc-405-linux-gnu\gcc-3.4.0-glibc-2.2.5\libexec\gcc\powerpc-405-linux-gnu\3.4.0\collect2.exe (1740): *** fork: can't reserve memory for stack 0x40000 - 0x240000, Win32 error 487

I was wondering if this was a Cygwin error or Crosstool issue?


I did not find a fix for that.  It only happened when
running lots of programs in parallel.  You should probably
take this problem to the cygwin mailing list.  It would
help if you could put together a minimal test case
(i.e. a shell script that reproduces the problem
with toy sources).


Btw.: Andrew Haley (from RedHat) comments on my question on the GCJ IRC channel:

aph: There's some magic in Win32 to extend the size of a stack segment
aph: I can't remember the command
egholm: but you're right, the problem has first entered after adding some more .o files
aph: we had to do it with Win gcc cross compilers


Hence, it seems that there is some solution somewhere out there (unless he remembers wrong ["aph: I have garbage collected knowledge of unfree OSs from my mind"])...

I am not sure that this is the problem (the fix described after is designed to solve 'Stack Overflow'), but, in case it helps anybody:



From some support site for a closed source application (beware that numbers are somtimes in hex, sometimes in decimal):


----

Configuring stack size for servers running on Windows

To change the thread stack size, you must have the Microsoft editbin
utility, which is included with Microsoft Visual C++. This command line utility
allows you to modify object files, executable files, and dynamic link libraries
(DLLs). For more information on the editbin utility, see the Microsoft Visual
C++ documentation.


1. Save a copy of the original server executable, jagsrv.exe in the EAServer
bin subdirectory.
2. Change the thread stack size by running the following command in the
EAServer bin subdirectory:


editbin /stack:value jagsrv.exe

where value is the new stack size, specified in bytes as a decimal number.
editbin rounds the value up to the closest number divisible by four. For
example, the following command sets a 64K stack size:


editbin /stack:65536 jagsrv.exe

3. You can confirm the new setting by running the Microsoft dumpbin utility,
which is included with Microsoft Visual C++. Run the following command:


dumpbin /headers jagsrv.exe



In the output, the stack size appears as a hexadecimal number on a line
such as this:


80000 size of stack reserve

----



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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