Installation problems
-
Hi all,
I am new to Qt development but have experience with C++ using Borland / Embarcadero RADs.So, I have a Window10 boot and a Debian Linux boot on my desktop. I also have a MacBook but haven't tried it on there yet.
I have really basic problems in both the Windows and the Linux installations. Both are 5.11.3Windows:
I can compile and run a gui program from the IDE but cannot run directly from the build directory. Even though the paths to the required libraries are in my system path, the app complains that it can't find them. I copied the required dlls to the build directory and it found them but then came up with a 'cannot start' error.
If I make a console app - a really simple one and run it from the IDE, it sort of works but the window doesn't close at the end of the program - in fact the program doesn't finish until I do Ctrl-C.
If I try and run it from the build directory, it won't run.Linux:
Similar problems but not quite the same.
A gui app runs from the IDE but not from the build directory.
A console app won't run from the IDE? The compile window shows no errors but the application window says that the build folder doesn't exist - this despite the compiler just having built the program there!
If I go to the folder and open a terminal to run the program from the command line then it works up to a point. I do not get a new terminal window but my displayed text appears in the same window and I have to Ctrl-C to stop it.This behaviour is really weird.
By contrast, I tried using Embarcadero 10.3.2 and it all works as normal. A terminal window pops up and says "Hello World" or whatever and then waits for my "Hit any key to continue" keypress and then exits normally and the terminal window closes just as you would expect. If I run it from a terminal window then the program exits and drops me back to the command line, again, just as you would expect.
What is wrong with my Qt installation? I'm sure I'm not doing anything wrong. I am following a Udemy course as posted somewhere on this forum. My output doesn't look like Bryan's!
Of course, I could delete everything and re-install but it's such a big download and takes forever.
Any hints/tips welcome
Colin -
Hi and welcome to devnet,
-
Windows: if you want to run your application outside of Qt Creator, you have to follow the Windows deployment procedure. The most simple here is to call windeployqt that will copy everything needed for your application in the right place. Do NOT modify your PATH environment variable system wide.
-
Run ldd on your application to see what might be missing
As for your console application issue, if you call exec on your QCoreApplication object then it's normal that it doesn't quit as there's an event loop running. If you don't need an event loop, just return 0 without calling exec.
-
-
@SGaist
Many thanks for the info.
Wow, such a lot of files to deploy! Using windeployqt worked fine but couldn't find any documentation on it just what was in the builtin help. I searched the help but only found references to Android, QNX and embedded Linux devices.re. exec - thanks, that wasn't explained.
There are quite a few differences to get used to as I've been using Borland/Embarcadero since the early 90s but as a hobby programmer, not a professional.
Colin -
There are pages for deployment on all platforms. You can see documentation for windeployqt here.
Qt is a framework that provides lots of possibilities, you will have several libraries linked to your application that you will have to deploy. That's completely normal, no worries :-)
-
@SGaist
Hi,
I still have the Linux problem mentioned in my original post.
I can compile this small console app (from the Udemy course) but it will not run from the IDE.
I get the following message:19:50:30: Starting /home/colins2/Qt_Programs/build-qtc14-Linux-Release/qtc14...
19:50:30: The process failed to start. Either the invoked program "/home/colins2/Qt_Programs/build-qtc14-Linux-Release/qtc14" is missing, or you may have insufficient permissions to invoke the program.
19:50:30: Cannot change to working directory "/home/colins2/Qt_Programs/build-qtc14-Linux-Release": No such file or directory
19:50:30: /home/colins2/Qt_Programs/build-qtc14-Linux-Release/qtc14 exited with code -1The program, i.e. the compiled executable is there in the directory specified.
The directory and file are owned by me with the correct user ID in all the profile paths in Qt.
There are no compilation errors and the linker manages to create the folder and put the executable in there.
Why can the IDE not find it at run time?
If I open a terminal window in that directory I can run the program manually without any errors.So, Qt compiles the program without errors.
The linker creates the directory specified in the profile and puts the 'o' file and the executable in there.
The executable runs from the command line without errors.
The IDE cannot find or access the directory.This only happens with a command line app. If I create a simple GUI app, it works from the IDE.
I hope someone has some idea of what is wrong.
Thanks
ColinBTW, the same example app compiles and runs from my Windows 10 installation, albeit very slowly
-
@aha_1980
Hi,colins2@HPZ420-Debian:~$ ls -l ~/Qt_Programs/build-qtc14-Linux-Release
total 48
-rw-r--r-- 1 colins2 colins2 5976 Nov 10 19:48 main.o
-rw-r--r-- 1 colins2 colins2 20404 Nov 10 19:48 Makefile
-rwxr-xr-x 1 colins2 colins2 17872 Nov 10 19:48 qtc14
colins2@HPZ420-Debian:~$
colins2@HPZ420-Debian:~$ file ~/Qt_Programs/build-qtc14-Linux-Release
/home/colins2/Qt_Programs/build-qtc14-Linux-Release: directory
colins2@HPZ420-Debian:~$ ldd ~/Qt_Programs/build-qtc14-Linux-Release
ldd: /home/colins2/Qt_Programs/build-qtc14-Linux-Release: not regular file
colins2@HPZ420-Debian:~$I installed Qt through the Debian package manager.
Thanks -
@Colins2 said in Installation problems:
Please repeat the commands for
~/Qt_Programs/build-qtc14-Linux-Release/qtc14
-
colins2@HPZ420-Debian:~$ ls -l ~/Qt_Programs/build-qtc14-Linux-Release/qtc14
-rwxr-xr-x 1 colins2 colins2 17872 Nov 10 19:48 /home/colins2/Qt_Programs/build-qtc14-Linux-Release/qtc14
colins2@HPZ420-Debian:~$ file ~/Qt_Programs/build-qtc14-Linux-Release/qtc14
/home/colins2/Qt_Programs/build-qtc14-Linux-Release/qtc14: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=2445a751f0a03c5e262fdb646e579407df250cf6, not stripped
colins2@HPZ420-Debian:~$ ldd ~/Qt_Programs/build-qtc14-Linux-Release/qtc14
linux-vdso.so.1 (0x00007fff8578b000)
libQt5Core.so.5 => /lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f1a5f65e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1a5f63d000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1a5f4b9000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1a5f336000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1a5f31c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1a5f15b000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1a5ef3b000)
libicui18n.so.63 => /lib/x86_64-linux-gnu/libicui18n.so.63 (0x00007f1a5ec60000)
libicuuc.so.63 => /lib/x86_64-linux-gnu/libicuuc.so.63 (0x00007f1a5ea91000)
libpcre2-16.so.0 => /lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x00007f1a5ea16000)
libdouble-conversion.so.1 => /lib/x86_64-linux-gnu/libdouble-conversion.so.1 (0x00007f1a5e9ff000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1a5e9fa000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f1a5e8d9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1a5fb8d000)
libicudata.so.63 => /lib/x86_64-linux-gnu/libicudata.so.63 (0x00007f1a5cee9000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f1a5ce75000)
colins2@HPZ420-Debian:~$ -
@Colins2 That looks all pretty good.
So if it does not run in Creator, there might be some environment variables screwed up.
If you have a recent Creator version, you can right click on a file in the project tree and choose "Open terminal with Run environment" and repeat the steps from above.
Regards
-
Okay, I opened the terminal right-clicking from within the IDE as you said. Here's the output:
colins2@HPZ420-Debian:~$ ls -l ~/Qt_Programs/build-qtc14-Linux-Release/qtc14
-rwxr-xr-x 1 colins2 colins2 17872 Nov 10 19:48 /home/colins2/Qt_Programs/build-qtc14-Linux-Release/qtc14
colins2@HPZ420-Debian:~$ file ~/Qt_Programs/build-qtc14-Linux-Release/qtc14
/home/colins2/Qt_Programs/build-qtc14-Linux-Release/qtc14: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=2445a751f0a03c5e262fdb646e579407df250cf6, not stripped
colins2@HPZ420-Debian:~$ ldd ~/Qt_Programs/build-qtc14-Linux-Release/qtc14
linux-vdso.so.1 (0x00007fff8578b000)
libQt5Core.so.5 => /lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f1a5f65e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1a5f63d000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1a5f4b9000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1a5f336000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1a5f31c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1a5f15b000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1a5ef3b000)
libicui18n.so.63 => /lib/x86_64-linux-gnu/libicui18n.so.63 (0x00007f1a5ec60000)
libicuuc.so.63 => /lib/x86_64-linux-gnu/libicuuc.so.63 (0x00007f1a5ea91000)
libpcre2-16.so.0 => /lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x00007f1a5ea16000)
libdouble-conversion.so.1 => /lib/x86_64-linux-gnu/libdouble-conversion.so.1 (0x00007f1a5e9ff000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1a5e9fa000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f1a5e8d9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1a5fb8d000)
libicudata.so.63 => /lib/x86_64-linux-gnu/libicudata.so.63 (0x00007f1a5cee9000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f1a5ce75000)
colins2@HPZ420-Debian:~$The IDE is obviously finding the source files to compile but there is no way to select the debug or release directory from within the IDE.
As the source code is in ~/Qt_Programs/qtc14, is it normal for the compiled program to be in a completely separate directory, i.e. ~/Qt_Programs/build-qtc14-Linux-Release/qtc14?
I'd have expected it to be more like the Windows version and to have created build and release directories under the source directory, e.g.
~/Qt_Programs/qtc14/Build....... and ~/Qt_Programs/qtc14/Release?
I'm restricted to a 10 minute rule on posts at the moment..
-
I just tried modifying the Build and Release directories as mentioned above to:
~/Qt_Programs/qtc14/Build/Release and
~/Qt_Programs/qtc14/Build/Debugwhich to me, are more logical, but I got the same errors.
The files are built in the specified directory and both versions are executable from a terminal window.
Neither will run from the IDE but the error message does reflect the new paths.I'm baffled!
-
What version of Debian are you using ?
-
More info:
I also have a Linux Mint 19.0 boot so I downloaded the installation direct from Qt.io for 64 bit Linux.
This installer ran and downloaded all the necessary tools.I re-created the simple console app from above and it runs perfectly from the IDE (as you would expect)
Qt Creator is a different version to the one I have in Debian, maybe I'd be better off deleting the Debian installation and downloading direct from Qt.io. -
Solved!
Or, at least, problem overcome.
I just couldn't find anything wrong, nor any setting that would stop the program running so I deleted the whole Qt installation and then downloaded and ran the installer from Qt.io as I had with the Mint installation.
I am very pleased to say that everything works as expected now.I still have no idea what the problem was except that it was an older version in the Debian repo and maybe it wasn't totally compatible with the latest distro?
I'll mark this as 'solved' even though the initial problem was not really solved. I guess the moral is to always get the software direct from the Qt site and not from a repo.