UBT build errors on Mac (and odd linker error)

So I am getting these errors when building UE4Editor on Mac:

Setting up Mono

Building UBT...

Configuration/UEBuildBinary.cs(11,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?
Configuration/UEBuildModule.cs(11,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?
Configuration/UEBuildTarget.cs(11,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?
System/CPPHeaders.cs(11,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?
System/DynamicCompilation.cs(10,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?
System/ProjectFileGenerator.cs(11,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?
System/UnrealBuildTool.cs(13,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?
System/UProjectInfo.cs(11,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?
System/Utils.cs(14,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?
System/Utils.cs(15,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?
Utilities/XmlConfigLoader.cs(16,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?
Configuration/UEBuildTarget.cs(820,10): error CS0246: The type or namespace name `CaselessDictionary' could not be found. Are you missing an assembly reference?
Configuration/UEBuildModule.cs(876,47): error CS0246: The type or namespace name `CaselessDictionary' could not be found. Are you missing an assembly reference?
Configuration/UEBuildModule.cs(1989,49): error CS0246: The type or namespace name `CaselessDictionary' could not be found. Are you missing an assembly reference?
System/CPPHeaders.cs(394,18): error CS0246: The type or namespace name `FileContentsCacheType' could not be found. Are you missing an assembly reference?

Let me give you some back story: I set up UE4 from GitHub, ran setup.command and GenerateProjectFiles.command, built with Xcode and UBT worked great actually - no errors initially. Then, I was getting the following mysterious linker error:

ld: library not found for -l/Users/zorro/Perforce/UnrealEngine/4.10/Engine/Plugins/SkookumScript/Runtime/Source/AgogCore/../../Intermediate/Lib/1897/Mac/AgogCore-Development.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)

even though the file /Users/zorro/Perforce/UnrealEngine/4.10/Engine/Plugins/SkookumScript/Runtime/Source/AgogCore/../../Intermediate/Lib/1897/Mac/AgogCore-Development.a does positively exist and has 755 permissions (this is a library file previously built with Xcode belonging to a custom plugin I am working on - SkookumScript). So baffled by this, I thought I follow the advice in the error message and pass -v to the linker. So I edited the file MacToolChain.cs and added a -v to the variable LinkCommand. From this point on, I have been getting the above error messages and have not been able to rid myself of them. Even reverting the modification of MacToolChain.cs and re-running setup.command and GenerateProjectFiles.command does not help, nor does deleting Engine/Intermediate & Engine/Saved folders.

As a side note, I have been using the same build scripts and linking procedures for the iOS version of our plugin and it builds and links fine.

So any help (with either of my two problems actually!) would be super appreciated.

Thanks in advance!

So I found the solution to one of the problems: The issue with the library path was that it had to be passed to the linker without the prefix -l. To make UBT not use the -l I had to rename it such that the name starts with lib. Go figure.

The UBT build errors are still ongoing but seemingly not affecting my build. So my issues are sort of solved however it would be still nice not to get these errors. As workaround I might do a clean checkout at some point since right after the initial checkout this did not happen.

I ran into exactly the same issue when trying to add the -v flag to the LinkCommand variable. From them on, I could no longer build my projects, as it always failed with the UBT build.

Interestingly enough, I CAN build the UE4 engine - I have the same errors, but it seems they don’t hinder the successful build.

But when building a game project, the same errors actually break the build … I am bit puzzled and thought maybe you found out how to get rid of these UBT build errors.

Just wanted to add, that I have the UBT build errors also from a complete new checkout (done some days ago, maybe something has changed since then):

Configuration/UEBuildBinary.cs(11,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?


Configuration/UEBuildModule.cs(11,7): error CS0246: The type or namespace name `Tools' could not be found. Are you missing an assembly reference?

.
.
.

As stated above, for the Engine build, though, this seems to be ignored…

For the UBT build errors on Mac, I found a solution:

  1. I downloaded Xamarin Studio from Xamarin App Development with Visual Studio | Visual Studio (this is the former Mono Develop IDE) and installed it on my Mac. It needs Mono installed as well - if you don’t have it installed already, you can install it together with Xamarin Studio.

  2. I opened the UnrealBuildTool.csproj with Xamarin Studio and just tried to Build the Project (CMD-B). I received the same errors as when building from XCode.

  3. I saw that within the references section, some references, e.g. Ionic.Zip.Reduced and RPCUtility could not be found. I tried to search for these files and locate them on my Mac. Ionic.Zip.Reduced.dll and RPCUtility.exe I found under Engine/Binaries/DotNET.

  4. I removed the currently not correctly resolved references within my Xamarin Project and then manually added the Ionic dll and RPCUtility.exe as references.

  5. The last problem then was the missing “Tools” references - these could be resolved by manually adding the DotNETUtilities.dll from the same Engine/Binaries/DotNet directory as above.

  6. I then could build the UBT from within Xamarin Studio.

  7. When trying to build the whole engine or a game project then within XCode, the former errors where gone as well

Build target UE4_Build of project UE4 with configuration Development Editor

Building UBT…
0 Error(s)

Building UE4Editor…
2016-01-21 21:46:05.787 defaults[12906:92105]

Running command : Engine/Binaries/DotNET/UnrealBuildTool.exe UE4Editor Mac Development
Compiling with MacOSX SDK 10.11

I hope this might be helpful to someone else experiencing these UBT build errors (at least on Mac…).

Cheers,