Unreal won't compile my project on mac

Unreal Engine 5.1
Hello. I’m facing a very nasty problem right now. My unreal project DOES compile when I run it with visual studio on windows. However, it DOES NOT compile when I try to build it with my macOS Ventura on M1 pro chip. It gives the following log:

Log file: /Users/wiam/Library/Application Support/Epic/UnrealBuildTool/Log.txt
Using 'git status' to determine working set for adaptive non-unity build (/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp).
Building ConstructorAppEditor...
Determining max actions to execute in parallel (10 physical cores, 10 logical cores)
  Executing up to 10 processes, one per physical core
  Requested 1.5 GB free memory per action, 7.94 GB available: limiting max parallel actions to 5
Building 39 actions with 5 processes...
[1/39] Compile Module.ConstructorApp.7_of_16.cpp cancelled
[2/39] Compile PCH.ConstructorApp.h
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Intermediate/Build/Mac/x86_64/UnrealEditor/Development/ConstructorApp/PCH.ConstructorApp.h:374:
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Private/PrivateConstructorPCH.h:5:
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:13:
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/ExternalAPIBase.h:6:
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/RequestTemplates.h:21:3: error: use of undeclared identifier 'InputArgsType'
                InputArgsType = ArgsType::StaticStruct();
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/RequestTemplates.h:22:3: error: use of undeclared identifier 'OutputArgsType'
                OutputArgsType = ResultType::StaticStruct();
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/RequestTemplates.h:24:3: error: use of undeclared identifier 'ArgsPointer'
                ArgsPointer = &Arguments;
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/RequestTemplates.h:25:3: error: use of undeclared identifier 'ResultPointer'
                ResultPointer = &Result;
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/RequestTemplates.h:42:29: error: use of undeclared identifier 'AsShared'
                OnResponse.ExecuteIfBound(AsShared(), Result);
                                          ^
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Intermediate/Build/Mac/x86_64/UnrealEditor/Development/ConstructorApp/PCH.ConstructorApp.h:374:
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Private/PrivateConstructorPCH.h:5:
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:576:12: error: declaration shadows a field of 'FPointCoordinate' [-Werror,-Wshadow]
                        FVector Coordinate = PointCoordinate.Coordinate;
                                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:519:10: note: previous declaration is here
        FVector Coordinate;
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:581:12: error: declaration shadows a field of 'FPointCoordinate' [-Werror,-Wshadow]
                        FVector Coordinate;
                                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:519:10: note: previous declaration is here
        FVector Coordinate;
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:649:8: error: unknown type name 'INT32'
                for (INT32 i = 0; i < Strings.Num(); ++i)
                     ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:693:17: error: declaration shadows a field of 'FSurfaceId' [-Werror,-Wshadow]
                        ESurfaceType SurfaceType;
                                     ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:621:15: note: previous declaration is here
        ESurfaceType SurfaceType;
                     ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:764:15: error: declaration shadows a field of 'FSurface' [-Werror,-Wshadow]
                        FSurfaceId Id = Surface.Id;
                                   ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:723:13: note: previous declaration is here
        FSurfaceId Id;
                   ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:765:18: error: declaration shadows a field of 'FSurface' [-Werror,-Wshadow]
                        TArray<int64> ObjectsOnSurface = Surface.ObjectsOnSurface;
                                      ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:732:16: note: previous declaration is here
        TArray<int64> ObjectsOnSurface;
                      ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:772:15: error: declaration shadows a field of 'FSurface' [-Werror,-Wshadow]
                        FSurfaceId Id;
                                   ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:723:13: note: previous declaration is here
        FSurfaceId Id;
                   ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:773:18: error: declaration shadows a field of 'FSurface' [-Werror,-Wshadow]
                        TArray<int64> ObjectsOnSurface;
                                      ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:732:16: note: previous declaration is here
        TArray<int64> ObjectsOnSurface;
                      ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:952:16: error: declaration shadows a field of 'FObjectSide' [-Werror,-Wshadow]
                        EObjectSide Type = Side.Type;
                                    ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:903:14: note: previous declaration is here
        EObjectSide Type;
                    ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:953:12: error: declaration shadows a field of 'FObjectSide' [-Werror,-Wshadow]
                        FVector Normal = Side.Normal;
                                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:906:10: note: previous declaration is here
        FVector Normal;
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:954:25: error: declaration shadows a field of 'FObjectSide' [-Werror,-Wshadow]
                        TArray<ESurfaceType> AwailableSurfaces = Side.AwailableSurfaces;
                                             ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:909:23: note: previous declaration is here
        TArray<ESurfaceType> AwailableSurfaces;
                             ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:962:16: error: declaration shadows a field of 'FObjectSide' [-Werror,-Wshadow]
                        EObjectSide Type;
                                    ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:903:14: note: previous declaration is here
        EObjectSide Type;
                    ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:963:12: error: declaration shadows a field of 'FObjectSide' [-Werror,-Wshadow]
                        FVector Normal;
                                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:906:10: note: previous declaration is here
        FVector Normal;
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:964:25: error: declaration shadows a field of 'FObjectSide' [-Werror,-Wshadow]
                        TArray<ESurfaceType> AwailableSurfaces;
                                             ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Source/ConstructorApp/Public/Core/ConstructorAppTypes.h:909:23: note: previous declaration is here
        TArray<ESurfaceType> AwailableSurfaces;
                             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
