MantisBT - CMake
View Issue Details
0011672CMakeCMakepublic2011-01-10 06:542011-05-02 14:46
Alexander 
Clinton Stimpson 
normalmajoralways
closedfixed 
Windows 7 64 bit
CMake 2.8.3 
 
0011672: FindQt4.cmake sometimes fails due to exec_program misbehavior
FindQt4.cmake uses exec_program() call to retrieve configuration values from qmake, such as QT_VERSION, QT_INSTALL_LIBS or whatever.

However, in my tests exec_program() call sometimes delivers empty output, so FindQt4 module reports errors like these ones (FindQt4.cmake was modified to output intermediate variables):

[Debugging output starts here]

Running C:/Hudson/Common/ThirdParty/qt/win32/bin/qmake.exe with arg QT_VERSION
Got return code 0 and output 4.7.1
Converted output path to 4.7.1 and recorded to QTVERSION
Running C:/Hudson/Common/ThirdParty/qt/win32/bin/qmake.exe with arg QMAKE_MKSPECS
Got return code 0 and output C:/Hudson/Common/ThirdParty/qt\mkspecs
Converted output path to C:/Hudson/Common/ThirdParty/qt/mkspecs and recorded to qt_mkspecs_dirs
Running C:/Hudson/Common/ThirdParty/qt/win32/bin/qmake.exe with arg QT_INSTALL_LIBS
Got return code 0 and output
Converted output path to and recorded to QT_LIBRARY_DIR_TMP

[Debugging output ends here]

Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as
Warning: But QtCore couldn't be found. Qt must NOT be installed correctly, or it wasn't found for cross compiling.
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:642 (MESSAGE):
 Could NOT find QtCore.

The script qmakeTest.cmake, when run as cmake -P qmakeTest.cmake reproduces this problem approximately ones per several hundreds iterations.

It should be noted that if first part of the script (which uses exec_program) is commented and second part (which uses execute_process) is used instead, things work fine (up to 10,000 iterations - the max I had the time to wait for ;-) ), so, considering exec_program is deprecated, the way to fix this seems to be just to replace exec_program with execute_process.

The primary testing environment was Windows 7 64 bit installed in VirtualBox 3.2.12, though I've got similar error, I believe, on native Windows 7 64 bit installation too.
No tags attached.
? qmakeTest.cmake (683) 2011-01-10 06:54
https://public.kitware.com/Bug/file/3609/qmakeTest.cmake
Issue History
2011-01-10 06:54AlexanderNew Issue
2011-01-10 06:54AlexanderFile Added: qmakeTest.cmake
2011-01-10 07:51Michael WildNote Added: 0024528
2011-01-17 12:24David ColeAssigned To => Clinton Stimpson
2011-01-17 12:24David ColeStatusnew => assigned
2011-01-17 12:25David ColeNote Added: 0024772
2011-01-17 13:15Clinton StimpsonNote Added: 0024780
2011-01-17 21:19Clinton StimpsonNote Added: 0024840
2011-01-17 21:19Clinton StimpsonStatusassigned => resolved
2011-01-17 21:19Clinton StimpsonResolutionopen => fixed
2011-05-02 14:46David ColeNote Added: 0026359
2011-05-02 14:46David ColeStatusresolved => closed

Notes
(0024528)
Michael Wild   
2011-01-10 07:51   
Possibly a bug in cmWin32ProcessExecution? Seems to be the most likely candidate to me...
(0024772)
David Cole   
2011-01-17 12:25   
Clinton, any way to eliminate exec_program in favor of execute_process here? The exact reason execute_process was introduced were problems with exec_program similar to those reported here...
(0024780)
Clinton Stimpson   
2011-01-17 13:15   
I tried to remove it a while back but had problems. I'll look again.
(0024840)
Clinton Stimpson   
2011-01-17 21:19   
Fix put in git : 858fe0e

Had to strip trailing whitespace for execute_process() to work.
(0026359)
David Cole   
2011-05-02 14:46   
Closing resolved issues that have not been updated in more than 3 months.