From 867345ed8fba48bc12aa5e0c8b14a4c7a7e5aae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20P=C3=B6chtrager?= Date: Thu, 17 Jul 2014 22:43:29 +0200 Subject: [PATCH] use gcc to compile gcc (there was a weird '-mmacosx-version-min=' issue during gcc compilation with earlier versions) --- README.md | 14 +++++++------- build_gcc.sh | 4 ++++ tools/tools.sh | 10 ++++++++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 09b7ec1..f4c6a9b 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,6 @@ of the [cctools](http://www.opensource.apple.com/tarballs/cctools) (ld, lipo, .. If you want, then you can build an up-to-date vanilla GCC as well. -### WHAT IS NOT WORKING (YET)? ### - -* GCC itself [doesn't build with GCC](https://github.com/tpoechtrager/osxcross/commit/dc8c471), - but builds fine when clang is used to build GCC. - ### WHAT CAN I BUILD WITH IT? ### Basically everything you can build on OS X with clang/gcc should build with this cross toolchain as well. @@ -46,8 +41,13 @@ That's it. See usage examples below. ##### Building GCC: ##### If you want to build GCC as well, then you can do this by running `./build_gcc.sh`. -But before you do this, make sure you have got the GCC build depedencies installed on your system, -on debian like systems you can run `apt-get install libmpc-dev libmpfr-dev libgmp-dev` to install them. +But before you do this, make sure you have got the GCC build depedencies installed on your system. + +On debian like systems you can run: + +`[sudo] apt-get install gcc g++ zlib1g-dev libmpc-dev libmpfr-dev libgmp-dev` + +to install them. ### PACKAGING THE SDK: ### diff --git a/build_gcc.sh b/build_gcc.sh index 5ba23da..091ef11 100755 --- a/build_gcc.sh +++ b/build_gcc.sh @@ -5,6 +5,7 @@ pushd "${0%/*}" &>/dev/null unset LIBRARY_PATH DESC=gcc +USESYSTEMCOMPILER=1 source tools/tools.sh `tools/osxcross_conf.sh` @@ -108,6 +109,9 @@ fi # have gcc popd &>/dev/null # build dir +unset USESYSTEMCOMPILER +source tools/tools.sh + pushd $OSXCROSS_TARGET_DIR/bin &>/dev/null if [ ! -f i386-apple-$OSXCROSS_TARGET-base-gcc ]; then diff --git a/tools/tools.sh b/tools/tools.sh index daf588f..862f276 100755 --- a/tools/tools.sh +++ b/tools/tools.sh @@ -3,8 +3,14 @@ BASE_DIR=`pwd` export LC_ALL="C" -export CC=clang -export CXX=clang++ + +if [ -z "$USESYSTEMCOMPILER" ]; then + export CC=clang + export CXX=clang++ +elif [ -n "$CC" -o -n "$CXX" ]; then + echo "CC/CXX should not be set, continuing in 5 seconds..." 1>&2 + sleep 5 +fi # enable debug messages test -n "$OCDEBUG" && set -x