Another project command line build help request [SOLVED]
-
Hi all,
I've been struggling with this for a couple of hours and have searched and searched and still not finding the issue.
I'm using Qt 5.4 with MSVC2013. I installed the 32 bit version of Qt community and I have Visual Studio 2013 installed. From within Qt Creator using the menus to run qmake and then rebuild all works great.
So in trying to get automated nightly builds working I'm starting with a batch file. Here is the current test batch file:
@
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
cd d:\dev\build-prg-Desktop_Qt_5_4_0_MSVC2013_32bit-Release
"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\bin\qmake.exe" "d:\dev\prg\prg.pro" -r -spec win32-msvc2013
C:\Qt\Qt5.4.0MSVC32\Tools\QtCreator\bin\jom.exe -f Makefile.Release clean
C:\Qt\Qt5.4.0MSVC32\Tools\QtCreator\bin\jom.exe -f Makefile.Release
@The first line sets up the env vars using the VC varsall.
Then the first "cd" is into the same directory that running qmake from the Qt environment creates. In there are my makefiles and debug/release dirs.
I'd like to use jom so I tried calling it using the exact same call from the compile output window.
The clean appears to work. When it runs I get a bunch of del commands to remove mocs and objs. No errors from this.
Then the next jom starts which would hopefully build. The first couple of lines are:
@ C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\bin\uic.exe ..\prg\views\mainview.ui -o
ui_mainview.h@And there are other uic lines for the other views I have. No errors from those.
Then cl is fired up. The command line of the first cl is:
cl -c -nologo -Zm200 -Zc:wchar_t -FS -O2 -MD -Zc:strictStrings -GR -W3 -
w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_L
IB -DQT_NETWORK_LIB -DQT_SERIALPORT_LIB -DQT_SCRIPT_LIB -DQT_CORE_LIB -DNDEBUG -
I"..\prg\io" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include" -I"C:\Qt\Qt5.4.0MSVC32
\5.4\msvc2013\include\QtWidgets" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtG
ui" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtANGLE" -I"C:\Qt\Qt5.4.0MSVC32
5.4\msvc2013\include\QtNetwork" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtSe
rialPort" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtScript" -I"C:\Qt\Qt5.4.0
MSVC32\5.4\msvc2013\include\QtCore" -I"release" -I"." -I"." -I"C:\Qt\Qt5.4.0MSVC
32\5.4\msvc2013\mkspecs\win32-msvc2013" -Forelease\ @C:\Users\mark_000\AppData\L
ocal\Temp\dev_meter.obj.13196.63.jomThis produces the following error:
cl : Command line error D8021 : invalid numeric argument '/FS'The same command line when run from the Qt environment is:
cl -c -nologo -Zm200 -Zc:wchar_t -FS -O2 -MD -Zc:strictStrings -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SERIALPORT_LIB -DQT_SCRIPT_LIB -DQT_CORE_LIB -DNDEBUG -I"..\prg\io" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtWidgets" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtGui" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtANGLE" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtNetwork" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtSerialPort" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtScript" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtCore" -I"release" -I"." -I"." -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\mkspecs\win32-msvc2013" -Forelease\ @C:\Users\mark_000\AppData\Local\Temp\dev_meter.obj.12616.47.jom
This one produces no errors.
The command lines look mostly the same to me but why would the first one have issues with -FS while the second one does not?
My system is a Windows 8.1 (x64) system but I'm building for Win7x32. So I'm wondering if the setup argument to vcvarsall is wrong.
Anyway a little guidance would be great! Thanks in advance!
-
Hi,
IIRC you have a bat file in the bin folder of your Qt's version that you can use to setup your build environment on the command line, try with that one instead.
Hope it helps
-
Unless I'm looking at the wrong batch file all it does is this:
@
echo off
echo Setting up environment for Qt usage...
set PATH=C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\bin;%PATH%
cd /D C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013
echo Remember to call vcvarsall.bat to complete environment setup!@ -
Yes, that's right sorry, I just realized that it should be called from a developer command line
-
Hi all,
I've been struggling with this for a couple of hours and have searched and searched and still not finding the issue.
I'm using Qt 5.4 with MSVC2013. I installed the 32 bit version of Qt community and I have Visual Studio 2013 installed. From within Qt Creator using the menus to run qmake and then rebuild all works great.
So in trying to get automated nightly builds working I'm starting with a batch file. Here is the current test batch file:
@
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
cd d:\dev\build-prg-Desktop_Qt_5_4_0_MSVC2013_32bit-Release
"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\bin\qmake.exe" "d:\dev\prg\prg.pro" -r -spec win32-msvc2013
C:\Qt\Qt5.4.0MSVC32\Tools\QtCreator\bin\jom.exe -f Makefile.Release clean
C:\Qt\Qt5.4.0MSVC32\Tools\QtCreator\bin\jom.exe -f Makefile.Release
@The first line sets up the env vars using the VC varsall.
Then the first "cd" is into the same directory that running qmake from the Qt environment creates. In there are my makefiles and debug/release dirs.
I'd like to use jom so I tried calling it using the exact same call from the compile output window.
The clean appears to work. When it runs I get a bunch of del commands to remove mocs and objs. No errors from this.
Then the next jom starts which would hopefully build. The first couple of lines are:
@ C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\bin\uic.exe ..\prg\views\mainview.ui -o
ui_mainview.h@And there are other uic lines for the other views I have. No errors from those.
Then cl is fired up. The command line of the first cl is:
cl -c -nologo -Zm200 -Zc:wchar_t -FS -O2 -MD -Zc:strictStrings -GR -W3 -
w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_L
IB -DQT_NETWORK_LIB -DQT_SERIALPORT_LIB -DQT_SCRIPT_LIB -DQT_CORE_LIB -DNDEBUG -
I"..\prg\io" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include" -I"C:\Qt\Qt5.4.0MSVC32
\5.4\msvc2013\include\QtWidgets" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtG
ui" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtANGLE" -I"C:\Qt\Qt5.4.0MSVC32
5.4\msvc2013\include\QtNetwork" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtSe
rialPort" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtScript" -I"C:\Qt\Qt5.4.0
MSVC32\5.4\msvc2013\include\QtCore" -I"release" -I"." -I"." -I"C:\Qt\Qt5.4.0MSVC
32\5.4\msvc2013\mkspecs\win32-msvc2013" -Forelease\ @C:\Users\mark_000\AppData\L
ocal\Temp\dev_meter.obj.13196.63.jomThis produces the following error:
cl : Command line error D8021 : invalid numeric argument '/FS'The same command line when run from the Qt environment is:
cl -c -nologo -Zm200 -Zc:wchar_t -FS -O2 -MD -Zc:strictStrings -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SERIALPORT_LIB -DQT_SCRIPT_LIB -DQT_CORE_LIB -DNDEBUG -I"..\prg\io" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtWidgets" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtGui" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtANGLE" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtNetwork" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtSerialPort" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtScript" -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\include\QtCore" -I"release" -I"." -I"." -I"C:\Qt\Qt5.4.0MSVC32\5.4\msvc2013\mkspecs\win32-msvc2013" -Forelease\ @C:\Users\mark_000\AppData\Local\Temp\dev_meter.obj.12616.47.jom
This one produces no errors.
The command lines look mostly the same to me but why would the first one have issues with -FS while the second one does not?
My system is a Windows 8.1 (x64) system but I'm building for Win7x32. So I'm wondering if the setup argument to vcvarsall is wrong.
Anyway a little guidance would be great! Thanks in advance!
Ok for anyone who cares or runs into the the same issue with command line builts here is what I had to learn the hard way:
1st: You need what MSVC does with varsall.bat but you need it for the correct type as in x86, arm, or whatever. So you can turn a regular command prompt into a "compile" prompt by calling the correct varsall.bat in the microsoft tools.
2nd: A warning: I first discovered about "varsall" because one time I tried to run my testing batch file under a "VS2012 x86 native tools command prompt" and it worked. I thought I was on to something, but the warning is this. Even though I have VS2013 installed most of the default tools command prompts setup by installing VS2013 set themselves up for V11 of VS. This is a key issue and what was causing my issue with /FS command line option.
Explanation:
After installing VS2013 if you go and look at "Program Files (x86)" you will set there is "Microsoft Visual Studio 11.0" and "Microsoft Visual Studio 12.0". 11.0 contains a CL compiler that doesn't like the /FS command line. 12.0 works.
Once I got my varsall call pointing to the one in "Program Files (x86)\Microsoft Visual Studio 12.0\VC" everything just started to work.
So the obvious questions:
Yes I am using Qt compiled for MSVC2013. Why wouldn't I know to go to 12.0. I probably should have however one thing that has always confused me is you install "Microsoft Visual Studio 2013" and in your "Start Button" you have "Microsoft Visual Studio 2012". Huh!? This I don't get...
If you look in your start button -> "Microsoft Visual Studio 2012" program group there are a bunch of command line tools. Warning! All of these setup for the 11.0 compiler which gave me the errors above.
So I think some of my confusion is warranted. Things were not named or installed as I would have expected them to be.
If I had to venture a guess I'd say this is because M$ uses Wix I believe to create their MSVC installer. I could be wrong, but to me Wix is a heck of a lot of work and perhaps when they released 2013 rather than change up the installer they just decided to leave some of the old directories around. Just a guess.
So if you can't get your project to compile on the command line and you are replicating the QMake and Jom commands you see in the Qt Creator compile output window and you are using MSVC2013 then hopefully my stumbles will help you along!