What compilers are included in Xcode Command Line tools? - xcode

Is there a way to check this? I know llvm is one of the compilers in Xcode, I think GCC also?? Is this correct? is there a definitive way to know?

From the Xcode 4 Release Notes:
DEPRECATED: LLVM-GCC compiler and GDB debugger.
Xcode 4.6 is the last release to include the LLVM-GCC compiler and the GDB debugger.
And
GCC 4.0 has been removed from Xcode 4. If your project has an explicit
Compiler Version of gcc 4.0, you need to change it in order to build
with Xcode 4.
Xcode 5 comes "only" with the LLVM compiler suite, including "clang" and "clang++".

Related

How do I change compiler on Xcode to gcc 7.3.0?

I currently have Xcode 6.2.
First is there a way to check if this version of Xcode comes with gcc 7.3.0? And if it does have gcc 7.3.0, how do I set up Xcode so that gcc 7.3.0 becomes the default compiler?
However if my Xcode does not have gcc 7.3.0 how do I get gcc 7.3 and set up Xcode so that gcc 7.3.0 becomes the default compiler?
Xcode uses the LLVM Clang compiler, not gcc. gcc can be installed, the easiest way would be using either Homebrew or MacPorts. I'm not sure if there's any way to make it the default compiler though, especially not to use from inside Xcode. Is there some specific feature/reason why you need gcc 7.3?

Whats is proper version of llvm/clang/xcode?

This gist mentions that xcode 9 published with 'Apple LLVM version 9.0.0 (clang-900.0.38)', but the last version of llvm in llvm.org is LLVM 5.0.0.
What is the relation between them?
Apple's Xcode ship with LLVM, but it is not the open source version. For example, some clang extra tool won't be installed to you Mac. So at least, Apple has modify CMakeLists.txt. You can read the CMakeLists.txt or Makefile in apple open source.
This is only a suggestion, maybe is not helpful.
Another: index.file shows Xcode LLVM 9 map to Clang/LLVM 4.0.
You can obtain the source code for the compiler shipped with Xcode from https://opensource.apple.com if you want to have the exact same version of LLVM.

GDB debugging x86 Assembler code on OS X Mavericks

I've been trying to find an answer to this on stackoverflow for about an hour now, seems that a lot of similar problems are around but none really fitting to mine.
Information about what tools I'm using can be found further down!
I am writing my own compiler for a subset of the java language and thus creating assembler code. Now I'm at a point where I need to debug said assembler code to locate a bug. The problem is when I compile my assembler code to a binary with gcc -m32 -g myAssembler.s I get the following warning:
warning: no debug symbols in executable (-arch i386)
(This warning also occurs using -ggdb, -ggdb2, -ggdb3, -g2, -g3instead of -g
Since there are no debug symbols I can't use gdb to debug my code. I don't know much about linking and how it's done or who does it (especially on a Mac), so precise/noob-friendly answers would be very welcome.
Tools I'm using:
The assembly created from my compiler is x86, 32-bit GAS Syntax.
I am using OS X Mavericks with GNU gdb (GDB) 7.6 downloaded via MacPorts (They changed its name to ggdb. The ggdb --version command shows also a line saying :
This GDB was configured as "x86_64-apple-darwin13.0.0".
(Not quite sure if that's important.)
Running gcc --version returns:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
This is probably connected with Apple dropping support for GDB in Xcode 5 and you are using the version of gcc that comes with Xcode 5. You probably need to change compiler or debugger (to lldb)… you might look at llvm-gcc (which Xcode 5 also drops support for). Try www.llvm.org for a download. But that might be more trouble than using lldb (if your problem is indeed connected to Xcode 5's changes). Good luck! – CRD
I just downloaded gcc-4.2 from homebrew and that seems to work for lldb (which is still supported by Xcode 5 it seems). – Octoshape

XCode 4 - using GCC 4.0 to compile?

Code coverage for xcode 4 only works on GCC 4.0.
How can I set my compiler to use GCC 4.0 instead of GCC 4.2.
Do i need to download 4.0 ?
GCC 4.0 is not installed with Xcode 4. You can get it back by following the directions in this question about adding support for 10.4 and 10.5 SDKs to Xcode 4.

Obtaining GCC for OSX with Developer Tools installed

I want to start working with C++0x. I see that GCC 4.7 has a fair amount of functionality available. I already have XCode 3.2 installed in /Developer
I downloaded: http://fileboar.com/gcc/snapshots/LATEST-4.7/gcc-4.7-20110528.tar.bz2
Can I somehow compile this in /opt/gcc-4.7? How do I then work with my path so I can compile with GCC 4.7 from the command-line but have OSX use the version it needs?
OSX does not need gcc to run - the Developer tools are optional. So you only need to choose between gcc's when you compile. In Xcode you chose explicitly the gcc andin Makefiles you can set $(CC) or similar to the full path.
Alternatively rename the gcc-4.7 gcc to gcc-4.7 and use that so gcc is always the Apple one.
For ease of using multiple C++ compilers I use macports (or fink or homebrew) which will compile the compilers with the correct patches and also has a port select command to switch between the C++ compilers

Resources