Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, August 2007
Bug in qmake 4.3?


Message 1 in thread

Hi there,

I think there is a bug in qmake in Qt 4.3. I try to compile Qt 4.3 from 
the command line with VC++ 2005 Express. If I use:
     configure -debug

everything is ok. But if I add the option "-dont-process":
     configure -dont-process -debug

and then manually call qmake before nmake:
     bin\qmake

qmake generates incorrect makefiles for nmake. Open the root Makefile in 
%QTDIR%:

src\winmain\\$(MAKEFILE):
	@$(CHK_DIR_EXISTS) e:\Qt\src\winmain\ $(MKDIR) e:\Qt\src\winmain\
	cd e:\Qt\src\winmain\ && $(QMAKE) winmain.pro -win32 -o 
src\winmain\$(MAKEFILE)

If you call nmake, you will get the following error:

cd e:\Qt\src\winmain\ && e:\Qt\bin\qmake winmain.pro -win32 -o 
src\winmain\Makefile
Failure to open file: E:/Qt/src/winmain//src/winmain/Makefile.Debug
Unable to generate makefile for: winmain.pro
NMAKE : fatal error U1077: 'cd' : return code '0x5'
Stop.

qmake generates an incorrect path when the "-o" option is specified. 
Instead of generating the path
"e:/Qt/src/winmain/Makefile.Debug"

it generates:
"e:/Qt/src/winmain//src/winmain/Makefile.Debug"

as you can see, the string "/src/winmain" is present twice.

*I think* the problem is in MakefileGenerator 
(qmake\generators\makefile.cpp). I found 2 ways to fix it:

In MakefileGenerator::writeSubTargets, line 2339:
-QString out = out_directory + subtarget->makefile,
+QString out = subtarget->makefile

or in MakefileGenerator::openOutput, line 2940:
if(!file.fileName().isEmpty()) {
     if(QDir::isRelativePath(file.fileName()))
         file.setFileName(Option::output_dir + "/" + file.fileName()); 
//pwd when qmake was run

I think the error is here, since both Option::output_dir and 
file.fileName() contain "src/winmain/". Remove the call to 
file.setFileName() to fix the problem.

In fact I decided not to modify existing source code, so I overrided 
openOutput() in NmakeMakefileGenerator 
(qmake\generators\win32\msvc_nmake.cpp) this way:

bool
NmakeMakefileGenerator::openOutput(QFile &file, const QString &build) const
{
     file.setFileName("");
     return MakefileGenerator::openOutput(file, build);
}

wich is equivalent to remove the option "-o" (I think), so I can compile 
Qt with the "-dont-process" option :-)

Cheers,

-- 
 [ signature omitted ]