Dealing with UE 4.27 build errors after upgrading to macOS Ventura 13.3.1

karlphillip
Thu, 20 Apr 2023 01:11:00 +0000
Platform & Builds

After upgrading to macOS Ventura 13.3.1 and being forced to install the new Xcode 14.3, all my UE projects started to produce the following error during build:

NameTypes.h:536:10: error: use of bitwise ‘&’ with boolean operands [-Werror,-Wbitwise-instead-of-logical]

The solution to this problem is two part:

First, downgrade Xcode 14.3 to Xcode 13.4.1;

Second, edit the project’s *.target.cs to disable the compiler flag -Wunused-but-set-variable;

Step 1: downgrade Xcode to 13.4.1

This version can be downloaded from: https://xcodereleases.com/

Once downloaded, go to your Downloads folder and double-click Xcode_13.4.1.xip to extract it to Xcode.app;

When the extraction process finishes, open the Terminal and cd to your Downloads folder and rename Xcode.app to Xcode13.4.1.app;
cd ~/Downloads
mv Xcode.app Xcode13.4.1.app

Next, move it into the Applications folder;
mv ~/Downloads/Xcode13.4.1.app /Applications

Make sure Xcode command line tools points to this older version of Xcode:
sudo xcode-select -s /Applications/Xcode13.4.1.app/Contents/Developer/

Finally, you can open Xcode 13.4.1 using the cmd-line by running:
open /Applications/Xcode13.4.1.app/Contents/MacOS/Xcode

Since its annoying to have to use the previous command every time you want to open this version of Xcode, it is possible to set it as the default version using the script shared on this answer;

Step 2: edit the project’s *.target.cs files

At this point, building UE projects that have custom C++ code will generate the following error:

Material.h:1279:26: error: variable 'LayerNames' set but not used [-Werror,-Wunused-but-set-variable]

To solve this issue, simply edit both Source/*.Target.cs files and add these lines:

// fix error: "variable 'LayerNames' set but not used"
bOverrideBuildEnvironment = true;
AdditionalCompilerArguments = "-Wno-unused-but-set-variable";

4 posts - 4 participants