[3/39] Compile Module.ConstructorApp.6_of_16.cpp cancelled
[4/39] Compile Module.ConstructorApp.16_of_16.cpp cancelled
[5/39] Compile Module.ConstructorApp.10_of_16.cpp cancelled
[6/39] Compile Module.ConstructorApp.2_of_16.cpp cancelled
[7/39] Compile Module.ConstructorApp.3_of_16.cpp cancelled
[8/39] Compile Module.ConstructorApp.11_of_16.cpp cancelled
[9/39] Compile Module.ConstructorApp.15_of_16.cpp cancelled
[10/39] Compile Module.ConstructorApp.8_of_16.cpp cancelled
[11/39] Compile Module.ConstructorApp.1_of_16.cpp cancelled
[12/39] Compile Module.ConstructorApp.12_of_16.cpp cancelled
[13/39] Compile Module.ConstructorApp.9_of_16.cpp cancelled
[14/39] Compile Module.ConstructorApp.13_of_16.cpp cancelled
[15/39] Compile Module.ConstructorApp.4_of_16.cpp cancelled
[16/39] Compile Module.ConstructorApp.14_of_16.cpp cancelled
[17/39] Compile Module.ConstructorApp.5_of_16.cpp cancelled
[18/39] Compile PCH.AwsS3.h
[19/39] Compile Module.AwsS3.2_of_4.cpp
[20/39] Compile Module.AwsS3.1_of_4.cpp
[21/39] Compile SharedPCH.UnrealEd.ShadowErrors.h
[22/39] Compile SharedPCH.Engine.ShadowErrors.h
[23/39] Compile Module.AwsS3.3_of_4.cpp
[24/39] Compile Module.RuntimeFBXImport.cpp
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/RuntimeFBXImport/Intermediate/Build/Mac/x86_64/UnrealEditor/Development/RuntimeFBXImport/Module.RuntimeFBXImport.cpp:4:
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/RuntimeFBXImport/Intermediate/Build/Mac/x86_64/UnrealEditor/Inc/RuntimeFBXImport/UHT/FBXImportManager.gen.cpp:8:
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/RuntimeFBXImport/Source/RuntimeFBXImport/Public/FBXImportManager.h:7:
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/RuntimeFBXImport/Source/RuntimeFBXImport/Public/ImportFBXAsync.h:9:
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/RuntimeFBXImport/Source/RuntimeFBXImport/Public/FBXMeshImport.h:11:
In file included from Runtime/Core/Public/Windows/AllowWindowsPlatformTypes.h:6:
/Users/wiam/Develop/UnrealEngineDevelopment/Engines/UE_5.1/Engine/Source/Runtime/Core/Public/Microsoft/AllowMicrosoftPlatformTypes.h:8:11: fatal error: 'Microsoft/AllowMicrosoftPlatformTypesPrivate.h' file not found
        #include "Microsoft/AllowMicrosoftPlatformTypesPrivate.h"
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[25/39] Link UnrealEditor-RuntimeFBXImport.dylib cancelled
[26/39] Compile Module.RuntimeTransformer.cpp
[27/39] Compile Module.ExternalAPIConstructor.cpp
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Intermediate/Build/Mac/x86_64/UnrealEditor/Development/ExternalAPIConstructor/Module.ExternalAPIConstructor.cpp:4:
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Private/APIRequest.cpp:2:
In file included from /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/ExternalAPIBase.h:6:
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/RequestTemplates.h:21:3: error: use of undeclared identifier 'InputArgsType'
                InputArgsType = ArgsType::StaticStruct();
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/RequestTemplates.h:22:3: error: use of undeclared identifier 'OutputArgsType'
                OutputArgsType = ResultType::StaticStruct();
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/RequestTemplates.h:24:3: error: use of undeclared identifier 'ArgsPointer'
                ArgsPointer = &Arguments;
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/RequestTemplates.h:25:3: error: use of undeclared identifier 'ResultPointer'
                ResultPointer = &Result;
                ^
/Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/Plugins/ExternalAPIConstructor/Source/ExternalAPIConstructor/Public/RequestTemplates.h:42:29: error: use of undeclared identifier 'AsShared'
                OnResponse.ExecuteIfBound(AsShared(), Result);
                                          ^
