Hello! I am trying to build UE4.27 from source for the first time on my M1 MacBook.
I got these errors when building, does anyone know how to correct them? I really dont want to delete these variables or change the way they are defined, since I do not know how it’ll affect the rest of the Unreal system.
The closest solution that I found online is that my compiler may be compiling as C and not C++, where C++ does not care about similar enum component definitions, whereas C does not allow it.
I would appreciate if anyone is able to help me with this, thank you!
Getting hit with the same, possibly due to updating to XCode 14:
...
In file included from /Users/****/Engine/Intermediate/Build/Mac/x86_64/UE4Editor/Development/WebSockets/Module.WebSockets.cpp:2:
In file included from /Users/****/Engine/Source/Runtime/Online/WebSockets/Private/Lws/LwsWebSocket.cpp:3:
In file included from /Users/****/Engine/Source/Runtime/Online/WebSockets/Private/Lws/LwsWebSocket.h:19:
0>/Users/****/Engine/Source/ThirdParty/libWebSockets/libwebsockets/include/Mac/libwebsockets.h:3843:2: Error : redefinition of enumerator 'HTTP_STATUS_CONTINUE'
HTTP_STATUS_CONTINUE = 100,
^
0>/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/cups/http.h:234:3: Reference : previous definition is here
HTTP_STATUS_CONTINUE = 100, /* Everything OK, keep going... */
^
In file included from /Users/****/Engine/Intermediate/Build/Mac/x86_64/UE4Editor/Development/WebSockets/Module.WebSockets.cpp:2:
In file included from /Users/****/Engine/Source/Runtime/Online/WebSockets/Private/Lws/LwsWebSocket.cpp:3:
In file included from /Users/****/Engine/Source/Runtime/Online/WebSockets/Private/Lws/LwsWebSocket.h:19:
0>/Users/****/Engine/Source/ThirdParty/libWebSockets/libwebsockets/include/Mac/libwebsockets.h:3845:2: Error : redefinition of enumerator 'HTTP_STATUS_OK'
HTTP_STATUS_OK = 200,
^
...
If you have a look at the changes in Engine/Source/ThirdParty/libWebSockets/libwebsockets/include/Mac/libwebsockets.h for that commit, you’ll see that it’s just wrapping those specific enums in a check on the compiler version. In this case, those enums are skipped if Xcode14 is detected.
Note: you will probably need most of the other changes in that CL to get it compiling. Even then, there might be 4.27 specific changes that are needed. Xcode14 also brought in some plist changes, so you might also need to add
GENERATE_INFOPLIST_FILE=YES to Info.plist.