I am unable to compile a simple Qt project (an example with the mainwindow). I tried it via command shell and also on QtCreator. first qmake should create makefile with the command rule uic to translate as simple as it should my ui to a .h.
Qt Creator indicating the below warning / error messages on the console.
09:06:30: Running steps for project untitled...
09:06:30: Starting: "D:\QT\qt-everywhere-opensource-src-5.6.0\qtbase\bin\qmake.exe" C:\workspace_llb_27-05-2016\untitled\untitled.pro -r -spec win32-g++
09:06:32: The process "D:\QT\qt-everywhere-opensource-src-5.6.0\qtbase\bin\qmake.exe" exited normally.
09:06:32: Starting: "C:\mingw\mingwx64_481r0-sjlj-rev2\bin\mingw32-make.exe"
C:/mingw/mingwx64_481r0-sjlj-rev2/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/build_untitled_Qt_5_6_0_Built_by_mingwx64_481r0_sjlj_rev2_Debug'
/C/build_untitled_Qt_5_6_0_Built_by_mingwx64_481r0_sjlj_rev2_Debug/uic_wrapper.sh ../workspace_llb_27-05-2016/untitled/mainwindow.ui -o ui_mainwindow.h
Makefile.Debug:318: recipe for target 'ui_mainwindow.h' failed
process_begin: CreateProcess(NULL, /C/build_untitled_Qt_5_6_0_Built_by_mingwx64_481r0_sjlj_rev2_Debug/uic_wrapper.sh ../workspace_llb_27-05-2016/untitled/mainwindow.ui -o ui_mainwindow.h, ...) failed.
make (e=2): Le fichier spécifié est introuvable.
mingw32-make[1]: *** [ui_mainwindow.h] Error 2
mingw32-make[1]: Leaving directory 'C:/build_untitled_Qt_5_6_0_Built_by_mingwx64_481r0_sjlj_rev2_Debug'
Makefile:34: recipe for target 'debug' failed
mingw32-make: *** [debug] Error 2
09:06:33: The process "C:\mingw\mingwx64_481r0-sjlj-rev2\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project untitled (kit: Qt 5.6.0 (Built by mingwx64_481r0-sjlj-rev2))
When executing step "Make"
Thanks
I find the solution eventually. If It happens to me it could happen to anyone. Actually everything have worked before I install gitbash. I set as variable system the bin of gitbash to my path system. However gitbach contains sh.exe which unix tool. So everytime I build via Qtcreator or console 2 uic_wrapper were created one .sh one .bat and all my makefile were unix like. in nutshell never set any UNIX TOOL TO YOUR WINDOWS SYSTEM. Mingw could contain MSYS take care !! at least most of tools oriented development are UNIX like.
I am suspecting something wrong with your Desktop Kit maybe. I tried to create a new default mainwindow project just like how you did and I see the first few steps like below:
14:48:15: Running steps for project untitled...
14:48:15: Starting: "D:\Qt\Qt5.6.0\5.6\mingw49_32\bin\qmake.exe" C:\untitled\untitled.pro -r -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
14:48:16: The process "D:\Qt\Qt5.6.0\5.6\mingw49_32\bin\qmake.exe" exited normally.
14:48:16: Starting: "D:\Qt\Qt5.6.0\Tools\mingw492_32\bin\mingw32-make.exe"
D:/Qt/Qt5.6.0/Tools/mingw492_32/bin/mingw32-make -f Makefile.Debug
You can notice there's a difference between the qmake path my application is using compared to yours.
Mine looks like this: D:\Qt\Qt5.6.0\5.6\mingw49_32\bin\qmake.exe
Yours looks like this: D:\QT\qt-everywhere-opensource-src-5.6.0\qtbase\bin\qmake.exe
And I guess qt-everywhere-opensource-src-5.6.0 looks like the Qt source code that you might have pulled from web. Hope this information gives you some pointer to figure out what's going wrong.
Related
I am trying to compile a Qt5 application from QtCreator on Nixos.
I have created the shell.nix file as described in https://nixos.wiki/wiki/Qt . I start QtCreator as follows:
$ ls -al
...
.rw-r--r-- 236 username 30 Jun 17:31 shell.nix
...
$ nix-shell
[nix-shell:~/myproject]$ qtcreator
QtCreator starts and I can open my project file (myproject.pro).
However, when I "Build Project" [ctrl+b] I get the following error message:
9:38:09: Running steps for project myproject...
19:38:09: Starting: "/nix/store/gkr9j6p60vib8k8bxhc33581fn4pl8d8-qt-full-5.15.2/bin/qmake" /tmp/myproject/myproject.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
19:38:09: The process "/nix/store/gkr9j6p60vib8k8bxhc33581fn4pl8d8-qt-full-5.15.2/bin/qmake" exited normally.
19:38:09: Starting: "/nix/store/lxmh13cqvd2kwc3qbmnjknvynw6lc2si-gnumake-4.3/bin/make" -f /tmp/build-myproject-Desktop-Debug/Makefile qmake_all
make: Nothing to be done for 'qmake_all'.
19:38:09: The process "/nix/store/lxmh13cqvd2kwc3qbmnjknvynw6lc2si-gnumake-4.3/bin/make" exited normally.
19:38:09: Starting: "/nix/store/lxmh13cqvd2kwc3qbmnjknvynw6lc2si-gnumake-4.3/bin/make" -j16
g++ -Wl,-rpath,/nix/store/wn6q10flx0id4yxa96yq1jzpmbvi7d5r-qtwebkit-5.212.0-alpha4/lib -Wl,-rpath,/nix/store/wn6q10flx0id4yxa96yq1jzpmbvi7d5r-qtwebkit-5.212.0-alpha4/lib -Wl,-rpath,/nix/store/gpw8cms1ig5k16d86zr7hkhi77gccl9r-qtwebkit-5.212.0-alpha4/lib -Wl,-rpath,/nix/store/gpw8cms1ig5k16d86zr7hkhi77gccl9r-qtwebkit-5.212.0-alpha4/lib -Wl,-rpath,/nix/store/3sx0lss99gj0krp3xgqz47zipp8fmj18-qtbase-5.14.2/lib -o myproject cobs.o main.o mainwindow.o srm60binarycom.o moc_mainwindow.o -L/nix/store/8jix4ismqsz2pz6gji3zpawdv2k5aqws-libGL-1.3.3/lib /nix/store/3sx0lss99gj0krp3xgqz47zipp8fmj18-qtbase-5.14.2/lib/libQt5Widgets.so /nix/store/3sx0lss99gj0krp3xgqz47zipp8fmj18-qtbase-5.14.2/lib/libQt5Gui.so /nix/store/3sx0lss99gj0krp3xgqz47zipp8fmj18-qtbase-5.14.2/lib/libQt5Core.so -L/nix/store/izvv5r9a8s19l742nfwr72z2w3ijq8bh-libglvnd-1.3.3/lib -lGL -lpthread
/nix/store/qvc6cz5d43jhhm4a3r48xkrc82xh1s95-binutils-2.35.1/bin/ld: cannot find crt1.o: No such file or directory
/nix/store/qvc6cz5d43jhhm4a3r48xkrc82xh1s95-binutils-2.35.1/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:429: myproject] Error 1
19:38:09: The process "/nix/store/lxmh13cqvd2kwc3qbmnjknvynw6lc2si-gnumake-4.3/bin/make" exited with code 2.
Error while building/deploying project myproject (kit: Desktop)
When executing step "Make"
19:38:09: Elapsed time: 00:00.
The errors:
.../ld: cannot find crt1.o: No such file or directory
.../ld: cannot find crti.o: No such file or directory
How can I fix this issue?
This can be due to Qt Creator picking the bare gcc / g++ compiler instead of the wrapped versions. The wrapped version adds some command-line options to make things work.
In my case, I had to go into Tools > Options > Kits and switch the automatically selected C and C++ compilers from the "gcc" one to the "gcc-wrapper" one.
See related discussion at https://discourse.nixos.org/t/nix-shell-cmake-gcc-qt-creator-not-working-together/16703.
I want to name my Qt application as
test <2>
So I write my .pro file as
TEMPLATE = app
TARGET = test\\\ \\\<2\\\>
QT = core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
SOURCES += main.cpp
But it fails when building:
11:14:31: Running steps for project asdf...
11:14:31: Configuration unchanged, skipping qmake step.
11:14:31: Starting: "/usr/bin/make"
/home/erik/Qt/5.11.1/gcc_64/bin/qmake -o Makefile ../asdf/asdf.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
WARNING: DESTDIR: Cannot access directory '../build-asdf-Desktop_Qt_5_11_1_GCC_64bit-Debug/test/ /<2'
/bin/sh: 1: cannot open 2/: No such file
/bin/sh: 1: cannot open 2/: No such file
Makefile:254: recipe for target 'test/ //<2/>' failed
make: *** [test/ //<2/>] Error 2
11:14:31: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project asdf (kit: Desktop Qt 5.11.1 GCC 64bit)
When executing step "Make"
11:14:31: Elapsed time: 00:00.
How should I escape the characters in TARGET?
You shouldn't, and in case of qmake: you can't, since the resulting makefiles will be unusable. Most operating systems reserve those characters, and while a file with such a name may be representable in the filesystem - it can't be used in typical ways. See e.g. Filename:Reserved characters and words for an overview.
The titles of application windows (e.g. as seen here) have nothing to do with file names. You can set them to whatever you want using QWidget's windowTitle property.
I'm using a cross compiled qt 5.4.2 and I getting the following error when I try to build simple QtWidget app (the app is just a window)
09:55:42: Running steps for project untitled...
09:55:42: Configuration unchanged, skipping qmake step.
09:55:42: Starting: "/usr/bin/make"
g++ --sysroot=/home/pf/ssdk-d6cx/host/usr/x86_64-buildroot-linux-gnu/sysroot -Wl,-O1 -Wl,-rpath,/usr/local/qt5.4-d6cx/lib -o untitled main.o mainwindow.o moc_mainwindow.o -L/home/pf/ssdk-d6cx/host/usr/x86_64-buildroot-linux-gnu/sysroot/usr/local/qt5.4-d6cx/lib -lQt5Widgets -L/home/pf/ssdk-d6cx/host/usr/x86_64-buildroot-linux-gnu/sysroot/lib64 -L/usr/local/qt5.4-d6cx/lib -lQt5Gui -lQt5Core -lGLESv2 -lpthread
/home/pf/ssdk-d6cx/host/usr/x86_64-buildroot-linux-gnu/sysroot/usr/local/qt5.4-d6cx/lib/libQt5Core.so: undefined reference to `__cxa_throw_bad_array_new_length#CXXABI_1.3.8'
collect2: ld returned 1 exit status
make: *** [untitled] Error 1
09:55:42: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project untitled (kit: d6cx)
When executing step "Make"
09:55:42: Elapsed time: 00:00.
I really don't understand what is going on.
Could be a compatibility problem with some libs on the target OS?
I will appreciate any help that point me to the solution.
Thanks in advance.
I found the solution to the problem.
The real problem was that I was using Qt Creator as IDE to cross compile and it set qmake to use a device different that the one I was cross compiling for.
I mean the original setting for qmake was:
qmake '/home/pf/D6Cx/test app/untitled/untitled.pro' -r -spec linux-g++
and it should be:
qmake '/home/pf/D6Cx/test app/untitled/untitled.pro' -r -spec devices/linux-d6cx-g++
whith this last one configuration the app is built correctly!!
The way I use to force qmake to use my specific device was (in Qt Creator):
go to Projects/Build setting
in the section Build Steps -> qmake add in Additional arguments:
-spec devices/linux-d6cx-g++
and that will overwrite the original setting for -spec
Thanks!
I currently have a .pro of subprojects template. This .pro file references a lot of other .pro files, each one being a project itself. It compiles, builds and runs.
The problem is that each time I want to run my program, Qt Creator (or perhaps it's make itselfs) checks all projects' status or something like that. For each project it shows the following:
cd A_PROJECT_DIRECTORY && ( test -e Makefile ||
/opt/Qt5.5.1/5.5/gcc_64/bin/qmake A_PROJECT_DIRECTORY/PROJECT_FILE.pro
-spec linux-g++ CONFIG+=debug -o Makefile ) && /usr/bin/make -f Makefile
make[1]: Entering directory `A_PROJECT_DIRECTORY'
make[1]: Nothing to be done for `first'.
make[1]: Leaving directory `A_PROJECT_DIRECTORY'
It takes very little time for each one of those operations but there are so many projects that at the end it has a sensible impact in the edit + build + test workflow.
So, the question is: is there any way to skip those make "tests" or whatever are they and launch immediatly the executable after it has been built? Or some other way to speed up this process?
All the above is in Linux environment.
Thank you very much.
I have downloaded the Sip module for python 2.7, created a makefile and tried the make command on the directory with the makefile, but I get this error:
Makefile:3: recipe for target 'all' failed
mingw32-make[10]: *** [all] Error 2
mingw32-make[10]: Leaving directory 'D:/Users/myLogin/Downloads/python/sip-4.14.5'
I get this error with both Gnuwin and mingw32. So I'm at a loss at what to do now. Any idea?
If you use python configure.py, the generated Makefiles are actually nmake makefiles. nmake is Microsoft's equivalent to make. You can run it by invoking nmake in a Visual Studio command prompt, if you have that installed.
For building with mingw, you have to indicate that you want to use that particular platform when creating the makefiles, as follows:
python configure.py --platform win32-g++
After that, invoking make works fine.
A few details about what happens to you when running make on the nmake makefile. The generated nmake file starts with the following lines:
all:
cd sipgen
$(MAKE)
#cd ..
cd siplib
$(MAKE)
#cd ..
Because each command on each line is executed in a new shell, the result of cd sipgen is actually void. Then, make is invoked again, in the current directory -- this results in an infinite recursive loop of make invocations. The [10] in your error message indicates that it was at the 10th level of recursion. I guess that was the moment that you pressed Ctrl-C :-)