I am an application programmer, not a macos developer. Although I have full Xcode installed, I am not fond of the clang toolchain. Instead, I like plain old gcc, gdb, and gprof, as they work on linux and used to work on osx.

so I installed gcc-9 via brew install gcc. It sits in /usr/local/bin/gcc-9, and I am invoking it as

$ gcc-9 -g -pg -Wall test.c

the gcc-9 insures that this is not an accidental invokation of clang (llvm-gcc). moreover, I confirmed that in my path /usr/local/bin (with gcc-9) appears before /usr/bin/, where binaries for clang and gcc (no -9) sit. So the answers to Installed gcc with Homebrew, now how to use that gcc instead of clang? don't help me.

alas, gcc-9 still does not produce output that collaborates much with the standard gnu toolchain. that is, gcc-9 still creates an a.out.dSYM directory with -g (which gdb does not like); and -pg-created executables still complain that dyld: __dyld section not supported in /Users/ivo/Sync/research/crsp/./a.out error with -pg.

is it possible for gcc-9 to create simple plain old compiled files with integrated symbols and profiling instructions that do not try to imitate clang, but behave just as they do on linux?

  • do you have Xcode command line tools installed? If not, install it xcode-select --install using this command on any terminal window – Prado Aug 30 at 17:48

You must log in to answer this question.

Browse other questions tagged .