PDA

View Full Version : QMake fail with whitespace in DESTDIR



grayfox
23rd November 2011, 13:18
I have the following code code specify various output dir and the dest dir



BUILD_ROOT = $${PWD}/build/$$TARGET-$$TEMPLATE
DIST_ROOT = $${PWD}/dist

CONFIG(debug, debug|release) {
BUILD_ROOT = $${BUILD_ROOT}/debug
DIST_ROOT = $${DIST_ROOT}/debug
} else {
BUILD_ROOT = $${BUILD_ROOT}/release
DIST_ROOT = $${DIST_ROOT}/release
}

DESTDIR = $${DIST_ROOT}
OBJECTS_DIR = $${BUILD_ROOT}/obj
MOC_DIR = $${BUILD_ROOT}/moc
RCC_DIR = $${BUILD_ROOT}/rcc
UI_DIR = $${BUILD_ROOT}/ui


However when the PWD is expanded to a path that contains spaces, the final makefile will fail when build.

This is the compile output:


Running build steps for project logging...
Configuration unchanged, skipping qmake step.
Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe"
c:\qtsdk\desktop\qt\4.7.4\mingw\bin\qmake.exe -spec c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\win32-g++ CONFIG+=release -o Makefile logging.pro
C:/QtSDK/mingw/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Documents and Settings/Grayfox/Desktop/root/projects/logging/trunk/src/logging'
g++ -Wl,-s -mthreads -shared -Wl,--out-implib,c:\Documents and Settings\Grayfox\Desktop\root\projects\logging\tru nk\dist\release\liblogging.a -o ..\..\dist\release\logging.dll ../../build/logging-lib/release/obj/Logging.o -L"c:\QtSDK\Desktop\Qt\4.7.4\mingw\lib"
mingw32-make[1]: Leaving directory `C:/Documents and Settings/Grayfox/Desktop/root/projects/logging/trunk/src/logging'
g++: and: No such file or directory
g++: Settings\Grayfox\Desktop\root\projects\logging\tru nk\dist\release\liblogging.a: No such file or directory
mingw32-make[1]: *** [..\..\dist\release\logging.dll] Error 1
mingw32-make: *** [release] Error 2
The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project logging (target: Desktop)
When executing build step 'Make'


Notice the line:
g++ -Wl,-s -mthreads -shared -Wl,--out-implib,c:\Documents and Settings\Grayfox\Desktop\root\projects\logging\tru nk\dist\release\liblogging.a -o

The path is not quoted, which cause this error:
g++: Settings\Grayfox\Desktop\root\projects\logging\tru nk\dist\release\liblogging.a: No such file or directory

Normally, if I do not explicitly set a DESTDIR, the path above would have quotes around them.

Is this a known issue?

MarekR22
23rd November 2011, 14:39
why you need to use $${PWD}?
I'm prety sure that it will work if you remove "$${PWD}/" - so you will have relative paths instead of absolute paths.
Adding quotes should fix the problem too.

grayfox
23rd November 2011, 14:59
why you need to use $${PWD}?
I'm prety sure that it will work if you remove "$${PWD}/" - so you will have relative paths instead of absolute paths.
Adding quotes should fix the problem too.

Firstly, adding quotes doesn't fix the problem.

The reason I use PWD is that the qmake code is actually sitting in a global pri file located in a root directory, that will be included by all sub-projects, so that everything will be build to the root directory's sub-folders

buus
24th November 2011, 12:01
Could it be $$quote($${PWD}/dist)
If not this might be helpful http://doc.qt.nokia.com/latest/qmake-project-files.html#whitespace