PDA

View Full Version : qmake odditiy - Bug reports?



Asperamanca
10th July 2009, 09:30
As noted in this thread (http://www.qtcentre.org/forum/f-newbie-4/t-qmake-using-source-files-not-in-pro-file-22351.html) yesterday, I see an odd behaviour of qmake:
SOURCE and HEADER variables (and possibly others, too) seem to remember the values of past executions of qmake.
So if I only use SOURCE += ... (as seen in many tutorials), I'll inevitably run into troubles because there's some leftover references in the variables.

1st question: Is this behaviour as it should be? Or would you see that as a bug?
2nd question: If bug, where do I report it?

wysota
10th July 2009, 09:33
No, that's impossible, I assure you. I'm always using "SOURCES+=" and it works fine. And it is SOURCES, not SOURCE. You must have an error somewhere in your project. Can you tell us step by step how to reproduce this "bug" starting with an empty project?

nish
10th July 2009, 09:35
1. I did not faced this issue on my machine.
2. u can report the bug by eamil to trolltech... search for their task tracker on qtsoftware.com

Asperamanca
10th July 2009, 12:44
No, that's impossible, I assure you. I'm always using "SOURCES+=" and it works fine. And it is SOURCES, not SOURCE. You must have an error somewhere in your project. Can you tell us step by step how to reproduce this "bug" starting with an empty project?

After 10 years as software developer, the word "impossible" is no longer in my vocabulary.

Consider the following .pro file:


HEADERS += \
mouse.h
SOURCES += \
main.cpp \
mouse.cpp

RESOURCES += \
mice.qrc

# install
target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/collidingmice
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS collidingmice.pro images
sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/collidingmice
INSTALLS += target sources

(which is from one of the samples of the QT SDK)

Now consider the error output upon calling qmake with that file:


WARNING: Failure to find: d:/Projects/QT/HelloWorld/main.cpp
WARNING: Failure to find: d:/Projects/QT/HelloWorld/hellowin.cpp
WARNING: Failure to find: d:/Projects/QT/HelloWorld/hellounix.cpp
WARNING: Failure to find: d:/Projects/QT/HelloWorld/hello.cpp
WARNING: Failure to find: d:/Projects/QT/HelloWorld/hello.h
WARNING: Failure to find: d:/Projects/QT/HelloWorld/main.cpp
WARNING: Failure to find: d:/Projects/QT/HelloWorld/hellowin.cpp
WARNING: Failure to find: d:/Projects/QT/HelloWorld/hellounix.cpp
WARNING: Failure to find: d:/Projects/QT/HelloWorld/hello.cpp
WARNING: Failure to find: d:/Projects/QT/HelloWorld/hello.h

Consider also that this goes away if I replace the first "+=" with a simple "=".

Sounds like a caching problem to me...


***** LONG STORY - SKIP IF YOU WANT ******
I should note that I first tried to run projects directly from QTCreator. The files mentioned in the warnings are from the qmake-tutorial, also in the samples of the SDK. As far as I remember, this was the last project I had open in my QTCreator.

After I realized I could run the samples directly from QTCreator, but could not generate executables, I closed QTCreator, and tried to build a simple project using qmake and make.

First I copied the sample from examples\qmake\tutorial, tried to build it, and got stuck somewhere.
i found an even easier sample in an online book, cleaned out the folder, and started anew, creating only a single source file this time, then a .pro file (using qmake).
When trying to build the .pro file using qmake, the trouble started (as noted in the thread linked above).

I've since tried to run a different sample from QTCreator - that works, but does not change the error output when trying to build the .pro file with SOURCE += ...

Somehow, the files from the first project I actually tried to build from the command line seem stuck...permanently.
***** END LONG STORY *****

Since it even survives machine restarts, it must be on the HD somewhere.

And I think I've found it. They are in my qconfig.pri. Removed them and everything works. No idea how they got there.

So much for "impossible"

Can someone tell me where I can find more info about qconfig.pri?

wysota
10th July 2009, 13:37
And I think I've found it. They are in my qconfig.pri. Removed them and everything works. No idea how they got there.
Someone must have placed them there, either you or some IDE you've been using.


So much for "impossible"
It's not a qmake bug, so it's impossible that it's a qmake bug. Blame yourself before blaming others for things that do not work.


Can someone tell me where I can find more info about qconfig.pri?

There is no special info about this file. This is a standard file that gets included into every project qmake operates on like a bunch of other files in mkspecs directory.

Asperamanca
10th July 2009, 14:31
This is pure semantics, but I stated


SOURCE and HEADER variables (and possibly others, too) seem to remember the values of past executions of qmake.
(there was more, but this is the core of the statement)

...to which you replied...


No, that's impossible

If (as I now know) there is a mechanism to pre-define those values for all projects (using qconfig.pri), then my statement is basically correct: The value of the SOURCES variable can be remembered across multiple project, machine reboots, etc.
Of course the description is misleading, since I did not (at that time) know the cause for this behaviour, and thus used the term "remembering", which is inaccurate.

Please consider also that I did not plainly say this is a bug, instead I asked whether this would be considered a bug, or expected behaviour (which, as it turns out, it is).

No blame was assigned to anyone, and I probably will not be able to find out how exactly the filenames ended up in qconfig.pri (I only know for sure that I never manually wrote anything in there).

EDIT:
As for IDE...I'm using QTCreator, which (right now) seems to be the most likely cause.

wysota
10th July 2009, 14:43
This is pure semantics, but I stated


(there was more, but this is the core of the statement)

Which is false. Prior executions of qmake have nothing to do with contents of one of included files. It's not qmake that made changes to those files, it only modifies Makefiles (and creates a .pro file when run with -project switch).


If (as I now know) there is a mechanism to pre-define those values for all projects (using qconfig.pri), then my statement is basically correct: The value of the SOURCES variable can be remembered across multiple project, machine reboots, etc.
Which, again, has nothing to do with prior executions which was the essence of your statement. You can modify qconfig.pri (or any other included file) and run qmake once and it will "remember (nonexisting) prior executions".



Of course the description is misleading, since I did not (at that time) know the cause for this behaviour, and thus used the term "remembering", which is inaccurate.
On the other hand my "impossible" statement was accurate because the only file opened in write mode by qmake is the Makefile. It doesn't do any caching on its own.


EDIT:
As for IDE...I'm using QTCreator, which (right now) seems to be the most likely cause.

I think so as well, Creator likes to modify wrong project files when you add a file to a project. If you had Qt opened as a project and config.pri was mentioned there somewhere explicitely and you tried adding a file to some project, it might have accidently landed in qconfig.pri. That's a bug in Creator, for sure :)