I'm trying to set up an older version of ocaml, and I'm getting an error message that says that I need to increase my stack size. The only way I've found to do this in cygwin involves running an additional argument with gcc, but the instructions I'm following have me using a makefile to compile the program. Since I'm not manually typing the gcc command, I'm not sure where to add that argument.

Here's a pastebin of the installation process: http://pastebin.com/j2Q45pKm

$ make world.opt
The current stack size limit is too low (2026k)
You must increase it with one of the following commands:
Under sh, bash, zsh:  ulimit -s 3072
Under csh, tcsh:      limit stacksize 3072

Makefile:621: recipe for target 'checkstack' failed
make: *** [checkstack] Error 3

And here's the argument I'm trying to pass: https://stackoverflow.com/questions/156510/increase-stack-size-on-windows-gcc

Because this is Cygwin, ulimit doesn't work to increase the stack size.

2 Answers 2


Run ./configure -cc "gcc -Wl,--stack,16777216" (plus any other option you want) if you want to always run gcc with the argument -Wl,--stack,16777216 during the compilation process. After that, run make clean, then make world.opt again. You need to clean all previously generated binaries (not the byte compiled files, but it's easier to just do make clean) so that they're regenerated with the new stack size option.

The Ocaml makefile doesn't use the common CC and CFLAGS conventions, because it can use different compilers with different options for different parts of the build process. Building compilers tends to be a bit peculiar.


With makefiles that follow standard conventions, you can use make CC='gcc -fwhatever or make CFLAGS='-fwhatever'. (For C++, it's CXX and CXXFLAGS)

  • Thanks. I got the argument that I typed to appear next to gcc but I don't think it worked. I've updated the original post with the link to the command that's supposed to change the stack size. I tried make world.opt CC='gcc -Wl,--stack,16777216'.
    – eternal
    Sep 28, 2014 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.