Variable '~' set but not used errors, while building source code in Xcode

Hi! So I tried to follow strictly by these 2 tutorials as for running source code of ue4 on mac and I’ve encountered several issues.

First of all steps show the files or options that seem to be absent from the folder/project.
Second, I encounter a lot of errors trying to build the project according to the tutorial. Most of errors are like this:
Variable ‘~’ set but not used

Like
Variable ‘bHasPendingSlot’ set but not used
Variable ‘MallocCrashOverhead’ set but not used
Variable ‘ForceCompileFloat’ set but not used

I ran the project on mac with m1 chip.

Please tell if this tutorial is not up to date or I can fix something.

1 Like

I’m having the same problem. I am using XCode 13.3 on an M1 Mac running Monterey 12.3.
After following this thread, I figured out that we must add the following to the compiler.

-Wno-unused-but-set-variable

To do that, open

/UnrealEngine/Engine/Source/Programs/UnrealBuildTool/Platform/Mac/MacToolChain.cs

and in the GetCompileArguments_Global function, add in the following line after the Result variable has been declared.

Result += " -Wno-unused-but-set-variable";

After that, XCode will no longer complain about the variables not being set, however I am now stuck with the following:

/UnrealEngine/Engine/Plugins/Media/ElectraPlayer/Source/ElectraPlayerRuntime/Private/Runtime/3rdParty/FastDelegate/FastDelegate.h:602:30:
Ordered comparison of function pointers (‘Electra::fastdelegate::DelegateMemento::GenericFuncPtr’ (aka ‘void (*)()’) and ‘Electra::fastdelegate::DelegateMemento::GenericFuncPtr’)

Hopefully someone else with more knowledge about function pointers than me can help out.

3 Likes

As a workaround for now, you can delete the following folders, and then the build should succeed.

/UnrealEngine/Engine/Plugins/Media/ElectraCDM
/UnrealEngine/Engine/Plugins/Media/ElectraPlayer
/UnrealEngine/Engine/Plugins/Media/ElectraUtil

Deleting these folders will no longer allow you to livestream in game though since that’s what they do according to the docs.

Thank you, Bongo. It sounds like it should work. I entered the line like you said, saved the file, reopened the project and tried to build UE4 (it failed with same errors) and ShaderCompilerWorker (same fail). Please tell, maybe for this to work, I need to download a fresh source code and generate project files all over again? Or did It work for you when you simply changed one file and reopened the project again? Maybe there is something that I need to click before “Build”, to refresh the files?

I don’t get it. What the hell am I doing wrong?

Try selecting the ShaderCompileWorker_Build target (e.g., the one with the archery target icon) and setting the option there, instead of the target you’ve got selected in that image?

That’s a random stab in the dark, mind you, but it’s where I’d start. Since, looking at the sidebar, the errors are in that target.

(Alternatively, set it up at the project level and delete the setting manually in all the targets, so that they inherit the project-level value.)

Can you please recommend the syntaxis of such a setting? I don’t understand how to enter it in this list

I’ll just try building it on an M1 under Monterey and see if I can figure out where the issue is, then get back to you.

Which version of the engine specifically are you trying to build? (Since you mention UE4, I’m going to assume it’s the 4.27.2-release tag, unless otherwise specified.)

Yes, it’s 4.27.2-release

Just to follow up on what @Bongo_Wobbler said, this at least let me progress with the build.

1 Like

I WAS using unreal engine 4.27.2 with Xcode 13.2 on big sur

because my Xcode as outdated and cant get the newer IOS I upgraded to Monterey and Xcode 14.1

I am getting these same errors, can someone confirm is this a BUG from unreal?

Why do we need to go into the source? Should I just go back to Big Sur???

please someone from epic confirm!!!

Also can someone please post the fix in this in thread if possible, the one that works?

Because it does not have a step by step way to do this

Use 13.4.1 as specified in the docs

13.4.1 works great with UE5.1, if you’re building with Rosetta as the target. You’ll have to check for the other versions. Once I followed those everything was easier.