Skip to content

Instantly share code, notes, and snippets.

@RedenticDev
Last active April 24, 2024 11:12
Show Gist options
  • Save RedenticDev/e2924d0169bd139545ac851f9ebd2c1f to your computer and use it in GitHub Desktop.
Save RedenticDev/e2924d0169bd139545ac851f9ebd2c1f to your computer and use it in GitHub Desktop.

Revisions

  1. RedenticDev revised this gist Feb 24, 2022. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions Explanations.md
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,8 @@ This method consists on swapping the Xcode 12 toolchain with the one of Xcode 11
    2) If you have Xcode 11 installed too, go to `Xcode 12 › Xcode › Preferences › Locations › Command Line Tools` and change to Xcode 11.x in the dropdown menu.

    ### Method 2: forced compilation (do that!)
    Although [it's not recommended by theos maintainers](https://github.com/theos/theos/issues/563#issuecomment-787538097), it works well and is less constraining that switching between Xcode installations. To proceed, add this in your tweak's Makefile:
    Although [it's not recommended by theos maintainers](https://github.com/theos/theos/issues/563#issuecomment-787538097), it works well and is less constraining that switching between Xcode installations (which it not even possible anymore with Apple Silicon Macs). If you cannot get Xcode 11, download [its toolchain here](https://github.com/nahtedetihw/Xcode11Toolchain).
    To proceed, add this in your tweak's Makefile:
    ```bash
    PREFIX="/path/to/xcode-11-xctoolchain/usr/bin/"
    ```
    @@ -49,4 +50,5 @@ _**Disclaimer: I may be not perfectly exact on the terms I use, correct me if I'
    _Update 1: clarified a bit, added double slices part, fixed typo_
    _Update 2: fixed link_
    _Update 3: rollback to previous system, bye "double slices"!_
    _Update 4: mentioned "the best" solution, improved some points_
    _Update 4: mentioned "the best" solution, improved some points_
    _Update 5: add mention of M1 Macs and link to Xcode 11 toolchain_
  2. RedenticDev revised this gist Apr 11, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Explanations.md
    Original file line number Diff line number Diff line change
    @@ -48,5 +48,5 @@ _**Disclaimer: I may be not perfectly exact on the terms I use, correct me if I'

    _Update 1: clarified a bit, added double slices part, fixed typo_
    _Update 2: fixed link_
    _Update 3: rollback to previous system, bye "double slices"!_
    _Update 4: mentioned "the best" solution, improved some points_
    _Update 3: rollback to previous system, bye "double slices"!_
    _Update 4: mentioned "the best" solution, improved some points_
  3. RedenticDev revised this gist Apr 11, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Explanations.md
    Original file line number Diff line number Diff line change
    @@ -48,4 +48,5 @@ _**Disclaimer: I may be not perfectly exact on the terms I use, correct me if I'

    _Update 1: clarified a bit, added double slices part, fixed typo_
    _Update 2: fixed link_
    _Update 3: rollback to previous system, bye "double slices"!_
    _Update 3: rollback to previous system, bye "double slices"!_
    _Update 4: mentioned "the best" solution, improved some points_
  4. RedenticDev revised this gist Apr 11, 2021. 1 changed file with 12 additions and 5 deletions.
    17 changes: 12 additions & 5 deletions Explanations.md
    Original file line number Diff line number Diff line change
    @@ -20,22 +20,29 @@ This method consists on swapping the Xcode 12 toolchain with the one of Xcode 11
    2) If you have Xcode 11 installed too, go to `Xcode 12 › Xcode › Preferences › Locations › Command Line Tools` and change to Xcode 11.x in the dropdown menu.

    ### Method 2: forced compilation (do that!)
    Add this in your tweak's Makefile:
    Although [it's not recommended by theos maintainers](https://github.com/theos/theos/issues/563#issuecomment-787538097), it works well and is less constraining that switching between Xcode installations. To proceed, add this in your tweak's Makefile:
    ```bash
    PREFIX="[path-to-xcode-11-xctoolchain]/usr/bin/"
    PREFIX="/path/to/xcode-11-xctoolchain/usr/bin/"
    ```
    **OR**
    compile your tweak like this:
    ```bash
    make package PREFIX="[path-to-xcode-11-xctoolchain]/usr/bin/"
    make package PREFIX="/path/to/xcode-11-xctoolchain/usr/bin/"
    ```

    ### Method 3: Xcode 11 + 12
    Painful and only for Intel Macs, but the best solution according to @kabiroberai. Depending on your configuration/available storage, you can:
    - Stay with Xcode 11 and don't update
    - Use Xcode 11 as main but sideload Xcode 12 for other purposes (thanks to [this awesome tool](https://github.com/RobotsAndPencils/XcodesApp))
    - Use Xcode 12 as main **but** switch installations each time you want to compile for arm64e too (similar to above): `sudo xcode-select -s /path/to/Xcode_11.app`, `make package`, then again `sudo xcode-select -s /path/to/Xcode_12.app`

    ## Double-sliced packages (useless, ignore it)
    Waiting for the fix within [theos](https://github.com/theos/theos) to support both arm64e slices in only one package, there is a "bypass" available to create this type of package. To do so, simply [use opa334's script to compile your code](https://github.com/opa334/CCSupport/blob/master/plipo_package.sh) with the [patched lipo binary by Matchstic](https://www.dropbox.com/s/6h85hlc4sm14zeg/lipo?dl=0) (called `plipo`).

    ## Sources
    [This Twitter thread](https://twitter.com/elihweilrahc13/status/1344126498777812992), devs feedbacks and my observations (and [my pain](https://www.reddit.com/r/jailbreakdevelopers/comments/kr2fmq/arm64e_broken_again/)).
    [This update](https://twitter.com/opa334dev/status/1365018957107888130?s=20) from @opa334, thanks to @sbingner.
    - [This Twitter thread](https://twitter.com/elihweilrahc13/status/1344126498777812992), devs feedbacks and my observations (and [my pain](https://www.reddit.com/r/jailbreakdevelopers/comments/kr2fmq/arm64e_broken_again/)).
    - [This update](https://twitter.com/opa334dev/status/1365018957107888130?s=20) from @opa334, thanks to @sbingner.
    - [theos opened issue](https://github.com/theos/theos/issues/563)

    _**Disclaimer: I may be not perfectly exact on the terms I use, correct me if I'm wrong!**_

  5. RedenticDev revised this gist Mar 4, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Explanations.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # What's the problem?
    Since June, 22th 2020, Apple released Xcode 12, that introduced an internal change to Xcode, breaking arm64e compilation for tweak developers. This is due to the update of clang/LLVM (AFAIK) in Xcode 12.
    Since June, 22nd 2020, Apple released Xcode 12, that introduced an internal change to Xcode, breaking arm64e compilation for tweak developers. This is due to the update of clang/LLVM (AFAIK) in Xcode 12.

    ## Details of the problem
    More specifically:
  6. RedenticDev revised this gist Feb 25, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Explanations.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ This method consists on swapping the Xcode 12 toolchain with the one of Xcode 11
    1) Execute the script below (please take a look at it and change variables as needed) if your setup is similar to mine.
    2) If you have Xcode 11 installed too, go to `Xcode 12 › Xcode › Preferences › Locations › Command Line Tools` and change to Xcode 11.x in the dropdown menu.

    ### Method 2: forced complation (do that!)
    ### Method 2: forced compilation (do that!)
    Add this in your tweak's Makefile:
    ```bash
    PREFIX="[path-to-xcode-11-xctoolchain]/usr/bin/"
    @@ -39,6 +39,6 @@ Waiting for the fix within [theos](https://github.com/theos/theos) to support bo

    _**Disclaimer: I may be not perfectly exact on the terms I use, correct me if I'm wrong!**_

    _Update 1: clarified a bit, added double slices part, fixed typo_
    _Update 2: fixed link_
    _Update 1: clarified a bit, added double slices part, fixed typo_
    _Update 2: fixed link_
    _Update 3: rollback to previous system, bye "double slices"!_
  7. RedenticDev revised this gist Feb 25, 2021. 2 changed files with 18 additions and 12 deletions.
    24 changes: 15 additions & 9 deletions Explanations.md
    Original file line number Diff line number Diff line change
    @@ -3,36 +3,42 @@ Since June, 22th 2020, Apple released Xcode 12, that introduced an internal chan

    ## Details of the problem
    More specifically:
    - compiling code for arm64e with Xcode 11 Toolchain will allow this code to run _only on iOS 13 and lower_.
    - compiling code for arm64e with Xcode 11 Toolchain will allow this code to run ~~_only on iOS 13 and lower_~~ **for all versions!**.
    - compiling code for arm64e with Xcode 12 Toolchain will allow this code to run _only for iOS 14 (and up)_.

    **In both case, no error is produced during compilation. arm64 slices are not concerned and will always work.**
    **No error is produced during compilation. arm64 slices are not concerned and will always work.**

    ## Why does this annoy us and not others?
    Apps and other "classic" stuff is not impacted by this change, because these only need to compile for arm64, which is not impacted by this change. Only IPAs, debs, and "system" stuff that _needs_ to be compiled in arm64e is impacted.
    Apps and other "classic" stuff are not impacted by this change, because they only need to be compiled for arm64, which is not impacted by this change. Only IPAs, debs, and "system" stuff that _need_ to be compiled for arm64e are impacted.

    ## Workarounds
    Methods to allow arm64e compiling. Tested on macOS Catalina & Big Sur.
    ### Method 1: bypass _(deprecated)_

    ### Method 1: bypass _**(deprecated and not recommended)**_
    This method consists on swapping the Xcode 12 toolchain with the one of Xcode 11:
    1) Execute the script below (please take a look at it and change variables as needed) if your setup is similar to mine.
    2) If you have Xcode 11 installed too, go to `Xcode 12 › Xcode › Preferences › Locations › Command Line Tools` and change to Xcode 11.x in the dropdown menu.

    ### Method 2: forced complation
    ### Method 2: forced complation (do that!)
    Add this in your tweak's Makefile:
    ```bash
    PREFIX="[path-to-xcode-11-xctoolchain]/usr/bin/"
    ```
    **OR**
    **OR**
    compile your tweak like this:
    ```bash
    make package PREFIX="[path-to-xcode-11-xctoolchain]/usr/bin/"
    ```

    ## Double-sliced packages
    ## Double-sliced packages (useless, ignore it)
    Waiting for the fix within [theos](https://github.com/theos/theos) to support both arm64e slices in only one package, there is a "bypass" available to create this type of package. To do so, simply [use opa334's script to compile your code](https://github.com/opa334/CCSupport/blob/master/plipo_package.sh) with the [patched lipo binary by Matchstic](https://www.dropbox.com/s/6h85hlc4sm14zeg/lipo?dl=0) (called `plipo`).

    ## Sources
    [This Twitter thread](https://twitter.com/elihweilrahc13/status/1344126498777812992), devs feedbacks and my observations (and [my pain](https://www.reddit.com/r/jailbreakdevelopers/comments/kr2fmq/arm64e_broken_again/)).
    [This Twitter thread](https://twitter.com/elihweilrahc13/status/1344126498777812992), devs feedbacks and my observations (and [my pain](https://www.reddit.com/r/jailbreakdevelopers/comments/kr2fmq/arm64e_broken_again/)).
    [This update](https://twitter.com/opa334dev/status/1365018957107888130?s=20) from @opa334, thanks to @sbingner.

    _**Disclaimer: I may be not perfectly exact on the terms I use, correct me if I'm wrong!**_

    _**Disclaimer: I may be not perfectly exact on the terms I use, correct me if I'm wrong!**_
    _Update 1: clarified a bit, added double slices part, fixed typo_
    _Update 2: fixed link_
    _Update 3: rollback to previous system, bye "double slices"!_
    6 changes: 3 additions & 3 deletions install_xcode11_toolchain.sh
    Original file line number Diff line number Diff line change
    @@ -7,21 +7,21 @@

    # beginning of setup variables
    XCODE12PATH=/Applications/Xcode.app/Contents/Developer/Toolchains # path of your Xcode 12 Toolchains folder
    XCODE11PATH=/Applications/Xcode\ 11.x.app/Contents/Developer/Toolchains # path of your Xcode 11.x Toolchains folder
    XCODE11PATH=$(THEOS)/toolchains # path of your Xcode 11.x Toolchain
    # end of setup

    VERSION=$(/usr/bin/xcodebuild -version | grep Xcode | cut -d' ' -f2)
    TOOLCHAIN_SOURCE=Xcode11Toolchain
    echo ">> Listing toolchains"
    ls $XCODEPATH
    ls $XCODE12PATH
    read -rp "Press enter to continue (Ctrl+C to leave)..."
    cd || exit 1
    echo ">> Cleaning up..."
    [ -d Xcode11Toolchain ] && rm -rf Xcode11Toolchain
    echo "Import from:"
    select yn in "Local" "Online"; do
    case $yn in
    "Local" ) # DON'T USE IF YOU HAVE ONLY XCODE 12 INSTALLED
    "Local" ) # DON'T USE IF YOU ONLY HAVE XCODE 12 INSTALLED
    TOOLCHAIN_SOURCE=$XCODE11PATH
    break;;
    "Online" )
  8. RedenticDev revised this gist Feb 20, 2021. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion Explanations.md
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ This method consists on swapping the Xcode 12 toolchain with the one of Xcode 11
    1) Execute the script below (please take a look at it and change variables as needed) if your setup is similar to mine.
    2) If you have Xcode 11 installed too, go to `Xcode 12 › Xcode › Preferences › Locations › Command Line Tools` and change to Xcode 11.x in the dropdown menu.

    ### Method 2: forced complation (theos only)
    ### Method 2: forced complation
    Add this in your tweak's Makefile:
    ```bash
    PREFIX="[path-to-xcode-11-xctoolchain]/usr/bin/"
    2 changes: 1 addition & 1 deletion install_xcode11_toolchain.sh
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@ select yn in "Local" "Online"; do
    break;;
    "Online" )
    echo ">> Downloading Xcode 11 Toolchain...";
    git clone https://github.com/RedenticDev/Xcode11Toolchain;
    git clone https://github.com/nahtedetihw/Xcode11Toolchain;
    break;;
    esac
    done
  9. RedenticDev revised this gist Feb 20, 2021. 1 changed file with 10 additions and 7 deletions.
    17 changes: 10 additions & 7 deletions Explanations.md
    Original file line number Diff line number Diff line change
    @@ -1,34 +1,37 @@
    # What is the problem
    # What's the problem?
    Since June, 22th 2020, Apple released Xcode 12, that introduced an internal change to Xcode, breaking arm64e compilation for tweak developers. This is due to the update of clang/LLVM (AFAIK) in Xcode 12.

    ## Details of the problem
    More specifically:
    - compiling something for arm64e with Xcode 11 will allow this code to run _only on iOS 13 and lower_.
    - compiling something for arm64e with Xcode 12 will allow this code to run _only for iOS 14 (and up)_.
    - compiling code for arm64e with Xcode 11 Toolchain will allow this code to run _only on iOS 13 and lower_.
    - compiling code for arm64e with Xcode 12 Toolchain will allow this code to run _only for iOS 14 (and up)_.

    **In both case, no error is produced during compilation.**
    **In both case, no error is produced during compilation. arm64 slices are not concerned and will always work.**

    ## Why does this annoy us and not others?
    Apps and other "classic" stuff is not impacted by this change, because these only need to compile for arm64, which is not impacted by this change. Only IPAs, debs, and "system" stuff that _needs_ to be compiled in arm64e is impacted.

    ## Workarounds
    Methods to allow arm64e compiling. Tested on macOS Catalina & Big Sur.
    ### Method 1: bypass
    ### Method 1: bypass _(deprecated)_
    This method consists on swapping the Xcode 12 toolchain with the one of Xcode 11:
    1) Execute the script below (please take a look at it and change variables as needed) if your setup is similar to mine.
    2) If you have Xcode 11 installed too, go to `Xcode 12 › Xcode › Preferences › Locations › Command Line Tools` and change to Xcode 11.x in the dropdown menu.

    ### Method 2: forced complation (theos only)
    Add this in your tweak's Makefile:
    ```bash
    PREFIX="[path-to-your-good-xctoolchain]/usr/bin/"
    PREFIX="[path-to-xcode-11-xctoolchain]/usr/bin/"
    ```
    **OR**
    compile your tweak like this:
    ```bash
    make package PREFIX="[path-to-your-good-xctoolchain]/usr/bin/"
    make package PREFIX="[path-to-xcode-11-xctoolchain]/usr/bin/"
    ```

    ## Double-sliced packages
    Waiting for the fix within [theos](https://github.com/theos/theos) to support both arm64e slices in only one package, there is a "bypass" available to create this type of package. To do so, simply [use opa334's script to compile your code](https://github.com/opa334/CCSupport/blob/master/plipo_package.sh) with the [patched lipo binary by Matchstic](https://www.dropbox.com/s/6h85hlc4sm14zeg/lipo?dl=0) (called `plipo`).

    ## Sources
    [This Twitter thread](https://twitter.com/elihweilrahc13/status/1344126498777812992), devs feedbacks and my observations (and [my pain](https://www.reddit.com/r/jailbreakdevelopers/comments/kr2fmq/arm64e_broken_again/)).

  10. RedenticDev created this gist Jan 6, 2021.
    35 changes: 35 additions & 0 deletions Explanations.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    # What is the problem
    Since June, 22th 2020, Apple released Xcode 12, that introduced an internal change to Xcode, breaking arm64e compilation for tweak developers. This is due to the update of clang/LLVM (AFAIK) in Xcode 12.

    ## Details of the problem
    More specifically:
    - compiling something for arm64e with Xcode 11 will allow this code to run _only on iOS 13 and lower_.
    - compiling something for arm64e with Xcode 12 will allow this code to run _only for iOS 14 (and up)_.

    **In both case, no error is produced during compilation.**

    ## Why does this annoy us and not others?
    Apps and other "classic" stuff is not impacted by this change, because these only need to compile for arm64, which is not impacted by this change. Only IPAs, debs, and "system" stuff that _needs_ to be compiled in arm64e is impacted.

    ## Workarounds
    Methods to allow arm64e compiling. Tested on macOS Catalina & Big Sur.
    ### Method 1: bypass
    This method consists on swapping the Xcode 12 toolchain with the one of Xcode 11:
    1) Execute the script below (please take a look at it and change variables as needed) if your setup is similar to mine.
    2) If you have Xcode 11 installed too, go to `Xcode 12 › Xcode › Preferences › Locations › Command Line Tools` and change to Xcode 11.x in the dropdown menu.

    ### Method 2: forced complation (theos only)
    Add this in your tweak's Makefile:
    ```bash
    PREFIX="[path-to-your-good-xctoolchain]/usr/bin/"
    ```
    **OR**
    compile your tweak like this:
    ```bash
    make package PREFIX="[path-to-your-good-xctoolchain]/usr/bin/"
    ```

    ## Sources
    [This Twitter thread](https://twitter.com/elihweilrahc13/status/1344126498777812992), devs feedbacks and my observations (and [my pain](https://www.reddit.com/r/jailbreakdevelopers/comments/kr2fmq/arm64e_broken_again/)).

    _**Disclaimer: I may be not perfectly exact on the terms I use, correct me if I'm wrong!**_
    40 changes: 40 additions & 0 deletions install_xcode11_toolchain.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    #!/bin/sh
    # This script swaps the Xcode 12 toolchain with the one of Xcode 11.

    # Xcode 11.x is required for the "local" option. Tested on Catalina & Big Sur.

    # DISCLAIMER: Use this at your own risks.

    # beginning of setup variables
    XCODE12PATH=/Applications/Xcode.app/Contents/Developer/Toolchains # path of your Xcode 12 Toolchains folder
    XCODE11PATH=/Applications/Xcode\ 11.x.app/Contents/Developer/Toolchains # path of your Xcode 11.x Toolchains folder
    # end of setup

    VERSION=$(/usr/bin/xcodebuild -version | grep Xcode | cut -d' ' -f2)
    TOOLCHAIN_SOURCE=Xcode11Toolchain
    echo ">> Listing toolchains"
    ls $XCODEPATH
    read -rp "Press enter to continue (Ctrl+C to leave)..."
    cd || exit 1
    echo ">> Cleaning up..."
    [ -d Xcode11Toolchain ] && rm -rf Xcode11Toolchain
    echo "Import from:"
    select yn in "Local" "Online"; do
    case $yn in
    "Local" ) # DON'T USE IF YOU HAVE ONLY XCODE 12 INSTALLED
    TOOLCHAIN_SOURCE=$XCODE11PATH
    break;;
    "Online" )
    echo ">> Downloading Xcode 11 Toolchain...";
    git clone https://github.com/RedenticDev/Xcode11Toolchain;
    break;;
    esac
    done
    echo ">> Swapping toolchains and importing the Xcode 11 one..."
    sudo mv $XCODE12PATH/XcodeDefault.xctoolchain $XCODE12PATH/XcodeDefault-"${VERSION}".xctoolchain
    sudo cp -r "$TOOLCHAIN_SOURCE"/XcodeDefault.xctoolchain $XCODE12PATH
    if [ -d Xcode11Toolchain ]; then
    echo ">> Removing downloaded files..."
    rm -rf Xcode11Toolchain
    fi
    echo "Done."