Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Running .exe file in ubuntu
QtWS25 Last Chance

Running .exe file in ubuntu

Scheduled Pinned Locked Moved Solved Installation and Deployment
13 Posts 4 Posters 24.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vijaykarthikeyan
    wrote on 8 Aug 2023, 09:42 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hskoglund
      wrote on 8 Aug 2023, 10:41 last edited by
      #2

      Hi, if you don't want to recompile for Ubuntu then you could always try running it under Wine, open a Terminal and type:

      sudo apt install wine
      wine YourExeFile
      
      V 1 Reply Last reply 8 Aug 2023, 11:21
      0
      • H hskoglund
        8 Aug 2023, 10:41

        Hi, if you don't want to recompile for Ubuntu then you could always try running it under Wine, open a Terminal and type:

        sudo apt install wine
        wine YourExeFile
        
        V Offline
        V Offline
        Vijaykarthikeyan
        wrote on 8 Aug 2023, 11:21 last edited by
        #3

        @hskoglund I have the source code and if I want to compile it and build it in ubuntu terminal,does it work ?

        J 1 Reply Last reply 8 Aug 2023, 11:24
        0
        • V Vijaykarthikeyan
          8 Aug 2023, 11:21

          @hskoglund I have the source code and if I want to compile it and build it in ubuntu terminal,does it work ?

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 8 Aug 2023, 11:24 last edited by
          #4

          @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...

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          V 1 Reply Last reply 8 Aug 2023, 12:12
          1
          • J jsulm
            8 Aug 2023, 11:24

            @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...

            V Offline
            V Offline
            Vijaykarthikeyan
            wrote on 8 Aug 2023, 12:12 last edited by
            #5

            @jsulm I have written the file in Qt creator. Is there any tool in Qt to write in cross platforms?

            J 1 Reply Last reply 8 Aug 2023, 12:15
            0
            • V Vijaykarthikeyan
              8 Aug 2023, 12:12

              @jsulm I have written the file in Qt creator. Is there any tool in Qt to write in cross platforms?

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 8 Aug 2023, 12:15 last edited by
              #6

              @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...

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              V 1 Reply Last reply 8 Aug 2023, 12:30
              1
              • J jsulm
                8 Aug 2023, 12:15

                @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...

                V Offline
                V Offline
                Vijaykarthikeyan
                wrote on 8 Aug 2023, 12:30 last edited by
                #7

                @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

                J J 2 Replies Last reply 8 Aug 2023, 12:39
                0
                • V Vijaykarthikeyan
                  8 Aug 2023, 12:30

                  @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

                  J Offline
                  J Offline
                  JonB
                  wrote on 8 Aug 2023, 12:39 last edited by JonB 8 Aug 2023, 12:40
                  #8

                  @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.
                  V 1 Reply Last reply 9 Aug 2023, 05:25
                  0
                  • J JonB
                    8 Aug 2023, 12:39

                    @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.
                    V Offline
                    V Offline
                    Vijaykarthikeyan
                    wrote on 9 Aug 2023, 05:25 last edited by
                    #9

                    @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?

                    J J 2 Replies Last reply 9 Aug 2023, 05:28
                    0
                    • V Vijaykarthikeyan
                      8 Aug 2023, 12:30

                      @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

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 9 Aug 2023, 05:26 last edited by
                      #10

                      @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.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • V Vijaykarthikeyan
                        9 Aug 2023, 05:25

                        @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?

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 9 Aug 2023, 05:28 last edited by
                        #11

                        @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...

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        V 1 Reply Last reply 9 Aug 2023, 05:30
                        1
                        • J jsulm
                          9 Aug 2023, 05:28

                          @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...

                          V Offline
                          V Offline
                          Vijaykarthikeyan
                          wrote on 9 Aug 2023, 05:30 last edited by
                          #12

                          @jsulm ok..thank you for clarifying my doubt.

                          1 Reply Last reply
                          0
                          • V Vijaykarthikeyan has marked this topic as solved on 9 Aug 2023, 05:32
                          • V Vijaykarthikeyan
                            9 Aug 2023, 05:25

                            @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?

                            J Offline
                            J Offline
                            JonB
                            wrote on 9 Aug 2023, 07:29 last edited by
                            #13

                            @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.

                            1 Reply Last reply
                            2

                            1/13

                            8 Aug 2023, 09:42

                            • Login

                            • Login or register to search.
                            1 out of 13
                            • First post
                              1/13
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved