Preparing GCC Build: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
m (Fixed the link to macports)
m (→‎macOS Users: change http links to https)
Line 164: Line 164:
Install a new version (compile it yourself or use MacPorts) and add <tt>--with-libiconv-prefix=/opt/local</tt> (or <tt>/usr/local</tt> if you compiled it yourself) to GCC's <tt>./configure</tt> line. Alternatively you may place the libiconv source as gcc-x.y.z/libiconv and it will be compiled as part of the GCC compilation process. (This trick also works for MPFR, GMP, and MPC).
Install a new version (compile it yourself or use MacPorts) and add <tt>--with-libiconv-prefix=/opt/local</tt> (or <tt>/usr/local</tt> if you compiled it yourself) to GCC's <tt>./configure</tt> line. Alternatively you may place the libiconv source as gcc-x.y.z/libiconv and it will be compiled as part of the GCC compilation process. (This trick also works for MPFR, GMP, and MPC).


The makefiles of Binutils and GCC use the <source lang="make" enclose="none">$(CC)</source> variable to invoke the compiler. On OS X, this resolves to <source lang="text" enclose="none">gcc</source> by default, which is actually <source lang="bash" enclose="none">clang</source>. Prior to OS X 10.8, the Clang that came with Xcode's Command Line Tools package was not able to build a working GCC. Users running OS X 10.7 or below may need to find and install GCC, either from [http://brew.sh Homebrew], or from somewhere on Apple's website. You can try with the old GCC that comes preinstalled on some macOS versions.
The makefiles of Binutils and GCC use the <source lang="make" enclose="none">$(CC)</source> variable to invoke the compiler. On OS X, this resolves to <source lang="text" enclose="none">gcc</source> by default, which is actually <source lang="bash" enclose="none">clang</source>. Prior to OS X 10.8, the Clang that came with Xcode's Command Line Tools package was not able to build a working GCC. Users running OS X 10.7 or below may need to find and install GCC, either from [https://brew.sh Homebrew], or from somewhere on Apple's website. You can try with the old GCC that comes preinstalled on some macOS versions.


<source lang="bash">
<source lang="bash">
Line 176: Line 176:
You will want to unset these exports once you compiled and installed the cross compiler.
You will want to unset these exports once you compiled and installed the cross compiler.


'''Note for Lion users:''' If you're on Lion (or above) chances are that you don't have the "real" GCC since Apple removed it from the Xcode package, but you can still install it. You can do it via Homebrew or by compiling from source, both are perfectly described on [http://apple.stackexchange.com/a/38247 a StackExchange answer].
'''Note for Lion users:''' If you're on Lion (or above) chances are that you don't have the "real" GCC since Apple removed it from the Xcode package, but you can still install it. You can do it via Homebrew or by compiling from source, both are perfectly described on [https://apple.stackexchange.com/a/38247 a StackExchange answer].


'''Note for Maverick users:''' You can build binutils-2.24 and gcc-4.8.3 (possible other version) with Xcode 5.1.1. Note that building GCC with LLVM is not officially supported and may cause interesting bugs, if you are willing to take this risk and save time building host-gcc just to compile a cross-gcc, follow this.
'''Note for Maverick users:''' You can build binutils-2.24 and gcc-4.8.3 (possible other version) with Xcode 5.1.1. Note that building GCC with LLVM is not officially supported and may cause interesting bugs, if you are willing to take this risk and save time building host-gcc just to compile a cross-gcc, follow this.
Install GMP, MPFR, Mpc with [http://www.macports.org/ MacPorts].
Install GMP, MPFR, Mpc with [https://www.macports.org/ MacPorts].


sudo port install gmp mpfr libmpc
sudo port install gmp mpfr libmpc