Rebuilding engine when creating first project

Branch: 4.4

Build Version: 4.4.3-0+UE4

Used: Visual Studio 2013 Professional on Window 7 Professional with Service Pack 1

When compiling the first newly created project it builds the engine from sources even if the engine was built.

Repro steps:

  1. Get the sources from github, generate project files and run the solution.
  2. Right click on UE4 project and Build. (Win64, Development Editor)
  3. Open Unreal Engine Editor ([Engine_Directory]\Engine\Binaries\Win64\UE4Editor.exe)
  4. Create new Basic Code (name for example: NewGame) in [Engine_Directory]
  5. Right click on NewGame project and Build (Win64, Development Editor)
  6. See that the entire engine is building again.

Desired effect:

The engine is not building again, because it just has been built. Only project builds.

More details:

I have noticed that in UE4 solution the UE4 project in NMake has paths like: …..\Build
When the new project is created in this new project solution the UE4 project in NMake has paths like: F:\UE4\Engine\Build\

The problem is that the compiler sees this …..\Build as f:\UE4\Engine\Build

f:\ vs F:\ ← Unreal Build Tool seems to see them differently.

I used Notepad++ to the fast change of F:\ into f:\ in all files in [Engine_Directory]\NewGame\Intermediate\ProjectFiles and it helped.

It might be kinda dangerous when pure UE4 solution builds using slightly different paths than project solution with the Engine.

Hi zompi2,

I made a few attempts to reproduce this issue today, and was not successful. With the exception of about eight .lib and .dll files, the only thing that was built after step 5 was the NewGame project. The only way I was able to get the Engine to build again in step 5 was to change the solution configuration to Debug Editor. Do you have any additional information that might help reproduce this?

Hello and thanks for checking it.

I cloned branch 4.4 once again (for sure), copied Required_1of2.zip and Required_2of2.zip, generate solution using GenerateProjectFiles.bat and tried again but nothing has changed.

Few things I didn’t mention:

  1. Before I opened the editor and created a new project I exited the solution with the engine only.
  2. Before building a game I set the game project as a StartUp Project.
  3. The whole engine and a game project is on disk F: which is an SSD and it is not a system disk (which is C: )

Here is an build log from compiling engine only from engine solution:
link text

Here is an build log from the project compiling:
link text

Here is a dxdiag (I don’t know if it will be helpful, but I’m trying to give any information):
link text

The other thing is that two out of three of my colleagues has the same problem. Maybe the problem is not in the engine but in Visual Studio or the compiler configuration, but I had no idea what it could be.

I also remind that changing the size of a disk letter in vcxproj files helps. Is Unreal Build Tool case sensitive?

Sorry for the delay in getting back to you. We are still looking into this issue. A few more questions:

  • Does this issue only occur the first time you build the project? If you build it a second time, do you still see the Engine being built?
  • Do you see the same thing happening if you create a Basic Code project in a different location (not in the Engine root folder)?
  • Have you tried using the 4.5 Preview version of the Engine, and does the same thing happen there?

There may be something in the capitalization question, though I checked some of the vcproj files in the test project I created and they all had D:\ for the drive instead of d:\ and I haven’t been able to reproduce this issue yet.

  • Yes, only the first build. When I build it a second time everything if fine. Also, when I create a second project everything is ok. The issue occurs only when building the first project ever created using the engine.
  • Yes. I was trying to create a project into different directories and there was the same problem.
  • No I haven’t. I’m cloning it right now, I’ll try.

Hey zompi2 and thanks for reporting,

I’m working on similar issue right now (UBT does two full rebuilds when trying to compile from command line, paths differ only by capitalization). I’ll try to reproduce your problem and see if my solution works for that as well. I’ll keep you informed.

Cheers,

Mikolaj

I’ve checked the 4.5 Preview. Still the same.

Hi zompi2,

Unfortunately I wasn’t able to reproduce your problem, but I have come up with a quick test if root cause of your problem and mine are the same.

  1. After first compilation (clean Engine only), open \Engine\Intermediate\Build\Win64\UE4Editor\Development\Engine\EnginePrivate.h. It should look something like (note that in my case disk drive letter is capital):

#ifndef AUTO_ENGINEPRIVATE_H
#define AUTO_ENGINEPRIVATE_H
//Last Write: 2014-10-07 18:08:28 +00:00
#include “D:\Perforce2\UE4\Engine\Source\Runtime\Engine\Private\EnginePrivate.h”
#endif//AUTO_ENGINEPRIVATE_H

  1. Follow all steps you described to create project and trigger second full rebuild.
  2. Open \Engine\Intermediate\Build\Win64\UE4Editor\Development\Engine\EnginePrivate.h again. If disk drive letter has different capitalization than previously then it’s the same problem and I’ll fix this within a day or two. Otherwise, we’ll have to keep digging.

Thanks for finding this out and let me know if the contents of EnginePrivate.h change (note this is a temporary file in Intermediate folder, not the one in Source).

Cheers,
Mikolaj

Once again, fresh compilation.

The EnginePrivate.h file after the clean Engine only compilation:

#ifndef AUTO_ENGINEPRIVATE_H 
#define AUTO_ENGINEPRIVATE_H 
//Last Write: 2014-10-01 17:32:18 +00:00 
#include "f:\UE4\Engine\Source\Runtime\Engine\Private\EnginePrivate.h" 
#endif//AUTO_ENGINEPRIVATE_H

And after the project compilation:

#ifndef AUTO_ENGINEPRIVATE_H 
#define AUTO_ENGINEPRIVATE_H 
//Last Write: 2014-10-01 17:32:18 +00:00
#include "F:\UE4\Engine\Source\Runtime\Engine\Private\EnginePrivate.h" 
#endif//AUTO_ENGINEPRIVATE_H

The only change is the disk drive letter caption.

Awesome, thanks for checking. I just need some more tests and I’ll commit fix for this tomorrow.

Cheers,
Mikolaj

That’s a fantastic news! Just one question: Will this fix be commited to 4.5? Or just to master?

Hey zompi2,

I just committed fix for that. It’ll go just to master, but the fix is very simple and you can port it to 4.5 locally. Please let me know if this helps.

Cheers,

Mikolaj

Ok, it looks like the dev team commited the fix fot the issue.

Until it’s not in the release here’s a commit:
https://github.com/EpicGames/UnrealEngine/commit/176498455fd401445b36f87cd74364a72bda38ff

It works! Hurray! :smiley:

I posted a link to the github commit in an answer so everybody can do the little fix until it’s not in the release.

Thank you very much for helping :slight_smile: