diff --git a/CHANGELOG b/CHANGELOG index d66a048..7c0999b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,26 @@ +/****************************** v1.0 *********************************/ + +Changed: + * Updated cctools to 921 + * Updated ld64 to 409.12 + + * Support has been removed for: + -> Platform: + --> Cygwin and all BSDs besides FreeBSD + -> Other: + --> Building OSXCross with GCC is no longer possible due to + extensive use of clang extensions in ld64. + + * cctools, ld64 and apple-libtapi are now git clone'd and no longer + come with OSXCross itself. + + * wrapper: Added support for MacOS 10.14 SDK + +Added: + * Support for TAPIv2 nand TAPIv3 stubs + * gen_sdk_package_pbzx.sh: Supports latest Xcode images + + /****************************** v0.15 ********************************/ Changed: diff --git a/README.CYGWIN.md b/README.CYGWIN.md deleted file mode 100644 index 3e185fe..0000000 --- a/README.CYGWIN.md +++ /dev/null @@ -1,137 +0,0 @@ -## STEP BY STEP INSTALLATION GUIDE: ## - -#### Step 1: #### - -Get [Cygwin](https://cygwin.com): - -32-Bit: https://cygwin.com/setup-x86.exe -64-Bit: https://cygwin.com/setup-x86_64.exe - -Note: *You can compile for 64-bit in a 32-bit environment.* - -Click on setup-*.exe and install the following packages: - -`git`, `make`, `clang`, `gcc-core`, `gcc-objc`, `gcc-g++`, -`patch`, `wget`, `libuuid-devel`, `openssl` and `pkg-config` - -For LTO support you will also need: - -`libllvm-devel`, `libllvm`, `libedit` and `libffi` - -The Cygwin package of libLLVM lacks the LTO library, but you can create that dll -by issuing the following command: - -`./tools/gen_cyglto_dll.sh` - -#### Step 2: #### - -Open the Cygwin shell: - -![](images/cygwin/osxcross/2.png) - -#### Step 3: #### - -Clone the OSXCross repository: - -![](images/cygwin/osxcross/3.png) - -#### Step 4: #### - -Get the Mac OS X SDK and move it into -`C:\Cygwin*\home\\osxcross\tarballs`. - -Please see [README](README.md) for more. - -#### Step 5: #### - -Build OSXCross: - -![](images/cygwin/osxcross/5_1.png) - -![](images/cygwin/osxcross/5_2.png) - -#### Step 6: #### - -Add the printed target/bin path to your `~/.bashrc`: - -![](images/cygwin/osxcross/6.png) - -#### Step 7: #### - -Restart the Cygwin shell: - -![](images/cygwin/osxcross/7.png) - -#### Step 8: #### - -Verify target/bin is in PATH: - -![](images/cygwin/osxcross/8.png) - -All done! - -## OPTIONAL: ## - -### Compiler-RT ### - -Please see [README.COMPILER-RT](README.COMPILER-RT.md) for more. - -#### Step 1: #### - -Build Compiler-RT: - -![](images/cygwin/compiler-rt/1.png) - -#### Step 2: #### - -Execute the printed commands: - -![](images/cygwin/compiler-rt/2.png) - -![](images/cygwin/compiler-rt/3.png) - -#### Step 3: #### - -Verify Compiler-RT works: - -![](images/cygwin/compiler-rt/4.png) - -## EXAMPLE USAGE: ### - -### osxcross-macports ### - -Please see [README.MACPORTS](README.MACPORTS.md) for more. - -#### Step 1: #### - -Change the deployment target to >= 10.7: - -![](images/cygwin/macports/1.png) - -#### Step 2: #### - -Restart the Cygwin shell: - -![](images/cygwin/macports/2.png) - -#### Step 3: #### - -Let's install libgeoip: - -![](images/cygwin/macports/3.png) - -#### Step 4: #### - -Write a simple test program: - -![](images/cygwin/macports/4.png) - -#### Step 5: #### - -Compile the test program: - -![](images/cygwin/macports/5.png) - -... or the xcrun way: - -![](images/cygwin/macports/6.png) diff --git a/README.md b/README.md index 96a87a3..92c1f84 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ### WHAT IS THE GOAL OF OSXCROSS? ### The goal of OSXCross is to provide a well working OS X cross toolchain for -Linux, \*BSD, and Cygwin. +Linux and FreeBSD. ### HOW DOES IT WORK? ### @@ -40,28 +40,23 @@ See [README.MACPORTS](README.MACPORTS.md) for more. ### INSTALLATION: ### -*Windows/Cygwin users should follow [README.CYGWIN](README.CYGWIN.md).* - Move your [packaged SDK](https://github.com/tpoechtrager/osxcross#packaging-the-sdk) to the tarballs/ directory. Then ensure you have the following installed on your system: -`Clang 3.2+`, `patch`, `libxml2-devel` (<=10.6 only) and the `bash shell`. +`Clang 3.4+`, `cmake`, `git`, `patch`, `Python`, `libssl-devel` (openssl) +`lzma-devel`, `libxml2-devel`(<=10.6 only) and the `bash shell`. You can run 'sudo tools/get\_dependencies.sh' to get these (and the -optional packages) automatically. +optional packages) automatically. (outdated) *Optional:* - `llvm-devel`: For Link Time Optimization support +- `llvm-devel`: For ld64 `-bitcode_bundle` support - `uuid-devel`: For ld64 `-random_uuid` support -- `llvm-devel` + `xar-devel`: For ld64 `-bitcode_bundle` support - -You can find xar [here](https://github.com/mackyle/xar). -Do not install libxar-dev on Ubuntu, it's a different package. - ##### Building Clang ##### @@ -159,35 +154,48 @@ use these variants unless you know what you're doing. ##### Packaging the SDK on Mac OS X: ##### -1. [Download [Xcode](https://download.developer.apple.com/Developer_Tools/Xcode_7.3/Xcode_7.3.dmg) \*\*] +1. [Download [Xcode](https://developer.apple.com/download/more/) \*\*] 2. [Mount Xcode.dmg (Open With -> DiskImageMounter) \*\*\*] 3. Run: `./tools/gen_sdk_package.sh` (from the OSXCross package) 4. Copy the packaged SDK (\*.tar.\* or \*.pkg) on a USB Stick 5. (On Linux/BSD) Copy or move the SDK into the tarballs/ directory of OSXCross. -\*\* Xcode up to 7.3.x is known to work. +\*\* +Xcode up to 10.2.x is known to work. +Use Firefox if you have problems with signing in. -\*\*\* If you get a dialog with a crossed circle, ignore it. You don't need -to install Xcode. +\*\*\* +If you get a dialog with a crossed circle, ignore it. +You don't need to install Xcode. Step 1. and 2. can be skipped if you have Xcode installed. -##### Packing the SDK on Linux, Method 1 (works up to Xcode 7.3): ##### +##### Packing the SDK on Linux, Method 1 (Xcode > 8.0): ##### + +This method may require up to 20 GB of free disk space. +An SSD is recommended for this method. + +1. Download Xcode like described in 'Packaging the SDK on Mac OS X' +2. Install ... +3. Run `./tools/gen_sdk_package_pbzx.sh .xip` +4. Copy or move the SDK into the tarballs/ directory + +##### Packing the SDK on Linux, Method 2 (works up to Xcode 7.3): ##### 1. Download Xcode like described in 'Packaging the SDK on Mac OS X' 2. Install `cmake`, `libxml2-dev` and `fuse` 3. Run `./tools/gen_sdk_package_darling_dmg.sh .dmg` 4. Copy or move the SDK into the tarballs/ directory -##### Packing the SDK on Linux, Cygwin (and others), Method 2 (works up to Xcode 7.2): ##### +##### Packing the SDK on Linux (and others), Method 3 (works up to Xcode 7.2): ##### 1. Download Xcode like described in 'Packaging the SDK on Mac OS X' 2. Ensure you have `clang` and `make` installed 3. Run `./tools/gen_sdk_package_p7zip.sh .dmg` 4. Copy or move the SDK into the tarballs/ directory -##### Packing the SDK on Linux, Method 3 (works up to Xcode 4.2): ##### +##### Packing the SDK on Linux, Method 4 (works up to Xcode 4.2): ##### 1. Download Xcode 4.2 for Snow Leopard 2. Ensure you are downloading the "Snow Leopard" version @@ -248,20 +256,23 @@ Usage Examples: * C++98: `o32-clang++ -stdlib=libc++ test.cpp -o test` * C++11: `o32-clang++ -stdlib=libc++ -std=c++11 test1.cpp -o test` * C++14: `o32-clang++ -stdlib=libc++ -std=c++14 test1.cpp -o test` - * C++1z: `o32-clang++ -stdlib=libc++ -std=c++1z test1.cpp -o test` + * C++17: `o32-clang++ -stdlib=libc++ -std=c++17 test1.cpp -o test` + * C++2a: `o32-clang++ -stdlib=libc++ -std=c++2a test1.cpp -o test` * Clang (shortcut): * C++98: `o32-clang++-libc++ test.cpp -o test` * C++11: `o32-clang++-libc++ -std=c++11 test.cpp -o test` * C++14: `o32-clang++-libc++ -std=c++14 test.cpp -o test` - * C++1z: `o32-clang++-libc++ -std=c++1z test.cpp -o test` + * C++17: `o32-clang++-libc++ -std=c++17 test.cpp -o test` + * C++2a: `o32-clang++-libc++ -std=c++2a test.cpp -o test` * GCC * C++11: `o32-g++-libc++ -std=c++11 test.cpp` * C++14: `o32-g++-libc++ -std=c++14 test.cpp -o test` - * C++1z: `o32-g++-libc++ -std=c++1z test.cpp -o test` + * C++17: `o32-g++-libc++ -std=c++17 test.cpp -o test` + * C++2a: `o32-g++-libc++ -std=c++2a test.cpp -o test` ##### Building test1.cpp and test2.cpp with LTO (Link Time Optimization): ##### @@ -281,7 +292,9 @@ Usage Examples: ### DEPLOYMENT TARGET: ### -The default deployment target is `Mac OS X 10.5`. +The default deployment target is: +SDK <= 10.13: `Mac OS X 10.5` +SDK >= 10.14: `Mac OS X 10.9` However, there are several ways to override the default value: diff --git a/build.sh b/build.sh index af2c02e..49e1c53 100755 --- a/build.sh +++ b/build.sh @@ -5,62 +5,12 @@ # This script requires the OS X SDK and the Clang/LLVM compiler. # +OSXCROSS_VERSION=1.0 pushd "${0%/*}" &>/dev/null source tools/tools.sh -# find sdk version to use -function guess_sdk_version() -{ - tmp1= - tmp2= - tmp3= - file= - sdk= - guess_sdk_version_result= - sdkcount=$(find -L tarballs/ -type f | grep MacOSX | wc -l) - if [ $sdkcount -eq 0 ]; then - echo no SDK found in 'tarballs/'. please see README.md - exit 1 - elif [ $sdkcount -gt 1 ]; then - sdks=$(find -L tarballs/ -type f | grep MacOSX) - for sdk in $sdks; do echo $sdk; done - echo 'more than one MacOSX SDK tarball found. please set' - echo 'SDK_VERSION environment variable for the one you want' - echo '(for example: SDK_VERSION=10.x [OSX_VERSION_MIN=10.x] ./build.sh)' - exit 1 - else - sdk=$(find -L tarballs/ -type f | grep MacOSX) - tmp2=$(echo ${sdk/bz2/} | $SED s/[^0-9.]//g) - tmp3=$(echo $tmp2 | $SED s/\\\.*$//g) - guess_sdk_version_result=$tmp3 - echo 'found SDK version' $guess_sdk_version_result 'at tarballs/'$(basename $sdk) - fi - if [ $guess_sdk_version_result ]; then - if [ $guess_sdk_version_result = 10.4 ]; then - guess_sdk_version_result=10.4u - fi - fi - export guess_sdk_version_result -} - -# make sure there is actually a file with the given SDK_VERSION -function verify_sdk_version() -{ - sdkv=$1 - for file in tarballs/*; do - if [ -f "$file" ] && [ $(echo $file | grep OSX.*$sdkv) ]; then - echo "verified at "$file - sdk=$file - fi - done - if [ ! $sdk ] ; then - echo cant find SDK for OSX $sdkv in tarballs. exiting - exit - fi -} - if [ $SDK_VERSION ]; then echo 'SDK VERSION set in environment variable:' $SDK_VERSION test $SDK_VERSION = 10.4 && SDK_VERSION=10.4u @@ -70,34 +20,28 @@ else fi verify_sdk_version $SDK_VERSION +case $SDK_VERSION in + 10.4*) TARGET=darwin8; X86_64H_SUPPORTED=0; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.4; ;; + 10.5*) TARGET=darwin9; X86_64H_SUPPORTED=0; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;; + 10.6*) TARGET=darwin10; X86_64H_SUPPORTED=0; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;; + 10.7*) TARGET=darwin11; X86_64H_SUPPORTED=0; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;; + 10.8*) TARGET=darwin12; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;; + 10.9*) TARGET=darwin13; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;; + 10.10*) TARGET=darwin14; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;; + 10.11*) TARGET=darwin15; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.5; ;; + 10.12*) TARGET=darwin16; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.5; ;; + 10.13*) TARGET=darwin17; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.5; ;; + 10.14*) TARGET=darwin18; X86_64H_SUPPORTED=1; I386_SUPPORTED=0; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.9; ;; +*) echo "Unsupported SDK"; exit 1 ;; +esac + + # Minimum targeted OS X version # Must be <= SDK_VERSION -if [ -z "$OSX_VERSION_MIN" ]; then - if [ $SDK_VERSION = 10.4u ]; then - OSX_VERSION_MIN=10.4 - else - OSX_VERSION_MIN=10.5 - fi +if [ -n "$OSX_VERSION_MIN_INT" -a -z "$OSX_VERSION_MIN" ]; then + OSX_VERSION_MIN=$OSX_VERSION_MIN_INT fi -OSXCROSS_VERSION=0.15 - -X86_64H_SUPPORTED=0 - -case $SDK_VERSION in - 10.4*) TARGET=darwin8 ;; - 10.5*) TARGET=darwin9 ;; - 10.6*) TARGET=darwin10 ;; - 10.7*) TARGET=darwin11 ;; - 10.8*) TARGET=darwin12; X86_64H_SUPPORTED=1; ;; - 10.9*) TARGET=darwin13; X86_64H_SUPPORTED=1; ;; - 10.10*) TARGET=darwin14; X86_64H_SUPPORTED=1; ;; - 10.11*) TARGET=darwin15; X86_64H_SUPPORTED=1; ;; - 10.12*) TARGET=darwin16; X86_64H_SUPPORTED=1; ;; - 10.13*) TARGET=darwin17; X86_64H_SUPPORTED=1; ;; - 10.14*) TARGET=darwin18; X86_64H_SUPPORTED=1; ;; -*) echo "Invalid SDK Version" && exit 1 ;; -esac export TARGET @@ -122,161 +66,109 @@ mkdir -p $BUILD_DIR mkdir -p $TARGET_DIR mkdir -p $SDK_DIR -require $CC -require $CXX - -require clang -require patch -require gunzip +source $BASE_DIR/tools/trap_exit.sh pushd $BUILD_DIR &>/dev/null -function remove_locks() -{ - rm -rf $BUILD_DIR/have_cctools* -} -source $BASE_DIR/tools/trap_exit.sh -# CCTOOLS -CCTOOLS_PATCH_REV=0 -LINKER_VERSION=274.2 -CCTOOLS="cctools-895-ld64-$LINKER_VERSION" -CCTOOLS_TARBALL=$(ls $TARBALL_DIR/$CCTOOLS*.tar.* | head -n1) -CCTOOLS_REVHASH=$(echo $(basename "$CCTOOLS_TARBALL") | tr '_' '\n' | \ - tr '.' '\n' | tail -n3 | head -n1) +OLD_SDK_VERSION=$(cat .oc_sdk_version 2>/dev/null || echo "") +echo -n "$SDK_VERSION" > .oc_sdk_version -if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET_${CCTOOLS_PATCH_REV}" ]; then +if [ "$SDK_VERSION" != "$OLD_SDK_VERSION" ]; then + # SDK Version has changed. -> Rebuild everything. + rm -f .*_build_complete +fi -rm -rf cctools* -rm -rf xar* +# XAR -extract $CCTOOLS_TARBALL 1 +build_xar -pushd cctools*/cctools &>/dev/null -pushd .. &>/dev/null -./tools/fix_unistd_issue.sh 1>/dev/null -popd &>/dev/null -patch -p0 < $PATCH_DIR/cctools-ld64-1.patch -patch -p0 < $PATCH_DIR/cctools-ld64-2.patch -echo "" -CONFFLAGS="--prefix=$TARGET_DIR --target=x86_64-apple-$TARGET " -[ -z "$USE_CLANG_AS" ] && CONFFLAGS+="--disable-clang-as " -[ -n "$DISABLE_LTO_SUPPORT" ] && CONFFLAGS+="--disable-lto-support " -# https://github.com/tpoechtrager/osxcross/issues/156 -CXX="$CXX -DNDEBUG" ./configure $CONFFLAGS -$MAKE -j$JOBS -$MAKE install -j$JOBS -popd &>/dev/null +# XAR END + + +## Apple TAPI Library ## + +if [ $NEED_TAPI_SUPPORT -eq 1 ]; then + get_sources https://github.com/tpoechtrager/apple-libtapi.git 1000.10.8 + + if [ $f_res -eq 1 ]; then + pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null + INSTALLPREFIX=$TARGET_DIR ./build.sh + ./install.sh + popd &>/dev/null + build_success + fi +fi + +## cctools and ld64 ## + +echo "TODO: --with-xar=..." + +get_sources https://github.com/tpoechtrager/cctools-port.git 921-ld64-409.12 + +LINKER_VERSION=$(cat \ + $CURRENT_BUILD_PROJECT_NAME/cctools/ld64/src/3rd/helper.c | \ + grep ldVersionString | head -n1 | awk '{print $6}' | tr ':' '\n' | \ + tr '\\' '\n' | tr '-' '\n' | tr '\n' ' '| awk '{print $3}') + +if [ $f_res -eq 1 ]; then + pushd $CURRENT_BUILD_PROJECT_NAME/cctools &>/dev/null + echo "" + + CONFFLAGS="--prefix=$TARGET_DIR --target=x86_64-apple-$TARGET " + if [ $NEED_TAPI_SUPPORT -eq 1 ]; then + CONFFLAGS+="--with-libtapi=$TARGET_DIR " + fi + [ -z "$USE_CLANG_AS" ] && CONFFLAGS+="--disable-clang-as " + [ -n "$DISABLE_LTO_SUPPORT" ] && CONFFLAGS+="--disable-lto-support " + # https://github.com/tpoechtrager/osxcross/issues/156 + CXX="$CXX -DNDEBUG" ./configure $CONFFLAGS + $MAKE -j$JOBS + $MAKE install -j$JOBS + popd &>/dev/null + + pushd $TARGET_DIR/bin &>/dev/null + CCTOOLS=$(find . -name "x86_64-apple-darwin*") + CCTOOLS=($CCTOOLS) + if [ $X86_64H_SUPPORTED -eq 1 ]; then + for CCTOOL in ${CCTOOLS[@]}; do + CCTOOL_X86_64H=$(echo "$CCTOOL" | $SED 's/x86_64/x86_64h/g') + create_symlink $CCTOOL $CCTOOL_X86_64H + done + fi + if [ $I386_SUPPORTED -eq 1 ]; then + for CCTOOL in ${CCTOOLS[@]}; do + CCTOOL_I386=$(echo "$CCTOOL" | $SED 's/x86_64/i386/g') + create_symlink $CCTOOL $CCTOOL_I386 + done + fi + popd &>/dev/null +fi + + +## MacPorts ## pushd $TARGET_DIR/bin &>/dev/null -CCTOOLS=$(find . -name "x86_64-apple-darwin*") -CCTOOLS=($CCTOOLS) -if [ $X86_64H_SUPPORTED -eq 1 ]; then - for CCTOOL in ${CCTOOLS[@]}; do - CCTOOL_X86_64H=$(echo "$CCTOOL" | $SED 's/x86_64/x86_64h/g') - create_symlink $CCTOOL $CCTOOL_X86_64H - done -fi -for CCTOOL in ${CCTOOLS[@]}; do - CCTOOL_I386=$(echo "$CCTOOL" | $SED 's/x86_64/i386/g') - create_symlink $CCTOOL $CCTOOL_I386 -done -popd &>/dev/null - - -fi -# CCTOOLS END - -# MacPorts symlinks -pushd $TARGET_DIR/bin &>/dev/null # The BSD ln command doesn't support '-r' create_symlink $BASE_DIR/tools/osxcross-macports osxcross-macports create_symlink $BASE_DIR/tools/osxcross-macports osxcross-mp create_symlink $BASE_DIR/tools/osxcross-macports omp popd &>/dev/null +## Extract SDK and move it to $SDK_DIR ## + SDK=$(ls $TARBALL_DIR/MacOSX$SDK_VERSION*) - -# XAR -if [[ $SDK == *.pkg ]]; then - -set +e -which xar &>/dev/null -NEED_XAR=$? -set -e - -if [ $NEED_XAR -ne 0 ]; then - -extract $TARBALL_DIR/xar*.tar.gz 2 - -pushd xar* &>/dev/null -if [ $PLATFORM == "NetBSD" ]; then - patch -p0 -l < $PATCH_DIR/xar-netbsd.patch -fi -patch -p0 < $PATCH_DIR/xar-ext2.patch -# https://github.com/tpoechtrager/osxcross/issues/109 -ac_cv_lib_crypto_OpenSSL_add_all_ciphers=yes \ -CFLAGS+=" -w" \ - ./configure --prefix=$TARGET_DIR -$MAKE -j$JOBS -$MAKE install -j$JOBS -popd &>/dev/null - -fi -fi -# XAR END - -if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET_${CCTOOLS_PATCH_REV}" ]; then - -function check_cctools() -{ - [ -f "$TARGET_DIR/bin/$1-apple-$TARGET-lipo" ] || exit 1 - [ -f "$TARGET_DIR/bin/$1-apple-$TARGET-ld" ] || exit 1 - [ -f "$TARGET_DIR/bin/$1-apple-$TARGET-nm" ] || exit 1 - [ -f "$TARGET_DIR/bin/$1-apple-$TARGET-ar" ] || exit 1 - [ -f "$TARGET_DIR/bin/$1-apple-$TARGET-ranlib" ] || exit 1 - [ -f "$TARGET_DIR/bin/$1-apple-$TARGET-strip" ] || exit 1 -} - -check_cctools i386 -check_cctools x86_64 - -touch "have_cctools_${CCTOOLS_REVHASH}_$TARGET_${CCTOOLS_PATCH_REV}" - -echo "" - -fi # HAVE_CCTOOLS - -set +e -ls $TARBALL_DIR/MacOSX$SDK_VERSION* &>/dev/null -while [ $? -ne 0 ] -do - echo "" - echo "Get the MacOSX$SDK_VERSION SDK and move it into $TARBALL_DIR" - echo "(see README for SDK download links)" - echo "" - echo "You can press ctrl-c to break the build process," - echo "if you restart ./build.sh then we will continue from here" - echo "" - if [ -z "$UNATTENDED" ]; then - read -p "Press enter to continue" - else - exit 1 - fi - ls $TARBALL_DIR/MacOSX$SDK_VERSION* &>/dev/null -done -set -e - extract $SDK 1 1 rm -rf $SDK_DIR/MacOSX$SDK_VERSION* 2>/dev/null - if [ "$(ls -l SDKs/*$SDK_VERSION* 2>/dev/null | wc -l | tr -d ' ')" != "0" ]; then mv -f SDKs/*$SDK_VERSION* $SDK_DIR else mv -f *OSX*$SDK_VERSION*sdk* $SDK_DIR fi +## Fix broken SDKs ## + pushd $SDK_DIR/MacOSX$SDK_VERSION.sdk &>/dev/null set +e create_symlink \ @@ -289,14 +181,12 @@ popd &>/dev/null popd &>/dev/null -OSXCROSS_CONF="$TARGET_DIR/bin/osxcross-conf" -OSXCROSS_ENV="$TARGET_DIR/bin/osxcross-env" +## Wrapper ## -rm -f $OSXCROSS_CONF $OSXCROSS_ENV - -echo "compiling wrapper ..." +build_msg "wrapper" export X86_64H_SUPPORTED +export I386_SUPPORTED export OSXCROSS_VERSION export OSXCROSS_TARGET=$TARGET @@ -304,6 +194,10 @@ export OSXCROSS_OSX_VERSION_MIN=$OSX_VERSION_MIN export OSXCROSS_LINKER_VERSION=$LINKER_VERSION export OSXCROSS_BUILD_DIR=$BUILD_DIR +OSXCROSS_CONF="$TARGET_DIR/bin/osxcross-conf" +OSXCROSS_ENV="$TARGET_DIR/bin/osxcross-env" +rm -f $OSXCROSS_CONF $OSXCROSS_ENV + if [ "$PLATFORM" != "Darwin" ]; then # libLTO.so set +e @@ -314,6 +208,7 @@ fi $BASE_DIR/wrapper/build.sh 1>/dev/null + echo "" if [ $(osxcross-cmp ${SDK_VERSION/u/} "<" $OSX_VERSION_MIN) -eq 1 ]; then @@ -326,9 +221,7 @@ elif [ $(osxcross-cmp $OSX_VERSION_MIN "<" 10.4) -eq 1 ]; then exit 1 fi -# CMAKE - -echo "installing CMake" +## CMake ## cp -f "$BASE_DIR/tools/toolchain.cmake" "$TARGET_DIR/" cp -f "$BASE_DIR/tools/osxcross-cmake" "$TARGET_DIR/bin/" @@ -336,29 +229,47 @@ chmod 755 "$TARGET_DIR/bin/osxcross-cmake" create_symlink osxcross-cmake "$TARGET_DIR/bin/i386-apple-$TARGET-cmake" create_symlink osxcross-cmake "$TARGET_DIR/bin/x86_64-apple-$TARGET-cmake" -# CMAKE END +## Compiler test ## unset MACOSX_DEPLOYMENT_TARGET -test_compiler o32-clang $BASE_DIR/oclang/test.c -test_compiler o64-clang $BASE_DIR/oclang/test.c - -test_compiler o32-clang++ $BASE_DIR/oclang/test.cpp -test_compiler o64-clang++ $BASE_DIR/oclang/test.cpp - if [ $(osxcross-cmp ${SDK_VERSION/u/} ">=" 10.7) -eq 1 ]; then - if [ ! -d "$SDK_DIR/MacOSX$SDK_VERSION.sdk/usr/include/c++/v1" ]; then + pushd $SDK_DIR/MacOSX$SDK_VERSION.sdk &>/dev/null + if [ ! -f "usr/include/c++/v1/vector" ]; then echo "" echo -n "Given SDK does not contain libc++ headers " echo "(-stdlib=libc++ test may fail)" echo -n "You may want to re-package your SDK using " echo "'tools/gen_sdk_package.sh' on OS X" fi + if [ -f "usr/include/c++/v1/__hash_table" ]; then + if [ $(osxcross-cmp $SDK_VERSION ">=" 10.7) -eq 1 ]; then + if [ $(osxcross-cmp $SDK_VERSION "<=" 10.12) -eq 1 ]; then + # https://github.com/tpoechtrager/osxcross/issues/171 + set +e + patch -N -p1 -r /dev/null < $PATCH_DIR/libcxx__hash_table.patch + set -e + fi + fi + fi + popd &>/dev/null echo "" - test_compiler_cxx11 o32-clang++ $BASE_DIR/oclang/test_libcxx.cpp + if [ $I386_SUPPORTED -eq 1 ]; then + test_compiler_cxx11 o32-clang++ $BASE_DIR/oclang/test_libcxx.cpp + fi test_compiler_cxx11 o64-clang++ $BASE_DIR/oclang/test_libcxx.cpp + echo "" fi +if [ $I386_SUPPORTED -eq 1 ]; then + test_compiler o32-clang $BASE_DIR/oclang/test.c + test_compiler o32-clang++ $BASE_DIR/oclang/test.cpp + echo "" +fi + +test_compiler o64-clang $BASE_DIR/oclang/test.c +test_compiler o64-clang++ $BASE_DIR/oclang/test.cpp + echo "" echo "Do not forget to add" echo "" @@ -376,3 +287,15 @@ echo "Example 2: CC=i386-apple-$TARGET-clang ./configure --host=i386-apple-$TARG echo "Example 3: o64-clang -Wall test.c -o test" echo "Example 4: x86_64-apple-$TARGET-strip -x test" echo "" + +if [ $I386_SUPPORTED -eq 0 ]; then + echo "Your SDK does not support i386 anymore." + echo "Use <= 10.13 SDK if you rely on i386 support." + echo "" +fi + +if [ $(osxcross-cmp ${SDK_VERSION/u/} ">=" 10.14) -eq 1 ]; then + echo "Your SDK does not support libstdc++ anymore." + echo "Use <= 10.13 SDK if you rely on libstdc++ support." + echo "" +fi diff --git a/build_compiler_rt.sh b/build_compiler_rt.sh index ef07418..ee07e4c 100755 --- a/build_compiler_rt.sh +++ b/build_compiler_rt.sh @@ -16,8 +16,6 @@ if [ $PLATFORM == "Darwin" ]; then exit 1 fi -require git - CLANG_VERSION=$(echo "__clang_major__ __clang_minor__ __clang_patchlevel__" | \ xcrun clang -xc -E - | tail -n1 | tr ' ' '.') @@ -31,12 +29,6 @@ CLANG_LIB_DIR=$(clang -print-search-dirs | grep "libraries: =" | \ tr '=' ' ' | tr ':' ' ' | awk '{print $2}') VERSION=$(echo "${CLANG_LIB_DIR}" | tr '/' '\n' | tail -n1) - -if [ $VERSION != $CLANG_VERSION ]; then - echo "sanity check failed: $VERSION != ${CLANG_VERSION}" 1>&2 - exit 1 -fi - CLANG_INCLUDE_DIR="${CLANG_LIB_DIR}/include" CLANG_DARWIN_LIB_DIR="${CLANG_LIB_DIR}/lib/darwin" @@ -54,10 +46,10 @@ case $CLANG_VERSION in 4.0*) BRANCH=release_40; USE_CMAKE=1; ;; 5.0*) BRANCH=release_50; USE_CMAKE=1; ;; 6.0*) BRANCH=release_60; USE_CMAKE=1; ;; - 7.0*) BRANCH=release_70; USE_CMAKE=1; ;; - 8.0*) BRANCH=release_80; USE_CMAKE=1; ;; - 9.0*) BRANCH=master; USE_CMAKE=1; ;; - * ) echo "Unsupported Clang version, must be >= 3.2 and <= 9.0" 1>&2; exit 1; + 7.* ) BRANCH=release_70; USE_CMAKE=1; ;; + 8.* ) BRANCH=release_80; USE_CMAKE=1; ;; + 9.* ) BRANCH=master; USE_CMAKE=1; ;; + * ) echo "Unsupported Clang version, must be >= 3.2 and <= 9.0" 1>&2; exit 1; esac if [ $(osxcross-cmp $CLANG_VERSION ">=" 3.5) -eq 1 ]; then @@ -75,94 +67,95 @@ fi pushd $OSXCROSS_BUILD_DIR &>/dev/null -if [ ! -e compiler-rt/.clone_complete ]; then - rm -rf compiler-rt - git clone http://llvm.org/git/compiler-rt.git -fi +FULL_CLONE=1 \ + get_sources https://git.llvm.org/git/compiler-rt.git $BRANCH -pushd compiler-rt &>/dev/null +if [ $f_res -eq 1 ]; then + pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null -git reset --hard -git clean -fdx -git checkout $BRANCH -touch .clone_complete -git pull - -EXTRA_MAKE_FLAGS="" -if [ -n "$OCDEBUG" ]; then - EXTRA_MAKE_FLAGS+="VERBOSE=1 " -fi - -export OSXCROSS_NO_X86_64H_DEPLOYMENT_TARGET_WARNING=1 - - -if [ $USE_CMAKE -eq 1 ]; then - - ### CMAKE ### - - require cmake - - $SED -i 's/COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path/'\ -\ \ \ \ \ \ 'COMMAND xcrun -sdk ${sdk_name}.internal --show-sdk-path/g' \ - cmake/Modules/CompilerRTDarwinUtils.cmake - - $SED -i 's/COMMAND xcodebuild -version -sdk ${sdk_name} Path/'\ -\ \ \ \ \ \ 'COMMAND xcrun -sdk ${sdk_name} --show-sdk-path/g' \ - cmake/Modules/CompilerRTDarwinUtils.cmake - - $SED -i "s/COMMAND lipo /COMMAND xcrun lipo /g" \ - cmake/Modules/CompilerRTDarwinUtils.cmake - - $SED -i "s/COMMAND ld /COMMAND xcrun ld /g" \ - cmake/Modules/CompilerRTDarwinUtils.cmake - - $SED -i "s/COMMAND codesign /COMMAND true /g" \ - cmake/Modules/AddCompilerRT.cmake - - mkdir build - pushd build &>/dev/null - - CC=$(xcrun -f clang) CXX=$(xcrun -f clang++) cmake .. \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Darwin \ - -DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) -DCMAKE_AR=$(xcrun -f ar) \ - -DCOMPILER_RT_BUILD_XRAY=OFF - - $MAKE -j $JOBS $EXTRA_MAKE_FLAGS - - popd &>/dev/null - - ### CMAKE END ### - -else - - ### MAKE ### - - $SED -i "s/Configs += ios//g" make/platform/clang_darwin.mk - $SED -i "s/Configs += cc_kext_ios5//g" make/platform/clang_darwin.mk - $SED -i "s/Configs += profile_ios//g" make/platform/clang_darwin.mk - $SED -i "s/Configs += asan_iossim_dynamic//g" make/platform/clang_darwin.mk - - # Unbreak the -Werror build. - if [ -f lib/asan/asan_mac.h ]; then - $SED -i "s/ASAN__MAC_H/ASAN_MAC_H/g" lib/asan/asan_mac.h + if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.11) -eq 1 ]; then + # https://github.com/tpoechtrager/osxcross/issues/178 + patch -p1 < $PATCH_DIR/compiler-rt_clock-gettime.patch fi - EXTRA_MAKE_FLAGS+="LIPO=\"$(xcrun -f lipo)\"" - - if [ $(osxcross-cmp $CLANG_VERSION "<=" 3.3) -eq 1 ]; then - EXTRA_MAKE_FLAGS+=" AR=\"$(xcrun -f ar)\"" - EXTRA_MAKE_FLAGS+=" RANLIB=\"$(xcrun -f ranlib)\"" - EXTRA_MAKE_FLAGS+=" CC=\"$(xcrun -f clang)\"" + EXTRA_MAKE_FLAGS="" + if [ -n "$OCDEBUG" ]; then + EXTRA_MAKE_FLAGS+="VERBOSE=1 " fi - # Must eval here because of the spaces in EXTRA_MAKE_FLAGS. + export OSXCROSS_NO_X86_64H_DEPLOYMENT_TARGET_WARNING=1 - eval "$MAKE clang_darwin $EXTRA_MAKE_FLAGS -j $JOBS" + if [ $USE_CMAKE -eq 1 ]; then - ### MAKE END ### + ### CMAKE ### + $SED -i 's/COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path/'\ +\ \ \ \ \ \ \ 'COMMAND xcrun -sdk ${sdk_name}.internal --show-sdk-path/g' \ + cmake/Modules/CompilerRTDarwinUtils.cmake + + $SED -i 's/COMMAND xcodebuild -version -sdk ${sdk_name} Path/'\ +\ \ \ \ \ \ \ 'COMMAND xcrun -sdk ${sdk_name} --show-sdk-path/g' \ + cmake/Modules/CompilerRTDarwinUtils.cmake + + $SED -i "s/COMMAND lipo /COMMAND xcrun lipo /g" \ + cmake/Modules/CompilerRTDarwinUtils.cmake + + $SED -i "s/COMMAND ld /COMMAND xcrun ld /g" \ + cmake/Modules/CompilerRTDarwinUtils.cmake + + $SED -i "s/COMMAND codesign /COMMAND true /g" \ + cmake/Modules/AddCompilerRT.cmake + + mkdir build + pushd build &>/dev/null + + CC=$(xcrun -f clang) CXX=$(xcrun -f clang++) $CMAKE .. \ + -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Darwin \ + -DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) -DCMAKE_AR=$(xcrun -f ar) + + $MAKE -j $JOBS $EXTRA_MAKE_FLAGS + + popd &>/dev/null + + ### CMAKE END ### + + else + + ### MAKE ### + + $SED -i "s/Configs += ios//g" make/platform/clang_darwin.mk + $SED -i "s/Configs += cc_kext_ios5//g" make/platform/clang_darwin.mk + $SED -i "s/Configs += profile_ios//g" make/platform/clang_darwin.mk + $SED -i "s/Configs += asan_iossim_dynamic//g" make/platform/clang_darwin.mk + + # Unbreak the -Werror build. + if [ -f lib/asan/asan_mac.h ]; then + $SED -i "s/ASAN__MAC_H/ASAN_MAC_H/g" lib/asan/asan_mac.h + fi + + EXTRA_MAKE_FLAGS+="LIPO=\"$(xcrun -f lipo)\"" + + if [ $(osxcross-cmp $CLANG_VERSION "<=" 3.3) -eq 1 ]; then + EXTRA_MAKE_FLAGS+=" AR=\"$(xcrun -f ar)\"" + EXTRA_MAKE_FLAGS+=" RANLIB=\"$(xcrun -f ranlib)\"" + EXTRA_MAKE_FLAGS+=" CC=\"$(xcrun -f clang)\"" + fi + + # Must eval here because of the spaces in EXTRA_MAKE_FLAGS. + + eval "$MAKE clang_darwin $EXTRA_MAKE_FLAGS -j $JOBS" + + ### MAKE END ### + + fi + + build_success fi +# We must re-build every time. git clean -fdx +# removes the libraries. +rm -f $BUILD_DIR/.compiler-rt_build_complete + echo "" echo "" @@ -172,16 +165,14 @@ echo "" echo "mkdir -p ${CLANG_INCLUDE_DIR}" echo "mkdir -p ${CLANG_DARWIN_LIB_DIR}" -echo "cp -rv $PWD/include/sanitizer ${CLANG_INCLUDE_DIR}" - - +echo "cp -rv $BUILD_DIR/compiler-rt/include/sanitizer ${CLANG_INCLUDE_DIR}" if [ $USE_CMAKE -eq 1 ]; then ### CMAKE ### - echo "cp -v $PWD/build/lib/darwin/*.a ${CLANG_DARWIN_LIB_DIR}" - echo "cp -v $PWD/build/lib/darwin/*.dylib ${CLANG_DARWIN_LIB_DIR}" + echo "cp -v $BUILD_DIR/compiler-rt/build/lib/darwin/*.a ${CLANG_DARWIN_LIB_DIR}" + echo "cp -v $BUILD_DIR/compiler-rt/build/lib/darwin/*.dylib ${CLANG_DARWIN_LIB_DIR}" ### CMAKE END ### diff --git a/build_gcc.sh b/build_gcc.sh index 9c8fb5f..1acd9fc 100755 --- a/build_gcc.sh +++ b/build_gcc.sh @@ -20,7 +20,7 @@ eval $(tools/osxcross_conf.sh) # GCC version to build # (<4.7 will not work properly with libc++) if [ -z "$GCC_VERSION" ]; then - GCC_VERSION=8.2.0 + GCC_VERSION=9.1.0 #GCC_VERSION=5-20140928 # snapshot fi @@ -42,16 +42,16 @@ if [ ! -f "have_gcc_${GCC_VERSION}_${OSXCROSS_TARGET}" ]; then pushd $OSXCROSS_TARBALL_DIR &>/dev/null if [[ $GCC_VERSION != *-* ]]; then - wget -c "$GCC_MIRROR/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.gz" + wget -c "$GCC_MIRROR/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz" else - wget -c "$GCC_MIRROR/snapshots/$GCC_VERSION/gcc-$GCC_VERSION.tar.gz" + wget -c "$GCC_MIRROR/snapshots/$GCC_VERSION/gcc-$GCC_VERSION.tar.xz" fi popd &>/dev/null echo "cleaning up ..." rm -rf gcc* 2>/dev/null -extract "$OSXCROSS_TARBALL_DIR/gcc-$GCC_VERSION.tar.gz" 1 +extract "$OSXCROSS_TARBALL_DIR/gcc-$GCC_VERSION.tar.xz" 1 echo "" pushd gcc*$GCC_VERSION* &>/dev/null @@ -102,14 +102,18 @@ if [ -n "$ENABLE_FORTRAN" ]; then LANGS+=",fortran" fi +if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then + EXTRACONFFLAGS+="--with-multilib-list=m32,m64 --enable-multilib " +else + EXTRACONFFLAGS+="--disable-multilib " +fi + ../configure \ --target=x86_64-apple-$OSXCROSS_TARGET \ --with-sysroot=$OSXCROSS_SDK \ --disable-nls \ --enable-languages=$LANGS \ --without-headers \ - --enable-multilib \ - --with-multilib-list=m32,m64 \ --enable-lto \ --enable-checking=release \ --disable-libstdcxx-pch \ @@ -146,18 +150,21 @@ source tools/tools.sh pushd $OSXCROSS_TARGET_DIR/bin &>/dev/null -if [ ! -f i386-apple-$OSXCROSS_TARGET-base-gcc$EXESUFFIX ]; then - mv x86_64-apple-$OSXCROSS_TARGET-gcc$EXESUFFIX \ - x86_64-apple-$OSXCROSS_TARGET-base-gcc$EXESUFFIX - mv x86_64-apple-$OSXCROSS_TARGET-g++$EXESUFFIX \ - x86_64-apple-$OSXCROSS_TARGET-base-g++$EXESUFFIX +if [ ! -f i386-apple-$OSXCROSS_TARGET-base-gcc ]; then + mv x86_64-apple-$OSXCROSS_TARGET-gcc \ + x86_64-apple-$OSXCROSS_TARGET-base-gcc - create_symlink x86_64-apple-$OSXCROSS_TARGET-base-gcc$EXESUFFIX \ - i386-apple-$OSXCROSS_TARGET-base-gcc$EXESUFFIX + mv x86_64-apple-$OSXCROSS_TARGET-g++ \ + x86_64-apple-$OSXCROSS_TARGET-base-g++ - create_symlink x86_64-apple-$OSXCROSS_TARGET-base-g++$EXESUFFIX \ - i386-apple-$OSXCROSS_TARGET-base-g++$EXESUFFIX + if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then + create_symlink x86_64-apple-$OSXCROSS_TARGET-base-gcc \ + i386-apple-$OSXCROSS_TARGET-base-gcc + + create_symlink x86_64-apple-$OSXCROSS_TARGET-base-g++ \ + i386-apple-$OSXCROSS_TARGET-base-g++ + fi fi echo "compiling wrapper ..." @@ -175,10 +182,12 @@ popd &>/dev/null # wrapper dir echo "" -test_compiler o32-gcc $BASE_DIR/oclang/test.c -test_compiler o64-gcc $BASE_DIR/oclang/test.c +if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then + test_compiler o32-gcc $BASE_DIR/oclang/test.c + test_compiler o32-g++ $BASE_DIR/oclang/test.cpp +fi -test_compiler o32-g++ $BASE_DIR/oclang/test.cpp +test_compiler o64-gcc $BASE_DIR/oclang/test.c test_compiler o64-g++ $BASE_DIR/oclang/test.cpp echo "" diff --git a/build_llvm_dsymutil.sh b/build_llvm_dsymutil.sh index af677f7..eea7685 100755 --- a/build_llvm_dsymutil.sh +++ b/build_llvm_dsymutil.sh @@ -16,27 +16,22 @@ require cmake pushd $OSXCROSS_BUILD_DIR &>/dev/null -if [ ! -e llvm-dsymutil/.clone_complete ]; then - rm -rf llvm-dsymutil - # Vanilla llvm-dsymutil with a few patches on top for OSXCross - git clone https://github.com/tpoechtrager/llvm-dsymutil.git --depth 1 +get_sources https://github.com/tpoechtrager/llvm-dsymutil.git master + +if [ $f_res -eq 1 ]; then + pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null + + mkdir build + pushd build &>/dev/null + + $CMAKE .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \ + -DLLVM_ENABLE_ASSERTIONS=Off + + $MAKE -f tools/dsymutil/Makefile -j$JOBS + cp bin/llvm-dsymutil $OSXCROSS_TARGET_DIR/bin/osxcross-llvm-dsymutil + echo "installed llvm-dsymutil to $OSXCROSS_TARGET_DIR/bin/osxcross-llvm-dsymutil" + + build_success fi - -pushd llvm-dsymutil &>/dev/null - -git clean -fdx -touch .clone_complete -git pull - -mkdir build -pushd build &>/dev/null - -cmake .. \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \ - -DLLVM_ENABLE_ASSERTIONS=Off - -$MAKE -f tools/dsymutil/Makefile -j$JOBS -cp bin/llvm-dsymutil $OSXCROSS_TARGET_DIR/bin/osxcross-llvm-dsymutil - -echo "installed llvm-dsymutil to $OSXCROSS_TARGET_DIR/bin/osxcross-llvm-dsymutil" diff --git a/images/cygwin/compiler-rt/1.png b/images/cygwin/compiler-rt/1.png deleted file mode 100644 index 40acaa3..0000000 Binary files a/images/cygwin/compiler-rt/1.png and /dev/null differ diff --git a/images/cygwin/compiler-rt/2.png b/images/cygwin/compiler-rt/2.png deleted file mode 100644 index ee1e324..0000000 Binary files a/images/cygwin/compiler-rt/2.png and /dev/null differ diff --git a/images/cygwin/compiler-rt/3.png b/images/cygwin/compiler-rt/3.png deleted file mode 100644 index 3fbd8b7..0000000 Binary files a/images/cygwin/compiler-rt/3.png and /dev/null differ diff --git a/images/cygwin/compiler-rt/4.png b/images/cygwin/compiler-rt/4.png deleted file mode 100644 index 4437e41..0000000 Binary files a/images/cygwin/compiler-rt/4.png and /dev/null differ diff --git a/images/cygwin/macports/1.png b/images/cygwin/macports/1.png deleted file mode 100644 index 6400d55..0000000 Binary files a/images/cygwin/macports/1.png and /dev/null differ diff --git a/images/cygwin/macports/2.png b/images/cygwin/macports/2.png deleted file mode 100644 index fada330..0000000 Binary files a/images/cygwin/macports/2.png and /dev/null differ diff --git a/images/cygwin/macports/3.png b/images/cygwin/macports/3.png deleted file mode 100644 index 76478b4..0000000 Binary files a/images/cygwin/macports/3.png and /dev/null differ diff --git a/images/cygwin/macports/4.png b/images/cygwin/macports/4.png deleted file mode 100644 index ccc0fd5..0000000 Binary files a/images/cygwin/macports/4.png and /dev/null differ diff --git a/images/cygwin/macports/5.png b/images/cygwin/macports/5.png deleted file mode 100644 index 6cd0d88..0000000 Binary files a/images/cygwin/macports/5.png and /dev/null differ diff --git a/images/cygwin/macports/6.png b/images/cygwin/macports/6.png deleted file mode 100644 index fed6e13..0000000 Binary files a/images/cygwin/macports/6.png and /dev/null differ diff --git a/images/cygwin/osxcross/2.png b/images/cygwin/osxcross/2.png deleted file mode 100644 index fada330..0000000 Binary files a/images/cygwin/osxcross/2.png and /dev/null differ diff --git a/images/cygwin/osxcross/3.png b/images/cygwin/osxcross/3.png deleted file mode 100644 index 2b2d8a6..0000000 Binary files a/images/cygwin/osxcross/3.png and /dev/null differ diff --git a/images/cygwin/osxcross/5_1.png b/images/cygwin/osxcross/5_1.png deleted file mode 100644 index 1161947..0000000 Binary files a/images/cygwin/osxcross/5_1.png and /dev/null differ diff --git a/images/cygwin/osxcross/5_2.png b/images/cygwin/osxcross/5_2.png deleted file mode 100644 index dc15ce7..0000000 Binary files a/images/cygwin/osxcross/5_2.png and /dev/null differ diff --git a/images/cygwin/osxcross/6.png b/images/cygwin/osxcross/6.png deleted file mode 100644 index 03f9c17..0000000 Binary files a/images/cygwin/osxcross/6.png and /dev/null differ diff --git a/images/cygwin/osxcross/7.png b/images/cygwin/osxcross/7.png deleted file mode 100644 index fada330..0000000 Binary files a/images/cygwin/osxcross/7.png and /dev/null differ diff --git a/images/cygwin/osxcross/8.png b/images/cygwin/osxcross/8.png deleted file mode 100644 index fda9eb1..0000000 Binary files a/images/cygwin/osxcross/8.png and /dev/null differ diff --git a/oclang/test_libcxx.cpp b/oclang/test_libcxx.cpp index a9a0d2b..909c7cf 100644 --- a/oclang/test_libcxx.cpp +++ b/oclang/test_libcxx.cpp @@ -2,6 +2,7 @@ #include #include #include +#include int main() { diff --git a/patches/cctools-ld64-1.patch b/patches/cctools-ld64-1.patch deleted file mode 100644 index f1dd2bf..0000000 --- a/patches/cctools-ld64-1.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ld64/src/3rd/helper_backup.h 2013-02-24 11:26:01.159718369 -0800 -+++ ld64/src/3rd/helper.h 2013-02-24 11:27:22.107716807 -0800 -@@ -1,6 +1,10 @@ - #ifndef _HELPER_H - #define _HELPER_H - -+#ifdef __cplusplus -+extern "C" { -+#endif -+ - #include - #include - #include -@@ -30,4 +34,8 @@ - - uint64_t mach_absolute_time(void); - -+#ifdef __cplusplus -+} -+#endif -+ - #endif diff --git a/patches/cctools-ld64-2.patch b/patches/cctools-ld64-2.patch deleted file mode 100644 index 56c473d..0000000 --- a/patches/cctools-ld64-2.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ld64/src/ld/Snapshot.cpp 2013-10-02 20:08:31.672088145 +0200 -+++ ld64/src/ld/Snapshot.cpp 2013-10-02 20:08:42.330088934 +0200 -@@ -15,7 +15,7 @@ - #include - #include - #include --#include -+#include - - #include "Snapshot.h" - #include "Options.h" diff --git a/patches/compiler-rt_clock-gettime.patch b/patches/compiler-rt_clock-gettime.patch new file mode 100644 index 0000000..3bf3cc6 --- /dev/null +++ b/patches/compiler-rt_clock-gettime.patch @@ -0,0 +1,30 @@ +diff -crB --new-file /home/thomas/tmp/compiler-rt/include/time.h compiler-rt/include/time.h +*** /home/thomas/tmp/compiler-rt/include/time.h 1970-01-01 01:00:00.000000000 +0100 +--- compiler-rt/include/time.h 2019-06-01 15:42:13.006343150 +0200 +*************** +*** 0 **** +--- 1,24 ---- ++ #ifndef __TIME_H_INCLUDE_HACK__ ++ #define __TIME_H_INCLUDE_HACK__ ++ #ifdef __MACH__ ++ /* https://stackoverflow.com/a/17112198/1392778 */ ++ #include_next ++ #include ++ #define CLOCK_REALTIME 0 ++ #define CLOCK_MONOTONIC 0 ++ typedef int clockid_t; ++ static int clock_gettime(clockid_t clk_id, struct timespec *t){ ++ mach_timebase_info_data_t timebase; ++ mach_timebase_info(&timebase); ++ uint64_t time; ++ time = mach_absolute_time(); ++ double nseconds = ((double)time * (double)timebase.numer)/((double)timebase.denom); ++ double seconds = ((double)time * (double)timebase.numer)/((double)timebase.denom * 1e9); ++ t->tv_sec = seconds; ++ t->tv_nsec = nseconds; ++ return 0; ++ } ++ #else ++ #include_next ++ #endif ++ #endif diff --git a/patches/libcxx__hash_table.patch b/patches/libcxx__hash_table.patch new file mode 100644 index 0000000..5f0f743 --- /dev/null +++ b/patches/libcxx__hash_table.patch @@ -0,0 +1,19 @@ +--- a/usr/include/c++/v1/__hash_table 2019-01-10 10:05:42.219730024 +0000 ++++ b/usr/include/c++/v1/__hash_table 2019-01-10 10:09:08.881538038 +0000 +@@ -1164,6 +1164,7 @@ + _NOEXCEPT_( + is_nothrow_default_constructible<__bucket_list>::value && + is_nothrow_default_constructible<__first_node>::value && ++ is_nothrow_default_constructible<__node_allocator>::value && + is_nothrow_default_constructible::value && + is_nothrow_default_constructible::value) + : __p2_(0), +@@ -1232,6 +1233,7 @@ + _NOEXCEPT_( + is_nothrow_move_constructible<__bucket_list>::value && + is_nothrow_move_constructible<__first_node>::value && ++ is_nothrow_move_constructible<__node_allocator>::value && + is_nothrow_move_constructible::value && + is_nothrow_move_constructible::value) + : __bucket_list_(_VSTD::move(__u.__bucket_list_)), + diff --git a/patches/xar-ext2.patch b/patches/xar-ext2.patch deleted file mode 100644 index 1a13d4e..0000000 --- a/patches/xar-ext2.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- lib/ext2.c.orig -+++ lib/ext2.c -@@ -139,8 +139,10 @@ - if(! (flags & ~EXT2_NOCOMPR_FL) ) - x_addprop(f, "NoCompBlock"); - #endif -+#ifdef EXT2_ECOMPR_FL - if(! (flags & ~EXT2_ECOMPR_FL) ) - x_addprop(f, "CompError"); -+#endif - if(! (flags & ~EXT2_BTREE_FL) ) - x_addprop(f, "BTree"); - if(! (flags & ~EXT2_INDEX_FL) ) -@@ -225,8 +227,10 @@ - if( e2prop_get(f, "NoCompBlock", (char **)&tmp) == 0 ) - flags |= EXT2_NOCOMPR_FL ; - #endif -+#ifdef EXT2_ECOMPR_FL - if( e2prop_get(f, "CompError", (char **)&tmp) == 0 ) - flags |= EXT2_ECOMPR_FL ; -+#endif - if( e2prop_get(f, "BTree", (char **)&tmp) == 0 ) - flags |= EXT2_BTREE_FL ; - if( e2prop_get(f, "HashIndexed", (char **)&tmp) == 0 ) diff --git a/patches/xar-netbsd.patch b/patches/xar-netbsd.patch deleted file mode 100644 index b17c27f..0000000 --- a/patches/xar-netbsd.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- lib/linuxattr.c -+++ lib/linuxattr.c -@@ -52,9 +52,7 @@ - #include - #endif - --#ifdef HAVE_SYS_STATFS_H /* Nonexistant future OS needs this */ --#include --#endif -+#include - - #ifdef HAVE_SYS_MOUNT_H - #include -@@ -138,7 +136,7 @@ - #if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LGETXATTR) && !defined(__APPLE__) - char *i, *buf = NULL; - int ret, retval=0, bufsz = 1024; -- struct statfs sfs; -+ struct statvfs sfs; - char *fsname = NULL; - struct _linuxattr_context context; - -@@ -165,8 +163,9 @@ - if( ret == 0 ) goto BAIL; - - memset(&sfs, 0, sizeof(sfs)); -- statfs(file, &sfs); -+ statvfs(file, &sfs); - -+#if 0 - switch(sfs.f_type) { - case EXT3_SUPER_MAGIC: fsname = "ext3"; break; /* assume ext3 */ - case JFS_SUPER_MAGIC: fsname = "jfs" ; break; -@@ -174,6 +173,15 @@ - case XFS_SUPER_MAGIC: fsname = "xfs" ; break; - default: retval=0; goto BAIL; - }; -+#endif -+ -+ fsname = sfs.f_fstypename; -+ -+ if(strcmp(fsname, "ext3") && strcmp(fsname, "jfs") && -+ strcmp(fsname, "reiser") && strcmp(fsname, "xfs")) { -+ retval=0; -+ goto BAIL; -+ } - - for( i=buf; (i-buf) < ret; i += strlen(i)+1 ) { - xar_ea_t e; -@@ -202,7 +210,7 @@ - { - #if defined HAVE_SYS_XATTR_H && defined(HAVE_LSETXATTR) && !defined(__APPLE__) - const char *fsname = "bogus"; -- struct statfs sfs; -+ struct statvfs sfs; - int eaopt = 0; - struct _linuxattr_context context; - xar_prop_t p; -@@ -217,19 +225,31 @@ - /* Check for EA extraction behavior */ - - memset(&sfs, 0, sizeof(sfs)); -- if( statfs(file, &sfs) != 0 ) { -+ if( statvfs(file, &sfs) != 0 ) { - char *tmp, *bname; - tmp = strdup(file); - bname = dirname(tmp); -- statfs(bname, &sfs); -+ statvfs(bname, &sfs); - free(tmp); - } -+#if 0 - switch(sfs.f_type) { - case EXT3_SUPER_MAGIC: fsname = "ext3"; break; /* assume ext3 */ - case JFS_SUPER_MAGIC: fsname = "jfs" ; break; - case REISERFS_SUPER_MAGIC:fsname = "reiser" ; break; - case XFS_SUPER_MAGIC: fsname = "xfs" ; break; - }; -+#endif -+ -+ { -+ const char *pp = fsname; -+ fsname = sfs.f_fstypename; -+ -+ if(strcmp(fsname, "ext3") && strcmp(fsname, "jfs") && -+ strcmp(fsname, "reiser") && strcmp(fsname, "xfs")) { -+ fsname = pp; -+ } -+ } - - for(p = xar_prop_pfirst(f); p; p = xar_prop_pnext(p)) { - const char *fs = NULL; diff --git a/tarballs/.keepme b/tarballs/.keepme new file mode 100644 index 0000000..e69de29 diff --git a/tarballs/cctools-895-ld64-274.2_8e9c3f2.tar.xz b/tarballs/cctools-895-ld64-274.2_8e9c3f2.tar.xz deleted file mode 100644 index ed3ce70..0000000 Binary files a/tarballs/cctools-895-ld64-274.2_8e9c3f2.tar.xz and /dev/null differ diff --git a/tarballs/xar-1.6.1.tar.gz b/tarballs/xar-1.6.1.tar.gz deleted file mode 100644 index 8bace23..0000000 Binary files a/tarballs/xar-1.6.1.tar.gz and /dev/null differ diff --git a/tools/gen_cyglto_dll.sh b/tools/gen_cyglto_dll.sh deleted file mode 100755 index a855d46..0000000 --- a/tools/gen_cyglto_dll.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -# -# Build and install the LTO library, which the Cygwin package of -# libLLVM is lacking. -# - -pushd "${0%/*}/.." &>/dev/null -source tools/tools.sh - -if [[ $PLATFORM != CYGWIN* ]]; then - exit 1 -fi - -LLVM_CONFIG="llvm-config" - -CXXFLAGS="$($LLVM_CONFIG --cxxflags) -fno-PIC" -LDFLAGS="$($LLVM_CONFIG --cxxflags) -Wl,-s" -INCDIR=$($LLVM_CONFIG --includedir) -LIBDIR=$($LLVM_CONFIG --libdir) -LIBS=$($LLVM_CONFIG --libs all) -SYSLIBS="$($LLVM_CONFIG --system-libs) -ledit -lffi" - -VERSION=$($LLVM_CONFIG --version | awk -F \. {'print $1$2'} | sed 's/svn//g') - -set -e -TMP=$(mktemp -d) -set +e - -pushd $TMP &>/dev/null -wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/lto.cpp -wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/LTODisassembler.cpp -wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/lto.exports - -echo "{" > cyglto.exports -echo " global:" >> cyglto.exports -while read p; do - echo " $p;" >> cyglto.exports -done < lto.exports -echo " LLVM*;" >> cyglto.exports -echo " local: *;" >> cyglto.exports -echo "};" >> cyglto.exports - -if [ $ARCH == "x86_64" ]; then - # https://github.com/tpoechtrager/osxcross/issues/91 - mkdir -p llvm/LTO - echo "#undef off_t" > llvm/LTO/LTOModule.h - echo "#define off_t long long" >> llvm/LTO/LTOModule.h - echo "#include_next \"llvm/LTO/LTOModule.h\"" >> llvm/LTO/LTOModule.h - CXXFLAGS="-I $TMP $CXXFLAGS" -fi - -popd &>/dev/null - -set -x - -g++ -shared \ - -L$LIBDIR -I$INCDIR $CXXFLAGS $LDFLAGS \ - $TMP/lto.cpp $TMP/LTODisassembler.cpp -Wl,-version-script,$TMP/cyglto.exports \ - -Wl,--whole-archive $LIBS -Wl,--no-whole-archive $SYSLIBS \ - -o /bin/cygLTO.dll -Wl,--out-implib,/lib/libLTO.dll.a - -rm -rf $TMP - -popd &>/dev/null diff --git a/tools/gen_sdk_package.sh b/tools/gen_sdk_package.sh index 2f9d708..728d34b 100755 --- a/tools/gen_sdk_package.sh +++ b/tools/gen_sdk_package.sh @@ -5,6 +5,69 @@ export LC_ALL=C + +which gnutar &>/dev/null + +if [ $? -eq 0 ]; then + TAR=gnutar +else + TAR=tar +fi + + +if [ -z "$SDK_COMPRESSOR" ]; then + which xz &>/dev/null + + if [ $? -eq 0 ]; then + SDK_COMPRESSOR=xz + SDK_EXT="tar.xz" + else + SDK_COMPRESSOR=bzip2 + SDK_EXT="tar.bz2" + fi +fi + +case $SDK_COMPRESSOR in + "gz") + SDK_COMPRESSOR=gzip + SDK_EXT=".tar.gz" + ;; + "bzip2") + SDK_EXT=".tar.bz2" + ;; + "xz") + SDK_EXT=".tar.xz" + ;; + "zip") + SDK_EXT=".zip" + ;; + *) + echo "error: unknown compressor \"$SDK_COMPRESSOR\"" >&2 + exit 1 +esac + +function compress() +{ + case $SDK_COMPRESSOR in + "zip") + $SDK_COMPRESSOR -q -5 -r - $1 > $2 ;; + *) + tar cf - $1 | $SDK_COMPRESSOR -5 - > $2 ;; + esac +} + + +function rreadlink() +{ + if [ ! -h "$1" ]; then + echo "$1" + else + local link="$(expr "$(command ls -ld -- "$1")" : '.*-> \(.*\)$')" + cd $(dirname $1) + rreadlink "$link" | sed "s|^\([^/].*\)\$|$(dirname $1)/\1|" + fi +} + function set_xcode_dir() { local tmp=$(ls $1 2>/dev/null | grep "^Xcode.*.app" | grep -v "beta" | head -n1) @@ -18,17 +81,18 @@ function set_xcode_dir() fi } + if [ $(uname -s) != "Darwin" ]; then if [ -z "$XCODEDIR" ]; then echo "This script must be run on OS X" 1>&2 echo "... Or with XCODEDIR=... on Linux" 1>&2 exit 1 else - case $XCODEDIR in + case "$XCODEDIR" in /*) ;; *) XCODEDIR="$PWD/$XCODEDIR" ;; esac - set_xcode_dir $XCODEDIR + set_xcode_dir "$XCODEDIR" fi else set_xcode_dir $(echo /Volumes/Xcode* | tr ' ' '\n' | grep -v "beta" | head -n1) @@ -47,7 +111,7 @@ else fi fi -if [ ! -d $XCODEDIR ]; then +if [ ! -d "$XCODEDIR" ]; then echo "cannot find Xcode (XCODEDIR=$XCODEDIR)" 1>&2 exit 1 fi @@ -56,27 +120,9 @@ echo -e "found Xcode: $XCODEDIR" WDIR=$(pwd) -which gnutar &>/dev/null - -if [ $? -eq 0 ]; then - TAR=gnutar -else - TAR=tar -fi - -which xz &>/dev/null - -if [ $? -eq 0 ]; then - COMPRESSOR=xz - PKGEXT="tar.xz" -else - COMPRESSOR=bzip2 - PKGEXT="tar.bz2" -fi - set -e -pushd $XCODEDIR &>/dev/null +pushd "$XCODEDIR" &>/dev/null if [ -d "Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" ]; then pushd "Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" &>/dev/null @@ -97,7 +143,7 @@ else exit 1 fi - pushd $SDKDIR &>/dev/null + pushd "$SDKDIR" &>/dev/null fi fi fi @@ -128,9 +174,11 @@ for SDK in $SDKS; do fi TMP=$(mktemp -d /tmp/XXXXXXXXXXX) - cp -r $SDK $TMP &>/dev/null || true + cp -r $(rreadlink $SDK) $TMP/$SDK &>/dev/null || true - pushd $XCODEDIR &>/dev/null + pushd "$XCODEDIR" &>/dev/null + + mkdir -p $TMP/$SDK/usr/include/c++ # libc++ headers for C++11/C++14 if [ -d $LIBCXXDIR1 ]; then @@ -147,7 +195,7 @@ for SDK in $SDKS; do popd &>/dev/null pushd $TMP &>/dev/null - $TAR -cf - * | $COMPRESSOR -9 -c - > "$WDIR/$SDK.$PKGEXT" + compress "*" "$WDIR/$SDK$SDK_EXT" popd &>/dev/null rm -rf $TMP diff --git a/tools/gen_sdk_package_darling_dmg.sh b/tools/gen_sdk_package_darling_dmg.sh index 8cd23e5..ccabe8b 100755 --- a/tools/gen_sdk_package_darling_dmg.sh +++ b/tools/gen_sdk_package_darling_dmg.sh @@ -24,15 +24,9 @@ fi mkdir -p $BUILD_DIR -require git -require cmake -require $MAKE require modinfo require fusermount -[ -n "$CC" ] && require $CC -[ -n "$CXX" ] && require $CXX - set +e command -v lsb_release 2>&1 > /dev/null @@ -53,41 +47,34 @@ set -e pushd $BUILD_DIR &>/dev/null -if [ ! -f $TARGET_DIR/SDK/tools/bin/darling-dmg ]; then - rm -f have_darling_dmg -fi - -DARLING_DMG_REV="991a1c19d67e30ad1099fc871c4f9e702dd4d489" - -if [ ! -f "have_darling_dmg_$DARLING_DMG_REV" ]; then - -rm -rf darling-dmg* -git clone https://github.com/LubosD/darling-dmg.git -pushd darling-dmg &>/dev/null -git reset --hard $DARLING_DMG_REV -mkdir -p build -pushd build &>/dev/null -cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$TARGET_DIR/SDK/tools -$MAKE -j $JOBS install -popd &>/dev/null -popd &>/dev/null - -touch "have_darling_dmg_$DARLING_DMG_REV" +FULL_CLONE=1 \ + get_sources https://github.com/LubosD/darling-dmg.git master +if [ $f_res -eq 1 ]; then + pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null + git reset --hard 5f64bc9a3795e0a1c307e9beb099f9035fdd864f + mkdir -p build + pushd build &>/dev/null + $CMAKE .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$TARGET_DIR_SDK_TOOLS + $MAKE -j $JOBS install + popd &>/dev/null + popd &>/dev/null + build_success fi popd &>/dev/null # build dir TMP=$(mktemp -d /tmp/XXXXXXXXX) -function cleanup() { +function cleanup() +{ fusermount -u $TMP || true rm -rf $TMP } trap cleanup EXIT -LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TARGET_DIR/SDK/tools/lib \ +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TARGET_DIR_SDK_TOOLS/lib \ $TARGET_DIR/SDK/tools/bin/darling-dmg $1 $TMP XCODEDIR=$TMP ./tools/gen_sdk_package.sh diff --git a/tools/gen_sdk_package_p7zip.sh b/tools/gen_sdk_package_p7zip.sh index 09417f0..8b7dd85 100755 --- a/tools/gen_sdk_package_p7zip.sh +++ b/tools/gen_sdk_package_p7zip.sh @@ -40,55 +40,36 @@ if [ ! -f $TARGET_DIR/SDK/tools/bin/7z ]; then rm -f have_p7zip fi -if [ ! -f "have_p7zip" ]; then -rm -rf p7zip* -git clone https://github.com/tpoechtrager/p7zip.git -pushd p7zip &>/dev/null -if [ -n "$CC" ] && [ -n "$CXX" ]; then - [[ $CC == *clang* ]] && CC="$CC -Qunused-arguments" - [[ $CXX == *clang* ]] && CXX="$CXX -Qunused-arguments" - $MAKE 7z -j $JOBS CC="$CC" CXX="$CXX -std=gnu++03" -else - $MAKE 7z -j $JOBS CXX="c++ -std=gnu++03" -fi -$MAKE install DEST_HOME=$TARGET_DIR/SDK/tools -find $TARGET_DIR/SDK/tools/share -type f -exec chmod 0664 {} \; -find $TARGET_DIR/SDK/tools/share -type d -exec chmod 0775 {} \; -popd &>/dev/null +get_sources https://github.com/tpoechtrager/p7zip.git master -touch "have_p7zip" +if [ $f_res -eq 1 ]; then + pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null + if [ -n "$CC" ] && [ -n "$CXX" ]; then + [[ $CC == *clang* ]] && CC="$CC -Qunused-arguments" + [[ $CXX == *clang* ]] && CXX="$CXX -Qunused-arguments" + $MAKE 7z -j $JOBS CC="$CC" CXX="$CXX -std=gnu++98" + else + $MAKE 7z -j $JOBS CXX="c++ -std=gnu++98" + fi + + $MAKE install DEST_HOME=$TARGET_DIR_SDK_TOOLS + find $TARGET_DIR_SDK_TOOLS/share -type f -exec chmod 0664 {} \; + find $TARGET_DIR_SDK_TOOLS/share -type d -exec chmod 0775 {} \; + popd &>/dev/null + build_success fi popd &>/dev/null -#/tmp is prone to run out of space -#TMP=$(mktemp -d /tmp/XXXXXXXXX) +create_tmp_dir -for i in {1..100}; do - TMP="tmp_$RANDOM" - [ -e $TMP ] && continue - mkdir $TMP && break -done - -if [ ! -d $TMP ]; then - echo "cannot create $PWD/$TMP directory" 1>&2 - exit 1 -fi - -function cleanup() { - popd &>/dev/null || true - rm -rf $TMP -} - -trap cleanup EXIT - -pushd $TMP &>/dev/null +pushd $TMP_DIR &>/dev/null set +e -$TARGET_DIR/SDK/tools/bin/7z x \ +$TARGET_DIR_SDK_TOOLS/bin/7z x \ $XCODEDMG \ "*/Xcode*.app/Contents/Developer/Platforms/MacOSX.platform" \ "*/Xcode*.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain" @@ -96,7 +77,7 @@ $TARGET_DIR/SDK/tools/bin/7z x \ [ $? -ne 0 -a $? -ne 2 ] && exit 1 if [ -z "$(ls -A)" ]; then - $TARGET_DIR/SDK/tools/bin/7z x $XCODEDMG "*/Packages/MacOSX*.pkg" + $TARGET_DIR_SDK_TOOLS/bin/7z x $XCODEDMG "*/Packages/MacOSX*.pkg" [ $? -ne 0 -a $? -ne 2 ] && exit 1 fi @@ -106,5 +87,5 @@ set -e popd &>/dev/null -XCODEDIR="$TMP/$(ls $TMP | grep "code" | head -n1)" \ +XCODEDIR="$TMP_DIR/$(ls $TMP_DIR | grep "code" | head -n1)" \ ./tools/gen_sdk_package.sh diff --git a/tools/gen_sdk_package_pbzx.sh b/tools/gen_sdk_package_pbzx.sh new file mode 100755 index 0000000..8e4fc55 --- /dev/null +++ b/tools/gen_sdk_package_pbzx.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +pushd "${0%/*}/.." &>/dev/null +source tools/tools.sh + +require cpio + +if [ $PLATFORM == "Darwin" ]; then + echo "Use gen_sdk_package.sh on Mac OS X" 1>&2 + exit 1 +fi + +if [ $# -eq 0 ]; then + echo "Usage: $0 " 1>&2 + exit 1 +fi + +mkdir -p $BUILD_DIR +pushd $BUILD_DIR &>/dev/null + +build_xar + +get_sources https://github.com/tpoechtrager/pbzx.git master + +if [ $f_res -eq 1 ]; then + pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null + mkdir -p $TARGET_DIR_SDK_TOOLS/bin + verbose_cmd $CC -I $TARGET_DIR/include -L $TARGET_DIR/lib pbzx.c \ + -o $TARGET_DIR_SDK_TOOLS/bin/pbzx -llzma -lxar \ + -Wl,-rpath,$TARGET_DIR/lib + build_success + popd &>/dev/null +fi + +create_tmp_dir + +pushd $TMP_DIR &>/dev/null + +echo "Extracting $1 (this may take several minutes) ..." + +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TARGET_DIR/lib \ + verbose_cmd "$TARGET_DIR/bin/xar -xf $1 -C $TMP_DIR" + +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TARGET_DIR/lib \ + verbose_cmd "$TARGET_DIR/SDK/tools/bin/pbzx -n Content | cpio -i" + +popd &>/dev/null # TMP_DIR +popd &>/dev/null # BUILD_DIR + +echo "" + +XCODEDIR=$TMP_DIR \ + ./tools/gen_sdk_package.sh diff --git a/tools/osxcross-macports b/tools/osxcross-macports index 46d300f..174d835 100755 --- a/tools/osxcross-macports +++ b/tools/osxcross-macports @@ -83,6 +83,8 @@ case $MACOSX_DEPLOYMENT_TARGET in 10.10* ) OSXVERSION="darwin_14" ;; 10.11* ) OSXVERSION="darwin_15" ;; 10.12* ) OSXVERSION="darwin_16" ;; + 10.13* ) OSXVERSION="darwin_17" ;; + 10.14* ) OSXVERSION="darwin_18" ;; * ) unsupportedDepTarget ;; esac diff --git a/tools/tools.sh b/tools/tools.sh index 3c64477..e536e52 100644 --- a/tools/tools.sh +++ b/tools/tools.sh @@ -7,6 +7,7 @@ BASE_DIR=$PWD TARBALL_DIR=$BASE_DIR/tarballs BUILD_DIR=$BASE_DIR/build TARGET_DIR=$BASE_DIR/target +TARGET_DIR_SDK_TOOLS=$TARGET_DIR/SDK/tools PATCH_DIR=$BASE_DIR/patches SDK_DIR=$TARGET_DIR/SDK @@ -14,71 +15,29 @@ PLATFORM=$(uname -s) ARCH=$(uname -m) SCRIPT=$(basename $0) -if [ -z "$USESYSTEMCOMPILER" ]; then - # Default to gcc on some OSs rather than clang due to either - # libstdc++ issues (clang uses an outdated version on those) - # or some other incompatibilities - - case "$PLATFORM" in - CYGWIN* | DragonFly ) - cc=gcc - cxx=g++ - ;; - OpenBSD ) - cc=egcc - cxx=eg++ - ;; - Darwin ) - cc=clang - cxx=clang++ - ;; - * ) - case "$ARCH" in - arm* ) - cc=gcc - cxx=g++ - ;; - * ) - cc=clang - cxx=clang++ - ;; - esac - ;; - esac - - [ -z "$CC" ] && export CC=$cc - [ -z "$CXX" ] && export CXX=$cxx -elif [ -n "$CC" -o -n "$CXX" ]; then - echo "CC/CXX should not be set, continuing in 5 seconds..." 1>&2 - sleep 5 +if [ $PLATFORM == CYGWIN* ]; then + echo "Cygwin is no longer supported." 1>&2 + exit 1 fi +if [[ $PLATFORM == *BSD ]] || [ $PLATFORM == "DragonFly" ]; then + MAKE=gmake + SED=gsed +else + MAKE=make + SED=sed +fi -# enable debug messages -[ -n "$OCDEBUG" ] && set -x +if [ -z "$CC" ]; then + export CC="clang" +fi -if [[ $SCRIPT != *wrapper/build.sh ]]; then - # how many concurrent jobs should be used for compiling? - if [ -z "$JOBS" ]; then - JOBS=$(tools/get_cpu_count.sh || echo 1) - fi +if [ -z "$CXX" ]; then + export CXX="clang++" +fi - if [ $SCRIPT != "build.sh" -a \ - $SCRIPT != "build_clang.sh" -a \ - $SCRIPT != "mount_xcode_image.sh" -a \ - $SCRIPT != "gen_sdk_package_darling_dmg.sh" -a \ - $SCRIPT != "gen_sdk_package_p7zip.sh" -a \ - $SCRIPT != "gen_cyglto_dll.sh" ]; then - res=$(tools/osxcross_conf.sh) - - if [ $? -ne 0 ]; then - echo -n "you must run ./build.sh first before you can start " - echo "building $DESC" - exit 1 - fi - - eval "$res" - fi +if [ -z "$CMAKE" ]; then + CMAKE="cmake" fi function require() @@ -99,16 +58,95 @@ function require() set -e } -if [[ $PLATFORM == *BSD ]] || [ $PLATFORM == "DragonFly" ]; then - MAKE=gmake - SED=gsed -else - MAKE=make - SED=sed -fi +require $CC +require $CXX require $SED require $MAKE +require $CMAKE +require patch +require gunzip + + +# enable debug messages +[ -n "$OCDEBUG" ] && set -x + +if [[ $SCRIPT != *wrapper/build.sh ]]; then + # how many concurrent jobs should be used for compiling? + if [ -z "$JOBS" ]; then + JOBS=$(tools/get_cpu_count.sh || echo 1) + fi + + if [ $SCRIPT != "build.sh" -a \ + $SCRIPT != "build_clang.sh" -a \ + $SCRIPT != "mount_xcode_image.sh" -a \ + $SCRIPT != "gen_sdk_package_darling_dmg.sh" -a \ + $SCRIPT != "gen_sdk_package_p7zip.sh" -a \ + $SCRIPT != "gen_sdk_package_pbzx.sh" ]; then + res=$(tools/osxcross_conf.sh) + + if [ $? -ne 0 ]; then + echo -n "you must run ./build.sh first before you can start " + echo "building $DESC" + exit 1 + fi + + eval "$res" + fi +fi + + +# find sdk version to use +function guess_sdk_version() +{ + tmp1= + tmp2= + tmp3= + file= + sdk= + guess_sdk_version_result= + sdkcount=$(find -L tarballs/ -type f | grep MacOSX | wc -l) + if [ $sdkcount -eq 0 ]; then + echo no SDK found in 'tarballs/'. please see README.md + exit 1 + elif [ $sdkcount -gt 1 ]; then + sdks=$(find -L tarballs/ -type f | grep MacOSX) + for sdk in $sdks; do echo $sdk; done + echo 'more than one MacOSX SDK tarball found. please set' + echo 'SDK_VERSION environment variable for the one you want' + echo '(for example: SDK_VERSION=10.x [OSX_VERSION_MIN=10.x] ./build.sh)' + exit 1 + else + sdk=$(find -L tarballs/ -type f | grep MacOSX) + tmp2=$(echo ${sdk/bz2/} | $SED s/[^0-9.]//g) + tmp3=$(echo $tmp2 | $SED s/\\\.*$//g) + guess_sdk_version_result=$tmp3 + echo 'found SDK version' $guess_sdk_version_result 'at tarballs/'$(basename $sdk) + fi + if [ $guess_sdk_version_result ]; then + if [ $guess_sdk_version_result = 10.4 ]; then + guess_sdk_version_result=10.4u + fi + fi + export guess_sdk_version_result +} + +# make sure there is actually a file with the given SDK_VERSION +function verify_sdk_version() +{ + sdkv=$1 + for file in tarballs/*; do + if [ -f "$file" ] && [ $(echo $file | grep OSX.*$sdkv) ]; then + echo "verified at "$file + sdk=$file + fi + done + if [ ! $sdk ] ; then + echo cant find SDK for OSX $sdkv in tarballs. exiting + exit + fi +} + function extract() { @@ -147,21 +185,171 @@ function extract() fi } -if [[ $PLATFORM == CYGWIN* ]]; then -function create_symlink() +function cleanup_tmp_dir() { - cp -f $1 $2 + if [ -n "$OC_KEEP_TMP_DIR" ]; then + echo "Not removing $TMP_DIR ..." + return + fi + echo "Removing $TMP_DIR ..." + rm -rf $TMP_DIR +} + +function create_tmp_dir() +{ + mkdir -p $BUILD_DIR + pushd $BUILD_DIR &>/dev/null + local tmp + + for i in {1..100}; do + tmp="tmp_$RANDOM" + [ -e $tmp ] && continue + mkdir $tmp && break + done + + if [ ! -d $tmp ]; then + echo "cannot create $BUILD_DIR/$tmp directory" 1>&2 + exit 1 + fi + + TMP_DIR=$BUILD_DIR/$tmp + trap cleanup_tmp_dir EXIT + + popd &>/dev/null +} + +# f_res=1 = something has changed upstream +# f_res=0 = nothing has changed + +function git_clone_repository +{ + local url=$1 + local branch=$2 + local project_name=$3 + + if [ -n "$TP_OSXCROSS_DEV" ]; then + # copy files from local working directory + rm -rf $project_name + cp -r $TP_OSXCROSS_DEV/$project_name . + if [ -e ${project_name}/.git ]; then + pushd $project_name &>/dev/null + git clean -fdx &>/dev/null + popd &>/dev/null + fi + f_res=1 + return + fi + + if [ ! -d $project_name ]; then + local args="" + if [ -z "$FULL_CLONE" ] && [ $branch == "master" ]; then + args="--depth 1" + fi + git clone $url $args + fi + + pushd $project_name &>/dev/null + + git reset --hard &>/dev/null + git clean -fdx &>/dev/null + git fetch origin + git checkout $branch + git pull origin $branch + + local new_hash=$(git rev-parse HEAD) + local old_hash="" + local hash_file="$BUILD_DIR/.${project_name}_git_hash" + + if [ -f $hash_file ]; then + old_hash=$(cat $hash_file) + fi + + echo -n $new_hash > $hash_file + + if [ "$old_hash" != "$new_hash" ]; then + f_res=1 + else + f_res=0 + fi + + popd &>/dev/null +} + +function get_project_name_from_url() +{ + local url=$1 + local project_name + project_name=$(basename $url) + project_name=${project_name/\.git/} + echo -n $project_name +} + +function build_success() +{ + local project_name=$1 + touch "$BUILD_DIR/.${CURRENT_BUILD_PROJECT_NAME}_build_complete" + unset CURRENT_BUILD_PROJECT_NAME +} + +function build_msg() +{ + echo "" + + if [ $# -eq 2 ]; then + echo "## Building $1 ($2) ##" + else + echo "## Building $1 ##" + fi + + echo "" +} + +# f_res=1 = build the project +# f_res=0 = nothing to do + +function get_sources() +{ + local url=$1 + local branch=$2 + local project_name=$(get_project_name_from_url $url) + local build_complete_file="$BUILD_DIR/.${project_name}_build_complete" + + CURRENT_BUILD_PROJECT_NAME=$project_name + + build_msg $project_name $branch + + if [[ "$SKIP_BUILD" == *$project_name* ]]; then + f_res=0 + return + fi + + git_clone_repository $url $branch $project_name + + if [ $f_res -eq 1 ]; then + rm -f $build_complete_file + f_res=1 + else + # nothing has changed upstream + + if [ -f $build_complete_file ]; then + echo "" + echo "## Nothing to do ##" + echo "" + f_res=0 + else + rm -f $build_complete_file + f_res=1 + fi + fi } -else function create_symlink() { ln -sf $1 $2 } -fi function verbose_cmd() { @@ -169,6 +357,7 @@ function verbose_cmd() eval "$@" } + function test_compiler() { echo -ne "testing $1 ... " @@ -191,5 +380,28 @@ function test_compiler_cxx11() set -e } +## Also used in gen_sdk_package_pbzx.sh ## + +function build_xar() +{ + pushd $BUILD_DIR &>/dev/null + + get_sources https://github.com/tpoechtrager/xar.git master + + if [ $f_res -eq 1 ]; then + pushd $CURRENT_BUILD_PROJECT_NAME/xar &>/dev/null + CFLAGS+=" -w" \ + ./configure --prefix=$TARGET_DIR + $MAKE -j$JOBS + $MAKE install -j$JOBS + popd &>/dev/null + build_success + fi + + popd &>/dev/null +} + + + # exit on error set -e diff --git a/tools/trap_exit.sh b/tools/trap_exit.sh index 023e478..6efadbd 100755 --- a/tools/trap_exit.sh +++ b/tools/trap_exit.sh @@ -18,12 +18,10 @@ function _exit() echo "" echo "exiting with abnormal exit code ($EC)" test -n "$OCDEBUG" || echo "run 'OCDEBUG=1 ./$SCRIPT' to enable debug messages" - declare -f -F remove_locks &>/dev/null && \ - { - echo "removing stale locks..." - remove_locks - } - echo "if it is happening the first time, then just re-run the script" + if [ -n "$CURRENT_BUILD_PROJECT_NAME" ]; then + ## Build failed. Rebuild everything ## + rm -f "build/*_built_successfully" + fi echo "" test $SCRIPT = "build.sh" && check_for_bug_1242300 fi diff --git a/wrapper/build.sh b/wrapper/build.sh index d4d5c92..38fd66d 100755 --- a/wrapper/build.sh +++ b/wrapper/build.sh @@ -9,19 +9,34 @@ set +e if [ -z "$OSXCROSS_VERSION" ]; then eval $(../target/bin/osxcross-conf 2>/dev/null) - if [ -n "$OSXCROSS_SDK_VERSION" ] && - [ $(osxcross-cmp $OSXCROSS_SDK_VERSION ">=" 10.8) -eq 1 ]; then - X86_64H_SUPPORTED=1 + if [ -n "$OSXCROSS_SDK_VERSION" ]; then + if [ -z "$X86_64H_SUPPORTED" ]; then + if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION ">=" 10.8) -eq 1 ]; then + X86_64H_SUPPORTED=1 + else + X86_64H_SUPPORTED=0 + fi + fi + if [ -z "$I386_SUPPORTED" ]; then + if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then + I386_SUPPORTED=1 + else + I386_SUPPORTED=0 + fi + fi fi fi set -e -if [[ $PLATFORM == CYGWIN* ]]; then - EXESUFFIX=".exe" -else - EXESUFFIX="" +if [ -z "$I386_SUPPORTED" ]; then + I386_SUPPORTED=1 fi +if [ -z "$X86_64H_SUPPORTED" ]; then + X86_64H_SUPPORTED=0 +fi + + function create_wrapper_link { # arg 1: @@ -40,32 +55,37 @@ function create_wrapper_link # -> x86_64h-apple-darwinXX-osxcross if [ $# -ge 2 ] && [ $2 -eq 1 ]; then - verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \ - "${1}${EXESUFFIX}" + verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \ + "${1}" fi - verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \ - "i386-apple-${OSXCROSS_TARGET}-${1}${EXESUFFIX}" + if [ $I386_SUPPORTED -eq 1 ]; then + verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \ + "i386-apple-${OSXCROSS_TARGET}-${1}" + fi - verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \ - "x86_64-apple-${OSXCROSS_TARGET}-${1}${EXESUFFIX}" + verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \ + "x86_64-apple-${OSXCROSS_TARGET}-${1}" - if [ -n "$X86_64H_SUPPORTED" ] && [ $X86_64H_SUPPORTED -eq 1 ] && + if [ $X86_64H_SUPPORTED -eq 1 ] && ([[ $1 != gcc* ]] && [[ $1 != g++* ]] && [[ $1 != *gstdc++ ]]); then - verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \ - "x86_64h-apple-${OSXCROSS_TARGET}-${1}${EXESUFFIX}" + verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \ + "x86_64h-apple-${OSXCROSS_TARGET}-${1}" fi if [ $# -ge 2 ] && [ $2 -eq 2 ]; then - verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \ - "o32-${1}${EXESUFFIX}" - verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \ - "o64-${1}${EXESUFFIX}" + if [ $I386_SUPPORTED -eq 1 ]; then + verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \ + "o32-${1}" + fi - if [ -n "$X86_64H_SUPPORTED" ] && [ $X86_64H_SUPPORTED -eq 1 ] && + verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \ + "o64-${1}" + + if [ $X86_64H_SUPPORTED -eq 1 ] && ([[ $1 != gcc* ]] && [[ $1 != g++* ]] && [[ $1 != *gstdc++ ]]); then - verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \ - "o64h-${1}${EXESUFFIX}" + verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \ + "o64h-${1}" fi fi } @@ -123,7 +143,7 @@ if [ -n "$BWCOMPILEONLY" ]; then exit 0 fi -verbose_cmd mv wrapper "${TARGET_DIR}/bin/${TARGETTRIPLE}-wrapper${EXESUFFIX}" +verbose_cmd mv wrapper "${TARGET_DIR}/bin/${TARGETTRIPLE}-wrapper" pushd "../target/bin" &>/dev/null diff --git a/wrapper/programs/dsymutil.cpp b/wrapper/programs/dsymutil.cpp index 47e5a04..558fd07 100644 --- a/wrapper/programs/dsymutil.cpp +++ b/wrapper/programs/dsymutil.cpp @@ -61,9 +61,10 @@ int dsymutil(int argc, char **argv, Target &target) { debug = 1; } else { if (!realPath("osxcross-llvm-dsymutil", dsymutil) && - !realPath("llvm-dsymutil", dsymutil)) { + !realPath("llvm-dsymutil", dsymutil) && + !realPath("dsymutil", dsymutil)) { if (debug) - dbg << "dsymutil: cannot find [osxcross-]llvm-dsymutil in PATH" + dbg << "dsymutil: cannot find [osxcross-][llvm-]dsymutil in PATH" << dbg.endl(); return 0; } @@ -89,9 +90,7 @@ int dsymutil(int argc, char **argv, Target &target) { } LLVMDsymutilVersionStr += constexprStrLen("LLVM version "); - LLVMDsymutilVersion = parseLLVMVersion(LLVMDsymutilVersionStr); - constexpr LLVMVersion RequiredLLVMDsymutilVersion(3, 8); if (LLVMDsymutilVersion < RequiredLLVMDsymutilVersion) { diff --git a/wrapper/target.cpp b/wrapper/target.cpp index a4f18b5..d2e105c 100644 --- a/wrapper/target.cpp +++ b/wrapper/target.cpp @@ -228,12 +228,13 @@ bool Target::hasLibCXX() const { return getSDKOSNum() >= OSVersion(10, 7); } bool Target::libCXXIsDefaultCXXLib() const { OSVersion OSNum = this->OSNum; + OSVersion SDKOSNum = getSDKOSNum(); if (!OSNum.Num()) - OSNum = getSDKOSNum(); + OSNum = SDKOSNum; return stdlib != libstdcxx && hasLibCXX() && !isGCC() && - OSNum >= OSVersion(10, 9); + (OSNum >= OSVersion(10, 9) || SDKOSNum >= OSVersion(10, 14)); } bool Target::isCXX() { @@ -506,14 +507,18 @@ bool Target::setup() { if (!OSNum.Num()) { if (haveArch(Arch::x86_64h)) { - OSNum = OSVersion(10, 8); // Default to 10.8 for x86_64h + // Default to >= 10.8 for x86_64h + OSVersion defaultMinTarget = getDefaultMinTarget(); + std::max(defaultMinTarget, OSVersion(10, 8)); if (SDKOSNum < OSNum) { err << "'" << getArchName(arch) << "' requires Mac OS X SDK " << OSNum.shortStr() << " (or later)" << err.endl(); return false; } } else if (stdlib == StdLib::libcxx) { - OSNum = OSVersion(10, 7); // Default to 10.7 for libc++ + // Default to >= 10.7 for libc++ + OSVersion defaultMinTarget = getDefaultMinTarget(); + OSNum = std::max(defaultMinTarget, OSVersion(10, 7)); } else { OSNum = getDefaultMinTarget(); } @@ -550,6 +555,20 @@ bool Target::setup() { } } + if (SDKOSNum >= OSVersion(10, 14)) { + if (!isGCC() && !usegcclibs && stdlib == StdLib::libstdcxx) { + err << "Mac OS X SDK '>= 10.14' does not support libstdc++ anymore" + << err.endl(); + return false; + } + + if (haveArch(Arch::i386)) { + err << "Mac OS X SDK '>= 10.14' does not support i386 anymore" + << err.endl(); + return false; + } + } + if (OSNum > SDKOSNum) { err << "targeted OS X version must be <= " << SDKOSNum.Str() << " (SDK)" << err.endl(); @@ -702,7 +721,10 @@ bool Target::setup() { if (!isGCH()) { fargs.push_back("-lc"); fargs.push_back("-lc++"); - fargs.push_back("-lgcc_s.10.5"); + if (SDKOSNum <= OSVersion(10, 13)) { + // SDK 10.14 does not have -lgcc_s anymore + fargs.push_back("-lgcc_s.10.5"); + } } } else if (stdlib != StdLib::libcxx && !isGCH() && !getenv("OSXCROSS_GCC_NO_STATIC_RUNTIME")) {