5 errors generated.
[28/39] Link UnrealEditor-ExternalAPIConstructor.dylib cancelled
[29/39] Link UnrealEditor-RuntimeTransformer.dylib
[30/39] Compile Module.VersionMark.cpp
[31/39] Link UnrealEditor-VersionMark.dylib
[32/39] Compile Module.UltimateWindowPolice.cpp
[33/39] Link UnrealEditor-UltimateWindowPolice.dylib
[34/39] Compile Module.GitSourceControl.cpp
[35/39] Link UnrealEditor-GitSourceControl.dylib
[36/39] Compile Module.AwsS3.4_of_4.cpp
[37/39] Link UnrealEditor-AwsS3.dylib
[38/39] Link UnrealEditor-ConstructorApp.dylib cancelled
[39/39] WriteMetadata ConstructorAppEditor.target cancelled

 *  The terminal process "/bin/zsh '-c', 'Engine/Build/BatchFiles/Mac/Build.sh ConstructorAppEditor Mac Development /Users/wiam/Develop/UnrealEngineDevelopment/Projects/constructorapp/ConstructorApp.uproject -waitmutex'" terminated with exit code: 6. 
 *  Terminal will be reused by tasks, press any key to close it. 

So mostly it’s about variables’ names shadowing but there’s also an error for example, that says file not found #include “Microsoft/AllowMicrosoftPlatformTypesPrivate.h”. Where do I even get this file? For windows this is irrelevant because we can avoid this error by ignoring it with #if #else directives.

I did try these things:

  1. Added compiler arguments to MacToolChain.cs like this:
/// <inheritdoc/>
		protected override void GetCompileArguments_Global(CppCompileEnvironment CompileEnvironment, List<string> Arguments)
		{
			base.GetCompileArguments_Global(CompileEnvironment, Arguments);

			Arguments.Add("-fasm-blocks");

			if (CompileEnvironment.bEnableOSX109Support)
			{
				Arguments.Add("-faligned-new"); // aligned operator new is supported only on macOS 10.14 and above
			}
			// MY CODE FROM HERE
			if(CompileEnvironment.bEnableUndefinedIdentifierWarnings)
			{
				Arguments.Add("-Wundef" + (CompileEnvironment.bUndefinedIdentifierWarningsAsErrors ? "" : "-Wno-error=undef"));
			}

			string Result = string.Empty;
			Result += "-Wno-deprecated";
			Result += "-Wno-deprecated-declarations";
			Result += "-Wno-int-to-void-pointer-cast";
			Result += "-Wno-non-literal-null-conversion";
			Result += "-Wno-overloaded-virtual";
			Result += "-Wno-pointer-to-int-cast";
			Result += "-Wno-pragma-once-outside-header";
			Result += "-Wno-unused-but-set-variable";
			Result += "-Wno-unused-function";
			Result += "-Wno-unused-result";
			Result += "-Wno-variable";
			Result += "-Wno-shadow";

			Result += "-c";

			Arguments.Add(Result);
			// AND IT ENDS HERE


			// Pass through architecture and OS info
			Arguments.Add("" + FormatArchitectureArg(CompileEnvironment.Architecture));
			Arguments.Add($"-isysroot \"{SDKPath}\"");
			Arguments.Add("-mmacosx-version-min=" + (CompileEnvironment.bEnableOSX109Support ? "10.9" : Settings.MacOSVersion));

			List<string> FrameworksSearchPaths = new List<string>();
			foreach (UEBuildFramework Framework in CompileEnvironment.AdditionalFrameworks)
			{
				FileReference FrameworkPath = new FileReference(Path.GetFullPath(Framework.Name));
				if (!FrameworksSearchPaths.Contains(FrameworkPath.Directory.FullName))
				{
					Arguments.Add($"-F \"{NormalizeCommandLinePath(FrameworkPath.Directory)}\"");
					FrameworksSearchPaths.Add(FrameworkPath.Directory.FullName);
				}
			}
		}

That didn’t help me. Still same errors.
2. Downgraded the Xcode app version to 13. But macOS doesn’t allow to run old versions.

I’m seriously out of ideas. I’m a regular windows user who has switched to being a mac user. I assume that’s a price I’ll pay for it))

Hey, I am having a similar issue with an unreal project created in windows not opening on my Mac. It wants me to build manually, and when I do the build succeeds. Then when I open the project, it gives me the same error. Wondering if this was close to your problem and if you fixed your what you did to fix it? Thanks!

I checked some of the other plugins that included AllowWIndowsPlatformTypes.h and found they encapsulated the include with #if PLATFORM_WINDOWS . Doing that allowed me to include the plugin on my Mac.