I just installed gcc 4.9 (with C11 support), and want to add it to Xcode 4.6.3's build options as a compiler option. I ran make and make install, and the packages are all there (under /usr/bin/gcc. Running gcc --version confirms that gcc 4.9 is installed rather than an older version.

When I go into an existing Xcode project's build settings, the only compiler options available are

  • Apple LLVM compiler 4.2

  • LLVM GCC 4.2

  • Other...

Clearly, GCC 4.9 would have to be added using the "Other..." option, although I'm not sure how. I've tried inputting the path to gcc (/usr/bin/gcc), although the default value for other isn't a path at all: com.apple.compilers.llvmgcc42.

I've also tried following the instructions from the answer to this question on StackOverflow as well, but the machine I'm on doesn't have the /Developer directory at all, since I believe Apple integrated the developer tools that required (and created) this directory into Xcode.

How do I add gcc 4.9 as a compiler option in Xcode?

Not having a mac I can't say how to configure Xcode to accept the new compiler; however, my wife does have one and does serious computer systems work for a major physics lab, so I'll ask her. Just be patient - she's getting ready for a family visit tomorrow... :-)

We (wife and I) are conversing via email about this right now. I'll let you know what she says.

Ok. What we find is this - there isn't a GCC 4.9 for the Mac as yet. The latest is 4.8. Either you are trying to run a beta version, or you are mistaken - though they have been wrong once or twice before (ok - maybe once). The other thing is that using xcode as a build environment can be a real PITA to configure for tools other than what they (Apple) provide. It depends a lot upon the project according to the boffins at Fermi Lab. IE, you will be playing whack-a-mole for awhile to get it to work. Their recommendation is to revert to "old tech" - a command line terminal and a Makefile... :-) Anyway, that's what they do to build Mac software.

Sorry, but this is a good as I can do to help you... :-(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.