Qt 5.1 with VS2012 compiler - code 128 error - qt

I am trying to set up Qt 5.1 with MS Visual Studio 2012 compiler. I have downloaded and installed the VS Express (it works and compiles C++ code just fine) and then installed Qt.
Here is the console output from whenever I try to build anything:
09:07:14: Running steps for project cube...
09:07:14: Starting: "C:\Qt\Qt5.1.0\5.1.0\msvc2012_64\bin\qmake.exe" C:\Qt\Qt5.0.2\5.0.2\msvc2012_64\examples\opengl\cube\cube.pro -r -spec win32-msvc2012 "CONFIG+=debug" "CONFIG+=declarative_debug" "CONFIG+=qml_debug"
09:07:15: The process "C:\Qt\Qt5.1.0\5.1.0\msvc2012_64\bin\qmake.exe" exited normally.
09:07:15: Starting: "C:\Qt\Qt5.1.0\Tools\QtCreator\bin\jom.exe"
Usage: jom #commandfile
jom [options] [/f makefile] [macro definitions] [targets]
nmake compatible options:
/A build all targets
/D display build information
/E override environment variable macros
/F <filename> use the specified makefile
/G display included makefiles
/H show help
/I ignore all exit codes
/K keep going - build unrelated targets on error
/N dry run - just print commands
/NOLOGO do not print logo
/P print makefile info
/R ignore predefined rules and macros
/S silent mode
/U print content of inline files
/L same as /NOLOGO
/W print the working directory before and after other processing
/X <filename> write stderr to file.
/Y disable batch mode inference rules
jom only options:
/DUMPGRAPH show the generated dependency graph
/DUMPGRAPHDOT dump dependency graph in dot format
/J <n> use up to n processes in parallel
/KEEPTEMPFILES keep all temporary files
/VERSION print version and exit
Error: unknown command line option '-' in arguments: '/L-IC:/QNX650/target/qnx6/usr/include'
09:07:15: The process "C:\Qt\Qt5.1.0\Tools\QtCreator\bin\jom.exe" exited with code 128.
Error while building/deploying project cube (kit: Desktop Qt 5.1.0 MSVC2012 64bit)
When executing step 'Make'
09:07:15: Elapsed time: 00:01.
Earlier I had the same problem with 5.0.2 (basically that's why I killed it and installed 5.1).
I couldn't Google anything reasonable regarding this kind of error. Looks like 128 propagates from somewhere within Visual Studio, but I can't figure out what it is.
Could anybody suggest how can I debug and fix this?
Thanks

... And there's nothing that helps you figure out the problem better than writing it down and then starting at the post.
The "/L-IC:/QNX650/target/qnx6/usr/include" actually tells me that QNX SDK installed on my machine is messing with my environment variables. Luckily, Qt has a way of dealing with that. I need to go to Projects tab, expand the "build environment" section and unset the "MAKEFLAGS" environment variable. This fixes it.

Related

How to build Qmake for Visual studio project? specifically for QGLViewer for octomap library

I need to build an octomap on visual studio 2017. According to website they have asked to do the following
open a windows shell (e.g., from the START-Menu -> QT)
cd octovis/src/extern/QGLViewer
qmake -t vclib QGLViewer.pro -spec win32-msvc2010 (ignore any warnings)
So I did the same but in windows command prompt terminal and when I feed the above commands it throws the following error:
#qmake -t vclib QGLViewer.pro -spec win32-msvc2010
Could not find qmake spec 'win32-msvc2010'.
Error processing project file: QGLViewer.pro
#qmake -t vclib QGLViewer.pro -spec win32-msvc2017
Could not find qmake spec 'win32-msvc2017'.
Error processing project file: QGLViewer.pro
What should I do in order to configure and generate a QGLViewer.vcxproj?
Additional details:
Project location : "C:\software\octomap-1.9.0\octomap-1.9.0\octovis\src\extern\QGLViewer"
qmake location : C:\vcpkg\packages\qt5-base_x64-windows\tools\qt5
Visual studio : 2017 ( Version 15.9.8)
Any help in regards to this would be much appreciated as I have a very limited understanding on qmake.
You can build QGLViewer with Qt Creator instead, and then it just works - I was bashing my head against the same issue as you for a while, but then just tried that and it solved my problems. For what it's worth, I used Qt Creator 4.12.4 and did a build all.
I had a few other issues building Octovis on Windows that you might run up against as well. See here for the changes I had to make: https://github.com/OctoMap/octomap/compare/devel...sgolodetz:winchanges

Appveyor - Compiling static qt5.10 application (with openssl and qml webview)

I'm trying to set up autobuild appveyor on my Qt project.
My app is using qt5.10.1, with qml and openSSL features.
I'm lost... I didn't know from where to start :/
# 1:
I found some examples of .apveyor.yml config files, but they are all using mingw32 compilator which do not allow me to use qml webview module (why)... I didn't find what I have to write in my appveyor config file to compile my app with msv2017 where is the compilator ?
Actually, my appveyor.yml looks like that (I try to do as QtCreator is doing on my local computer but it's not working)
image: Visual Studio 2017
branches:
only:
- master
install:
- set QTDIR=C:\Qt\5.10.1\msvc2017_64
- set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw530_32\bin;%PATH%;
build_script:
- qmake app/QRegovar.pro -spec win32-msvc
- qmake_all
- C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release
deploy:
- provider: GitHub
artifact: C:/projects/qregovar
draft: true
prerelease: false
on:
branch: master
appveyor_repo_tag: true
And it's failling with the following error:
Build started
git clone -q --branch=master https://github.com/REGOVAR/QRegovar.git C:\projects\qregovar
git checkout -qf 7357eb2adab349c4de9e0b346dc99027964ea5a5
Running Install scripts
set QTDIR=C:\Qt\5.10.1\msvc2017_64
set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw530_32\bin;%PATH%;
qmake app/QRegovar.pro -spec win32-msvc
Project ERROR: Cannot run compiler 'cl'. Output:
===================
===================
Maybe you forgot to setup the environment?
Command exited with code 3
# 2:
I'm also wondering if appveyor is using qt static build ? As I would like to create "ready to use" package for the user ?
I'm using CMake, but I guess the trick is to setup 'cl' compiler into PATH, so qmake is able to find it.
In sample appveyor scripts the main build script is '.\qtmodules-travis\ci\win\build.bat'. This script will check/use AppVeyor matrix-defined variable for platform (line 7+) and then the script define VC_DIR etc.
And on the end is invoking script referred by you 'build-msvc.bat' where is invoked:
call %VC_DIR% %VC_VARSALL% || exit /B 1
QtCreator will do the setup for you (you are using Kits...)
When you are building in clean command line, you should do 'vcvarsXXX.bat call yourself before 'qmake' call.
In my opinion AppVeyor doesn't trigger this call for you, because developer may wish different build env. setup (e.g. x86, x64, arm etc.). It's your choice. Actually this is the hint as well when you start 'Qt command line' on your PC from start menu (it call 'C:\Qt\5.11.0\msvc2017_64\bit\qtenv2.bat' shell setup script)

Can't Install QtMobility [Windows 64-bit]

I've downloaded and installed the QT SDK and downloaded the QT Mobility source.
Following the provided instructions, I navigated to my QtMobility directory via the Visual Studio Command Prompt (2010)... note, this is the QtMobility dir with the bin, plugins, examples, etc. folders.
D:\
cd D:\Files\Downloads\QtMobility
configure
Regardless of whether I gave configure a -prefix parameter or not, the following output was displayed:
Checking available Qt
4.8.2
Checking make
... Unknown target environment .
Cannot find 'nmake', 'mingw32-make' or 'make' in your PATH
Aborting.
Of course, I then went to see if my computer had nmake in its PATH: the directory is added as follows:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
I went to CMD and typed in "nmake /?" to receive proper output.
What am I doing wrong? When I try to simply run nmake in the QTMobility directory, it displays:
NMAKE : fatal error U1064: MAKEFILE not found and no target specified
Stop.
Help, please! Thank you. :) I will continue attempting debugs on my own...
I suppose this is late but you could simply run the visual studio command prompt, as it has specific env. variables preset to find nmake, etc.

Qt Compile Time Error . .

I am new to Qt, and I am facing the follwoing error. I have set all the environment variables. I don't know what the problem is. Kindly Help me.
11:44:39: Running build steps for project rabiaapp...
11:44:39: Configuration unchanged, skipping qmake step.
11:44:39: Starting: "C:\QtSDK\QtCreator\bin\jom.exe"
c:\QtSDK\Desktop\Qt\4.8.0\msvc2008\bin\uic.exe ..\rabiaapp\mainwindow.ui -o ui_mainwindow.h
C:\QtSDK\QtCreator\bin\jom.exe -f Makefile.Debug
Error: cannot open C:\Windows\main.obj.5540.16.jom for write
jom 1.0.8 - empower your cores
jom: C:\Users\rs01\rabiaapp-build-desktop-Qt_4_8_0_for_Desktop_-_MSVC2008__Qt_SDK__Debug\Makefile [debug] Error 1
11:44:39: The process "C:\QtSDK\QtCreator\bin\jom.exe" exited with code 2.
Error while building project rabiaapp (target: Desktop)
When executing build step 'Make'
I can reproduce this problem if I check "Clear system environment" on the Projects' Build Settings page. Try unchecking that box.
I encountered a similar problem. My TMP variable has Chinese characters, which makes qt creator produce error: cannot open ** for write.
Try to change your TMP variable with only English characters, no spaces. Ensure that the folder exists and you have permissions to access it.
My Qt version: Qt 5.4.0 for Windows 32-bit (VS 2013, OpenGL). You can set this in Qt Creator
Try using nmake instead of jom there should be a checkbox in Settings-> Build and Run -> uncheck use jom instead of nmake.

How to use Ant with NetBeans C++ Qt applications

I'm using NetBeans C++ to build a simple Qt application. Here is what I did:
From 'File' I chose 'New project'
In the 'New project' window I selected C/C++ category and C/C++ Qt application
Then I clicked Next and on the second frame I renamed my project to 'Test'
Clicked 'Finish' and the sample project was created successfully (is is also the only project open so it is treated as the main project).
From 'Run' I chose 'Build Main Project' - the action was successful
Then I created an Ant script to build the same project from the console:
<?xml version="1.0"?>
<project name="Test.linux" default="My.Test" basedir="../..">
<description>Linux projects build</description>
<target name="My.Test">
<echo>Building my Test Linux project.</echo>
<exec executable="make" failonerror="true" dir="Test">
<arg value="-f"/>
<arg value="Makefile"/>
<arg value="clobber"/>
</exec>
</target>
</project>
When I run this script I get a peculiar error:
Test.linux:
[echo] Building my Test Linux project.
My.Test:
[echo] Building my Test Linux project.
[exec] for CONF in Debug Release ; \
[exec] do \
[exec] "make" -f nbproject/Makefile-${CONF}.mk QMAKE= SUBPROJECTS= .clean-conf; \
[exec] done
[exec] make[1]: Entering directory `/home/myusr/Development/Projects/Test'
[exec] VPATH=. -o qttmp-Debug.mk nbproject/qt-Debug.pro
[exec] /bin/sh: -o: not found
The build fails. After looking at the make files I found the following lines in Makefile-Debug.mk:
# Link Libraries and Options
LDLIBSOPTIONS=
nbproject/qt-${CND_CONF}.mk: nbproject/qt-${CND_CONF}.pro FORCE
${QMAKE} VPATH=. -o qttmp-${CND_CONF}.mk nbproject/qt-${CND_CONF}.pro
mv -f qttmp-${CND_CONF}.mk nbproject/qt-${CND_CONF}.mk
I don't understand why ${QMAKE} VPATH=. -o qttmp-${CND_CONF}.mk nbproject/qt-${CND_CONF}.pro is unacceptable and what is actually wrong.
After some pondering I noticed that NetBeans sets the value of ${QMAKE} to /usr/bin/qmake, but when I call the ant script it stays an empty string. So my question is rather how NetBeans knows where to find the qmake - is there a project setting or is it a setting of the IDE itself. Should I rely on the fact that the qmake path is always this '/usr/bin/qmake' and set ${QMAKE} variable in the ant script manually or is there another way to solve this?
Qt itself uses QTDIR to check which installation to use in case if you have several versions installed. Some linux distributions doesn't set this environment variable since in most cases it's not needed.
Good way to find out which Qt version to use is:
1) Check if ${QTDIR} exists. In this case qmake is located under ${QTDIR}/bin directory
2) If ${QTDIR} doesn't exists try to find qmake in the directories specified by ${PATH} env variable. For example using which command.
This method is used by SCons qt4 build tool (unofficial third party module for this build system). I think it should be simple to implement this algorithm with ant.

Resources