2

Let's say I am compiling my code with nim c -d:release myprog.nim. How can I see what flags are being passed to gcc, and how to specify additional flags? For example I want to use -ffast-math.

I tried to trace the logic in /etc/nim.cfg, but I'd rather be able to see directly what nim c is emitting.

Imran
  • 12,950
  • 8
  • 64
  • 79

1 Answers1

4

I think --listCmd (from the Compiler User Guide, Advanced Flags section) will show the flags being passed to your C compiler.

To pass flags to the C compiler directly the Nim Compiler User Guide has this to say:

-t, --passC:OPTION  pass an option to the C compiler
-l, --passL:OPTION  pass an option to the linker

I haven't tried these myself but they seem like they should work.

bsinky
  • 515
  • 5
  • 15
  • Thanks, I'm on a Mac and there are some annoying default flags being passed to clang, namely -lrt is breaking things, but where do I remove that? – Clarence Liu Jan 12 '22 at 10:42