Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt Creator making shared library instead of executable
I am working as a trainee in a company tasked with migrating certain application from Qt 4 to Qt 5. I have made changed to the sources and now the project compiles successfully, but for some reason it always makes a shared library even though it should make an executable.
I have checked the project settings and it clearly states "TEMPLATE = app" so it should be fine. I even tried creating a simple Qt Widget application and compiled it without any changes and even that is compiled into shared library, so something seems to be wrong in Qt Creator (or perhaps my installation).
I am running Kubuntu 17.04 under VirtualBox, hosted under Windows 10. Qt Creator version is 4.4.1. I am used to using OpenSUSE at home, so I am not that familiar with Ubuntu (I installed Kubuntu instead of base Ubuntu, since I hate Unity). Could it be that my installation is missing some important package or I have configured it somehow wrong ?
Yea, I've recently noticed the same.
The app should still run when you run it from cmd like this:
@sierdzio ¨The demo does run, yes, but the actual application complains it can't find libqwt.so.6 (need to solve that problem as well). Running from terminal is not a long term solution, however, since it should be possible to just run the application by clicking on the icon (the application should in fact be usable both from GUI and from terminal, using command parameters for control in latter case). I think it is something about Kubuntu, since I have had no problems with OpenSUSE at home. Guess I'll have to try installing that.
[...] it should be possible to just run the application by clicking on the icon (the application should in fact be usable both from GUI and from terminal, using command parameters for control in latter case). I think it is something about Kubuntu, since I have had no problems with OpenSUSE at home. Guess I'll have to try installing that.
Indeed. Please post here if you find a solution.
In my case, I sometimes use a shell script to run the executable, and in other cases I do full deployment (using linuxdeployqt) with a .desktop file - then it works well and also adds icons to start menu etc.
ChrisW67 last edited by
@TheRealJ The Qwt runtime library needs to be on the system default library path, in a location on the path described by LD_LIBRARY_PATH, or in a location embedded in the application RPath (DT_RUNPATH section). A shell script launcher is the common approach to setting LD_LIBRARY_PATH in a portable fashion.
@sierdzio My solution was to install OpenSUSE in VirtualBox and install Qt Creator on it. Worked like charm first time (well, I needed to install the GL library first). Seems like there is something fishy about Kubuntu...
hbatalha last edited by
I know this is a very old post but I am stating my solution for newcomers and people running into the same issue in hopes it will help them.
I also had this issue and my solution was to add this to my .pro file
QMAKE_LFLAGS += -no-pie
When I had this issue I tried everything suggested and this is the first one that worked. Then I went online to try to see why that worked but didn't find anything right away so I left as it was. Working.
I can't find the link to the forum where I found this now, I had many tabs open then and didn't pay attention to the website name.