Running .exe file in ubuntu
-
I have .exe file which was compiled in MSVC 2015 64 bit compiler in windows. it is working fine. it includes all the dependencies(dll's) needed for that .exe file.
Now, I want to run this .exe file in ubuntu. Does Qt automatically adopts cross platform compilation.
How to run this .exe file in ubuntu command line?
-
@hskoglund I have the source code and if I want to compile it and build it in ubuntu terminal,does it work ?
-
@Vijaykarthikeyan said in Running .exe file in ubuntu:
in ubuntu terminal,does it work ?
How should we know?
It depends whether this application was written as a cross platform application or not. But you do not provide much details... -
@Vijaykarthikeyan Why don't you simply try to build your application on Linux?
Qt IS a cross platform framework, so if your app uses Qt and no Windows-only stuff then it should build on Linux just fine... -
@jsulm No., the Theme is is not to install Qt every time in each and every end user. We don't know which machine are they running whether it is windows or ubuntu. We can't force them to install Qt . My theme is to give the end user a running block irrespective of the platforms
-
@Vijaykarthikeyan
Depends what you mean by "installing" Qt. End users do not have to install Qt (and still less Qt Creator). Your application should be packaged/deployed with the required dependent Qt libraries. End user just installs your package.We don't know which machine are they running whether it is windows or ubuntu.
Then you won't know what package to give them, for Windows or Ubuntu.
Executable files for one platform do not run on the other platform (Windows<->Linux). This has nothing to do with Qt.
You have 3 choices:
- You compile your app with Qt once under Windows and once separately under Ubuntu. Then you have a choice of executables to deliver to end user.
- The end user uses something like Wine to get Windows executables run under Linux or WSL to get Linux executable to run under Windows.
- You change your Qt application to be a WASM one, that is browser-based so should work under either OS.
-
@Vijaykarthikeyan said in Running .exe file in ubuntu:
the Theme is is not to install Qt every time in each and every end user
Did I say you have to?!
I said you can BUILD your application for Linux.
After building you need to deploy it, so it contains all needed dependencies including Qt libraries and plug-ins. See https://doc.qt.io/qt-6/linux-deployment.html
Keep in mind that there are many many different Linux distribution and if you build on one of them the binary will not necesserily run on all others. -
@Vijaykarthikeyan said in Running .exe file in ubuntu:
Isn't it?
In general yes. Windows != Linux.
You can try to run your Windows build on Linux using Wine, which was already suggested by @hskoglund in this thread... -
-
@Vijaykarthikeyan said in Running .exe file in ubuntu:
@JonB So,You are concluding that single compile file would not support both the environments. We have to compile individually for the platforms. Isn't it?
Absolutely. Qt (which is just a set of C++ libraries) has never said it would produce a single executable which would run cross-platform. That is not possible. What it promises/allows is source code which can be cross-platform. You still have to compile the common source code separately to target one platform versus another.
Unless you are going to pursue the second or third bullet point suggestions in my previous response you will want to do the first, which means separate compilation by you for each platform and you deliver just the appropriate one to each end user. And although cross compilation (you only develop on one of Windows or Linux and on that machine you do one native compilation to target the same OS and a different cross compilation to generate code for the other) may be possible it is simplest/you are likely to want the two platforms yourself and compile your application under each one separately.