2

Having some problems compiling a project, project was provided by the school and even if I don't change anything I get these errors while compiling in Qt Creator:

clang: error: unknown argument: '-fno-stack-limit'
clang: error: unknown argument: '-fno-stack-limit'
clang: error: unknown argument: '-fno-stack-limit'
clang: error: unknown argument: '-fno-stack-limit'
make: clang: error: unknown argument: '-fno-stack-limit'
*** [adapter.o] Error 1
make: *** Waiting for unfinished jobs....
clang: error: unknown argument: '-fno-stack-limit'
make: *** [trailblazer.o] Error 1
make: *** [types.o] Error 1
make: *** [trailblazergui.o] Error 1
make: *** [BasicGraph.o] Error 1
clang: error: unknown argument: '-fno-stack-limit'
make: *** [console.o] Error 1
clang: error: unknown argument: '-fno-stack-limit'
make: *** [costs.o] Error 1
make: *** [direction.o] Error 1
22:27:18: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project Trailblazer (kit: Desktop Qt 5.13.0 clang 64bit)
When executing step "Make"

Any ideas on what could be wrong? Running on Mac OS

mip
  • 8,355
  • 6
  • 53
  • 72
Lss
  • 65
  • 1
  • 7
  • 1
    The error message says it. Your compiler (clang) does not recognize `-fno-stack-limit` flag. It seems like your school folks use GCC. The flag is probably set in your `.pro` file. You can try to remove it. If you really need a huge stack then you can look for questions on how to increase stack limit on Mac OS with clang. – mip Dec 07 '19 at 23:17
  • 1
    After googling a while, it seems to me that there is no such option for Clang. (I don't know such option for MSVC++, so I wouldn't wonder.) Instead, you can increase the default stack size: [SO: How do I increase the stack size when compiling with Clang on OS X?](https://stackoverflow.com/a/18912422/7478597) – Scheff's Cat Dec 09 '19 at 10:53

1 Answers1

1

The clang compiler doesn't support '-fno-stack-limit'. But you can get the same effect by passing the --stack flag to GNU linker:

   --stack reserve
   --stack reserve,commit
       Specify the number of bytes of memory to reserve (and optionally commit) to be used as stack for this program.  The default is 2MB
       reserved, 4K committed.  [This option is specific to the i386 PE targeted port of the linker]

For Mac OS default linker you can pass -stack_size:

-stack_size size
    Specifies the maximum stack size for the main thread in a program. Without this
    option a program has a 8MB stack. The argument size is a hexadecimal number with
    an optional leading 0x. The size should be an even multiple of 4KB, that is the
    last three hexadecimal digits should be zero.

to pass a flag to linker you can use -Wl. e.g.,

clang++ -Wl,-stack_size -Wl,0x1000000 -o test test.cpp

Where 0x1000000 = size of stack 16MB.

A. K.
  • 34,395
  • 15
  • 52
  • 89