How do i print the compile and link steps as executed by ghc

Which parameters should i pass to ghc in order for it to print its compile and link steps.
For instance i can correctly do “ghc helloworld.s” but i don’t know which libraries it is linking

1 Like

Like most developer tools, GHC’s -v flag stands for “verbose”. In this case it might be underwhelming because GHC will generate temporary files and call gcc with a LOT of arguments. Thus, you can’t reproduce the result manually because you lack the temporary files and are left asking “what linker call does gcc use?”. You can pass flags through GHC to component programs including the linker though if that is the desire.

EDIT: Using -v you do see the -L flags passed to gcc but if you’re asking about dynamic libraries then the best thing is probably to query the resulting binary such as ldd <result> or otool -L <result>.

1 Like

As @TomMD said -v is your friend. Just an addition. -v has levels. -v3 should give you pretty much all commands ghc is running.

1 Like

Thanks , -v3 was what i was looking for