Solved Create Linux Executable for Qt Application
-
@SGaist I am not getting any errors. Its just that I want an executable build instead of building an SO file from qt creator. I have set the Template to app in PRO file but still doesn't work.
-
@jineshmehta If your app is starting from QtCreator then it is an executable.
Can you please post the output from "file YOUR_APP_EXE"? It will tell you what it really is.
It could be that the file manager shows the wrong type for whatever reason.The reason why it does not start from explorer is most probably because you did not deploy it properly. See https://doc.qt.io/qt-5/linux-deployment.html
QtCreator prepares the environment before it starts the app, so all Qt libs/plug-ins can be found. But when you start manually from file manager or terminal you have to prepare the environment or create a package (deploy the app). -
@jsulm This is the output from the cmd you asked:
EMAT: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=585d3259887dc7b35fc4cb07d6e0f1f57a77168f, with debug_info, not stripped
-
@jsulm Let me know if the app is deployed properly or not. If not, can you please pin point a location where I can start to look?
-
@jineshmehta said in Create Linux Executable for Qt Application:
can you please pin point a location where I can start to look?
The link I posted before.
The file output looks fine, so please take a look at the link and deploy your app before starting it. -
-
Hi,
I am using pluginandpaint examples from qt for now.
@jsulm I am trying the shared libaray approach for creating my executable. Following is the snap of everything i have :
I tried following instructions provided as follows:
And I should get a executable but no luck. :(
-
@jineshmehta Can you please post the whole pro file as text?
"And I should get a executable but no luck. :(" - I'm sure you get an executable (or is compiling failing? If so please post the errors), as it is working from QtCreator. You're hunting the wrong issue. And you did NOT follow all instructions. You stop after building, but you have to deploy. Please take a look and follow the chapter "Creating the Application Package" in the link I posted. -
@jsulm I have created a small video of the step I am following. Let me know if something is wrong.
FYI :
https://streamable.com/ockbjf -
@jineshmehta Please open a terminal go to the directory where your app was deployed to and start the app. Do you see any errors/warnings?
-
-
@jineshmehta UNIX basics: ./plugandpaint
-
@jsulm It works. But cant we create an executable?
-
@jineshmehta said in Create Linux Executable for Qt Application:
It works. But cant we create an executable?
I don't get it: if it works it is already an executable.
Or do you mean you want to have everything in one single executable? -
@jsulm i want it like send one. Something like qtmaintainence tool
@jineshmehta said in Create Linux Executable for Qt Application:
I am trying to create a executable file on Linux something like maintenance tool (see snap)
I am using Template as app for my qt project like this :
#config
CONFIG += c++11
#template
TEMPLATE = appThe file getting created is a shared library. I don't know why. Please assist.
-
@jineshmehta Sorry, I don't understand what you mean. plugandpaint is your executable, so what do you want to change?
-
@jineshmehta If you're confused by this "shared library" in file manager shown for plugandpaint then this is an issue in the file manager. My file manager also shows "shared library" for executables for whatever reason.
-
@jsulm oh ok. I was confused about that only. Thanks for the clarification.
-
@jsulm I found the problem and the solution as well. Check this out: https://stackoverflow.com/questions/45329372/ubuntu-recognizes-executable-as-shared-library-and-wont-run-it-by-clicking