Windows: Building Qt From Source – NMAKE : fatal error U1077: ‘cd’ : return code ‘0x2’

I build Qt from source many, many times and often encounter this intermittent error:

NMAKE : fatal error U1077: ‘cd’ : return code ‘0x2’

Building Qt with configure and nmake takes at least an hour, and I have wasted many hours of my life rebuilding Qt (one of the suggestions that often works to fix the U1077 error is “Rerun nmake!” – but it doesn’t work all the time).

I finally found a solution that works (this time anyway, I will update this post if it fails in the future) requires building Qt in Safe Mode, and  uses jom for multi-core Qt building (way faster compilation! for multi-core processors anyway)

Reproduced verbatim from:

All credit goes to agent8261

I too had problems trying to install Qt 4.7.2 and integrating it with visual studio. When I tried to compile Qt using nmake I always got an error stating that some dll was in use. The actual dll changed every time. After about 2 days of searching and trying things, I fixed it, but I’m not at all sure what was wrong.
Hopefully this will help. Here are the exact steps I had to do in order to compile:
1: I uninstalled all the QT binaries.
2: I deleted the Qt folder.
3: I downloaded the Visual Studio Add-in []
4: I installed the visual studio add-in
5: I downloaded the Qt source code []
6: I created New folders c:\Qt\4.7.2-vc\ and extracted the source code to it.
7: I set the environment variables:
QTDIR = C:\Qt\4.7.2-vc\
QMAKESPEC = win32-msvc2010
8: I added to the Path variable:
cd C:\Qt\4.7.2-vc\bin
 If you set it up like I did, then you should be able to do:
C:\Qt\4.7.2-vc\configure.exe -help
from the windows cmd prompt.
9: I downloaded the lasts version of “jom”:
10: I created the folder C:\Qt\4.7.2-vc\jom extracted the jom files to it
11: I restarted windows then opened the VISUAL STUDIO command prompt and ran
 cd C:\Qt\4.7.2-vc
 configure -debug-and-release -opensource -platform win32-msvc2010
The configuration took awhile. After it was finished
I don’t know why this step was important, but I had to do the actual compilation in safe mode.
13: Open the VISUAL STUDIO command prompt and run
 cd C:\Qt\4.7.2-vc
 C:\Qt\4.7.2-vc\jom\jom.exe –j 8
8 is the number of CPU cores for my computer.
Building the file took a long time. By far the longest I have ever seen, but if finally finished.
Afterwards I had to open visual studio and configure the add-in. Below are the sites that helped me figure everything out.
FYI: I’m on windows 7, using visual studio 2010 ultimate (version 10.0.30319.1), running on a Intel i7(q720). I compiled 4.72 LGPL version of the QT framework. I am using the Visual Studio Qt add-in 1.1.9-1.

About Alexis Chan
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

One Response to Windows: Building Qt From Source – NMAKE : fatal error U1077: ‘cd’ : return code ‘0x2’

  1. Pingback: How to create Paraview MVS solution using CMake | Alexis' Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s