TEMPLATE = app doesn't seem to work correctly with Qt Creator 4.11
-
I'm running Ubuntu 18.04, Qt 5.14, Qt Creator 4.11.
I have code that was working with Qt 5.9 on Ubuntu 16.04 that I am migrating to the new platform. The applications build without error and run fine from Qt Creator or the terminal but not from the GUI. The executable file properties show it as shared library (application/x-sharedlib) rather than executable (application/x-executable).
As I understand it, the line TEMPLATE = app near the beginning of the .pro file should take care of this but it doesn't seem to be working as I expect based on the earlier version of Qt Creator.
-
Hi,
What exact Kit are you using ?
What is the compiler ? -
@SGaist
I installed from qt-opensource-linux-x64-5.14.1.runThe only build kit I have set up is Desktop Qt 5.14.1 GCC 64bit (default)
The compiler is shown as GCC (C++, x86 64bit in /usr/bin)
mark@mark:/usr/bin$ g++ --version
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 -
@SGaist
I found this on StackOverflow: https://stackoverflow.com/questions/34519521/why-does-gcc-create-a-shared-object-instead-of-an-executable-binary-according-to
It looks like it might be related to my problem but I'm not sure how to get Qt Creator to link with the -no-pie switch. -
Wait, there's something strange in what you wrote.
You wrote that it worked from Qt Creator and from the console but the from the GUI. Can you give more details about that ?
-
@SGaist
The StackOverflow entry explains it better than I could but essentially, GCC can build a shared library that is executable if it includes main(). Qt Creator is OK with trying to execute it and it works, Terminal will try to do whatever the user tells it and it works. The GUI launcher is apparently smart enough to check the file type before it tries to execute and doesn't want to execute a shared library.
Apparently, the default for the version of GCC that I ended up using is to build this kind of file unless you include the -no-pie switch on the linker. -
Thanks for the summary !