Building GCC From Scratch Natively on OSX 10.11 (El Capitan) and Above

With every iteration of their desktop operating system, Apple seems more and more determined to try new and novel ways to irritate me. The rootless security model that prevents anyone from writing to ‘/usr‘ (except for ‘/usr/local’; though there is no way for you to re-create this directory if you wipe it). The big problem is that the build process of GCC requires that ‘/usr/include’ exists, and the OSX 10.11 security model does not allow you to create it.

Read more

Simple Way to Build the GCC Suite from Scratch

Gist 5224956 #! /bin/bash GCC_VERSION="5.2.0" WORKDIR="$HOME/src/" INSTALLDIR="/platform" ## NOTE: XCode must be installed (through App Store) and the following run to install command-line tools. ## THIS IS IMPORTANT! Among other things, it creates '/usr/include' and installs the system header files. # xcode-select --install # get the source code cd $WORKDIR wget http://www.netgull.com/gcc/releases/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.bz2 tar -xf gcc-${GCC_VERSION}.tar.bz2 # download the prerequisites cd gcc-${GCC_VERSION} ./contrib/download_prerequisites # create the build directory cd .

Read more

Dump GCC Diagnostics

The following command shows you a bounty of information regarding your gcc installation: gcc -v -x c++ /dev/null -fsyntax-only For example, $ gcc -v -x c++ /dev/null -fsyntax-only Using built-in specs. Target: i686-apple-darwin11 Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00) /usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin11/4.2.1/cc1plus -quiet -v -imultilib x86_64 -iprefix /usr/llvm-gcc-4.

Read more