Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Static Build Is Very Big
Forum Updated to NodeBB v4.3 + New Features

Qt Static Build Is Very Big

Scheduled Pinned Locked Moved Unsolved General and Desktop
31 Posts 6 Posters 11.7k Views 2 Watching
  • 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.
  • VRoninV VRonin

    I love it very much

    I guess it's a bit like my love of escargot.

    Yes there is Qt but in this particular case only .exe need and very small.

    There is no relation between what IDE you use and the complied output

    And where to use Libcurl, tell me the language of programming where I use Libcurl and then I will only have .exe 300KB

    Almost all C++ compilers can compile and link to C code. Just follow the tutorial

    mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #15

    Just a note

    Did you try
    https://upx.github.io/

    alt text

    Its the charactermap sample static compiled. and then compressed.

    Its fully transparent for the user and very fast decompressor.

    VRoninV 1 Reply Last reply
    4
    • mrjjM mrjj

      Just a note

      Did you try
      https://upx.github.io/

      alt text

      Its the charactermap sample static compiled. and then compressed.

      Its fully transparent for the user and very fast decompressor.

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #16

      @mrjj That is sort of 7zip for .exes if the problem is space on the target device that will not solve very much as the program will be decompressed before it's started.

      It works really well, however, if your problem is transferring the file around

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      mrjjM 1 Reply Last reply
      2
      • VRoninV VRonin

        @mrjj That is sort of 7zip for .exes if the problem is space on the target device that will not solve very much as the program will be decompressed before it's started.

        It works really well, however, if your problem is transferring the file around

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #17

        @VRonin

        Well it decompresses to memory so unless its a size memory issue (on target), it should not matter.

        But of course it wont be as lovely small as curl + pugixml :)

        Taz742T 1 Reply Last reply
        1
        • mrjjM mrjj

          @VRonin

          Well it decompresses to memory so unless its a size memory issue (on target), it should not matter.

          But of course it wont be as lovely small as curl + pugixml :)

          Taz742T Offline
          Taz742T Offline
          Taz742
          wrote on last edited by
          #18

          @mrjj said in Qt Static Build Is Very Big:

          https://upx.github.io/

          It's vey hard for me.

          Do what you want.

          mrjjM 1 Reply Last reply
          0
          • Taz742T Taz742

            @mrjj said in Qt Static Build Is Very Big:

            https://upx.github.io/

            It's vey hard for me.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #19

            @Taz742

            What is very hard ?

            Taz742T 1 Reply Last reply
            0
            • mrjjM mrjj

              @Taz742

              What is very hard ?

              Taz742T Offline
              Taz742T Offline
              Taz742
              wrote on last edited by Taz742
              #20

              @mrjj
              UPX only decompresses .exe?
              UPX can not just make it from my files only .exe ?

              Do what you want.

              mrjjM 1 Reply Last reply
              0
              • Taz742T Taz742

                @mrjj
                UPX only decompresses .exe?
                UPX can not just make it from my files only .exe ?

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #21

                @Taz742

                yes it reduce size of exe.

                its not installer.

                you must produce single exe then compress it.

                Taz742T 1 Reply Last reply
                1
                • mrjjM mrjj

                  @Taz742

                  yes it reduce size of exe.

                  its not installer.

                  you must produce single exe then compress it.

                  Taz742T Offline
                  Taz742T Offline
                  Taz742
                  wrote on last edited by Taz742
                  #22

                  Thank @mrjj very much.
                  If I made my project on Qt and I would make it static build And .Exe will be a maximum of 15 megabytes, UPX will bring it down 15 -
                  min(15 * 50 / 100, 15 * 70 / 100), This is a lot for me.
                  I would be happy with only about 500 kilobytes :(.
                  Let's take the name of everyone skype installer. Where can it be written?
                  Excuse me to get my problems out of Qt. I did not want a flood this topic.

                  Do what you want.

                  E mrjjM 3 Replies Last reply
                  0
                  • Taz742T Taz742

                    Thank @mrjj very much.
                    If I made my project on Qt and I would make it static build And .Exe will be a maximum of 15 megabytes, UPX will bring it down 15 -
                    min(15 * 50 / 100, 15 * 70 / 100), This is a lot for me.
                    I would be happy with only about 500 kilobytes :(.
                    Let's take the name of everyone skype installer. Where can it be written?
                    Excuse me to get my problems out of Qt. I did not want a flood this topic.

                    E Offline
                    E Offline
                    Eeli K
                    wrote on last edited by
                    #23

                    @Taz742 From the beginning of this thread it has been unclear to me what you actually want to do. For example, if you want to have a simple Windows-only application with a graphical user interface which does only one simple thing and whose size goes under 5MB, Qt isn't a good solution for you. See https://blog.qt.io/blog/2017/05/31/qt-lite-qt-5-9-lts/ for size comparison and you can see that under 5MB is so-and so with the Lite system, but under 1MB is unrealistic. The very small applications you see on Windows use some lighweight libraries or maybe only Microsoft's own Windows APIs. The reason they are small is because Windows has many libraries installed by default, not because Qt is bloated. If just under 5MB is acceptable, you can try e.g. wxWidgets, see https://wiki.wxwidgets.org/Reducing_Executable_Size. If you have a command line application without windows and widgets you shouldn't be using Qt in this case at all.

                    1 Reply Last reply
                    3
                    • Taz742T Taz742

                      Thank @mrjj very much.
                      If I made my project on Qt and I would make it static build And .Exe will be a maximum of 15 megabytes, UPX will bring it down 15 -
                      min(15 * 50 / 100, 15 * 70 / 100), This is a lot for me.
                      I would be happy with only about 500 kilobytes :(.
                      Let's take the name of everyone skype installer. Where can it be written?
                      Excuse me to get my problems out of Qt. I did not want a flood this topic.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #24

                      @Taz742 said in Qt Static Build Is Very Big:

                      15 -min(15 * 50 / 100, 15 * 70 / 100), This is a lot for me.

                      I have no idea what this shows.
                      Normally upx compress it to 1/3 of size.

                      1 Reply Last reply
                      0
                      • Taz742T Taz742

                        Thank @mrjj very much.
                        If I made my project on Qt and I would make it static build And .Exe will be a maximum of 15 megabytes, UPX will bring it down 15 -
                        min(15 * 50 / 100, 15 * 70 / 100), This is a lot for me.
                        I would be happy with only about 500 kilobytes :(.
                        Let's take the name of everyone skype installer. Where can it be written?
                        Excuse me to get my problems out of Qt. I did not want a flood this topic.

                        E Offline
                        E Offline
                        Eeli K
                        wrote on last edited by
                        #25

                        @Taz742 About the Qt Lite I would say that it's too much hassle for just one small Windows application (with the caveat that I haven't actually tried it). Without the commercial licence you have to manually edit hundreds of things and then compile Qt. With a commercial licence comes a GUI configuration tool.

                        Taz742T 1 Reply Last reply
                        0
                        • E Eeli K

                          @Taz742 About the Qt Lite I would say that it's too much hassle for just one small Windows application (with the caveat that I haven't actually tried it). Without the commercial licence you have to manually edit hundreds of things and then compile Qt. With a commercial licence comes a GUI configuration tool.

                          Taz742T Offline
                          Taz742T Offline
                          Taz742
                          wrote on last edited by
                          #26

                          @Eeli-K
                          thank for reply.

                          #include <windows.h>
                          #include <commctrl.h>
                          #include <string>
                          
                          #define cli 1
                          #define ser 2
                          #define but 3
                          #define IDI_ICON     101
                          
                          const char ClassName[] = "MainWindowClass";
                          bool enter = true;
                          
                          HWND hWndButton, client, server, button, progress, combo;
                          
                          LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
                          {
                              switch (Msg)
                              {
                                  case WM_CREATE:
                                  {
                                      HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hWnd, 1);
                          
                          			// Create ProgressBar
                          			progress = CreateWindowEx(0, PROGRESS_CLASS, (LPTSTR)NULL,
                          				WS_VISIBLE | WS_CHILD | PBS_MARQUEE,
                          				30, 95, 530, 20,
                          				hWnd, (HMENU)0, hInstance, NULL);
                          				
                                      ShowWindow(progress, SW_HIDE);  // Hide ProgressBar
                                      
                                      // Create ComboBox
                                      combo = CreateWindow(WC_COMBOBOX, TEXT(""), 
                               				CBS_DROPDOWN | CBS_HASSTRINGS | WS_CHILD | WS_OVERLAPPED | WS_VISIBLE,
                              				190, 35, 110, 300, hWnd, NULL, hInstance, NULL);
                              				
                               		SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)"item1"); // add Item
                          			SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)"item2"); // add Item
                          			SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)"item3"); //add Item	
                          			SendMessage(combo, CB_SETCURSEL, 0, (LPARAM)""); // Set Default Item		 
                                      
                          			// Create Install Button	
                                      button = CreateWindowEx(0, "BUTTON", "Install", 
                                      	WS_VISIBLE | WS_CHILD,
                                      	305, 36, 80, 24, 
                                      	hWnd, (HMENU)but, hInstance, NULL);
                                      
                                  }
                                  break;
                                  
                                  case WM_TIMER:
                                  	{
                          				if (wParam == 1) 
                          				{
                          					if (enter)
                          					{
                                                  int pos = SendMessage(progress, PBM_GETPOS, 0, 0) + 3;
                                                  SendMessage(progress, PBM_SETPOS, pos, 0 );
                                                  if (pos == 103) 
                          						{
                                                      enter = false;
                                                  }
                                              }
                                              else
                                              {
                                              	int pos = SendMessage(progress, PBM_GETPOS, 0, 0) - 3;
                                                  SendMessage(progress, PBM_SETPOS, pos, 0 );
                                                  if (pos == -3) 
                          						{
                                                      enter = true;
                                                  }
                          					}
                                          }
                                          return 0;
                                  	}
                          
                                  case WM_COMMAND: 
                                  {
                                      switch (LOWORD(wParam))
                                      {
                                          case but:
                                          {
                                              switch (HIWORD(wParam))
                                              {
                                                  case BN_CLICKED:
                                                  	{
                          								SetTimer(hWnd, 0, 100, NULL);
                                      					SetTimer(hWnd, 1, 100, NULL);
                          								ShowWindow(progress, SW_SHOW); 
                                      					EnableWindow(button,false);
                                      					EnableWindow(combo, false); 
                                      						
                                      					TCHAR strText[255] = {0};
                          								int idx_row = SendMessage(combo, CB_GETCURSEL, 0, 0 );
                          								SendMessage(combo, CB_GETLBTEXT, idx_row, (LPARAM)strText);
                          								MessageBox(0, strText, TEXT("Information"), MB_OK | MB_SYSTEMMODAL);	
                                                      }
                                                  return 0; 
                                              }
                                          }
                                          break;
                                      }
                                      return 0;
                                  } 
                                  break; 
                          
                                  case WM_CLOSE:
                                      DestroyWindow(hWnd);
                                  break;
                          
                                  case WM_DESTROY:
                                      PostQuitMessage(0);
                                  break;
                          
                                  default:
                                      return (DefWindowProc(hWnd, Msg, wParam, lParam));
                              }
                              return 0;
                          }
                          
                          INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
                          {
                              WNDCLASSEX wc;
                              wc.cbSize = sizeof(WNDCLASSEX);
                              wc.style = 0;
                              wc.lpfnWndProc = (WNDPROC)WndProc;
                              wc.cbClsExtra = 0;
                              wc.cbWndExtra = 0;
                              wc.hInstance = hInstance;
                              wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));
                              wc.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));
                              wc.hCursor = LoadCursor(NULL, IDC_ARROW);
                              wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 8);
                              wc.lpszMenuName = NULL;
                              wc.lpszClassName = ClassName;
                          
                              if (!RegisterClassEx(&wc))
                              {
                                  MessageBox(NULL, "Failed To Register The Window Class.", "Error", MB_OK | MB_ICONERROR);
                                  return 0;
                              }
                          
                              HWND hWnd;
                              hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, ClassName,
                              	"Installer",
                              	WS_EX_LAYERED,
                              	CW_USEDEFAULT, CW_USEDEFAULT,
                              	600, 250, NULL, NULL, hInstance, NULL);
                          
                              if (!hWnd)
                              {
                                  MessageBox(NULL, "Window Creation Failed.", "Error", MB_OK | MB_ICONERROR);
                                  return 0;
                              }
                          
                              ShowWindow(hWnd, SW_SHOW);
                              UpdateWindow(hWnd);
                          
                              MSG    Msg;
                              while (GetMessage(&Msg, NULL, 0, 0))
                              {
                                  TranslateMessage(&Msg);
                                  DispatchMessage(&Msg);
                              }
                          
                              return Msg.wParam;
                          }
                          

                          In order to get what I needed to write the WIN API application in Dev C ++.
                          He did not request other and other platforms .dll and other files. (Only .exe).

                          Only this code can only be achieved with the following picture:
                          alt text

                          Now I can not create http file downloader.

                          Do what you want.

                          E 1 Reply Last reply
                          0
                          • Taz742T Taz742

                            @Eeli-K
                            thank for reply.

                            #include <windows.h>
                            #include <commctrl.h>
                            #include <string>
                            
                            #define cli 1
                            #define ser 2
                            #define but 3
                            #define IDI_ICON     101
                            
                            const char ClassName[] = "MainWindowClass";
                            bool enter = true;
                            
                            HWND hWndButton, client, server, button, progress, combo;
                            
                            LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
                            {
                                switch (Msg)
                                {
                                    case WM_CREATE:
                                    {
                                        HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hWnd, 1);
                            
                            			// Create ProgressBar
                            			progress = CreateWindowEx(0, PROGRESS_CLASS, (LPTSTR)NULL,
                            				WS_VISIBLE | WS_CHILD | PBS_MARQUEE,
                            				30, 95, 530, 20,
                            				hWnd, (HMENU)0, hInstance, NULL);
                            				
                                        ShowWindow(progress, SW_HIDE);  // Hide ProgressBar
                                        
                                        // Create ComboBox
                                        combo = CreateWindow(WC_COMBOBOX, TEXT(""), 
                                 				CBS_DROPDOWN | CBS_HASSTRINGS | WS_CHILD | WS_OVERLAPPED | WS_VISIBLE,
                                				190, 35, 110, 300, hWnd, NULL, hInstance, NULL);
                                				
                                 		SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)"item1"); // add Item
                            			SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)"item2"); // add Item
                            			SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)"item3"); //add Item	
                            			SendMessage(combo, CB_SETCURSEL, 0, (LPARAM)""); // Set Default Item		 
                                        
                            			// Create Install Button	
                                        button = CreateWindowEx(0, "BUTTON", "Install", 
                                        	WS_VISIBLE | WS_CHILD,
                                        	305, 36, 80, 24, 
                                        	hWnd, (HMENU)but, hInstance, NULL);
                                        
                                    }
                                    break;
                                    
                                    case WM_TIMER:
                                    	{
                            				if (wParam == 1) 
                            				{
                            					if (enter)
                            					{
                                                    int pos = SendMessage(progress, PBM_GETPOS, 0, 0) + 3;
                                                    SendMessage(progress, PBM_SETPOS, pos, 0 );
                                                    if (pos == 103) 
                            						{
                                                        enter = false;
                                                    }
                                                }
                                                else
                                                {
                                                	int pos = SendMessage(progress, PBM_GETPOS, 0, 0) - 3;
                                                    SendMessage(progress, PBM_SETPOS, pos, 0 );
                                                    if (pos == -3) 
                            						{
                                                        enter = true;
                                                    }
                            					}
                                            }
                                            return 0;
                                    	}
                            
                                    case WM_COMMAND: 
                                    {
                                        switch (LOWORD(wParam))
                                        {
                                            case but:
                                            {
                                                switch (HIWORD(wParam))
                                                {
                                                    case BN_CLICKED:
                                                    	{
                            								SetTimer(hWnd, 0, 100, NULL);
                                        					SetTimer(hWnd, 1, 100, NULL);
                            								ShowWindow(progress, SW_SHOW); 
                                        					EnableWindow(button,false);
                                        					EnableWindow(combo, false); 
                                        						
                                        					TCHAR strText[255] = {0};
                            								int idx_row = SendMessage(combo, CB_GETCURSEL, 0, 0 );
                            								SendMessage(combo, CB_GETLBTEXT, idx_row, (LPARAM)strText);
                            								MessageBox(0, strText, TEXT("Information"), MB_OK | MB_SYSTEMMODAL);	
                                                        }
                                                    return 0; 
                                                }
                                            }
                                            break;
                                        }
                                        return 0;
                                    } 
                                    break; 
                            
                                    case WM_CLOSE:
                                        DestroyWindow(hWnd);
                                    break;
                            
                                    case WM_DESTROY:
                                        PostQuitMessage(0);
                                    break;
                            
                                    default:
                                        return (DefWindowProc(hWnd, Msg, wParam, lParam));
                                }
                                return 0;
                            }
                            
                            INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
                            {
                                WNDCLASSEX wc;
                                wc.cbSize = sizeof(WNDCLASSEX);
                                wc.style = 0;
                                wc.lpfnWndProc = (WNDPROC)WndProc;
                                wc.cbClsExtra = 0;
                                wc.cbWndExtra = 0;
                                wc.hInstance = hInstance;
                                wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));
                                wc.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));
                                wc.hCursor = LoadCursor(NULL, IDC_ARROW);
                                wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 8);
                                wc.lpszMenuName = NULL;
                                wc.lpszClassName = ClassName;
                            
                                if (!RegisterClassEx(&wc))
                                {
                                    MessageBox(NULL, "Failed To Register The Window Class.", "Error", MB_OK | MB_ICONERROR);
                                    return 0;
                                }
                            
                                HWND hWnd;
                                hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, ClassName,
                                	"Installer",
                                	WS_EX_LAYERED,
                                	CW_USEDEFAULT, CW_USEDEFAULT,
                                	600, 250, NULL, NULL, hInstance, NULL);
                            
                                if (!hWnd)
                                {
                                    MessageBox(NULL, "Window Creation Failed.", "Error", MB_OK | MB_ICONERROR);
                                    return 0;
                                }
                            
                                ShowWindow(hWnd, SW_SHOW);
                                UpdateWindow(hWnd);
                            
                                MSG    Msg;
                                while (GetMessage(&Msg, NULL, 0, 0))
                                {
                                    TranslateMessage(&Msg);
                                    DispatchMessage(&Msg);
                                }
                            
                                return Msg.wParam;
                            }
                            

                            In order to get what I needed to write the WIN API application in Dev C ++.
                            He did not request other and other platforms .dll and other files. (Only .exe).

                            Only this code can only be achieved with the following picture:
                            alt text

                            Now I can not create http file downloader.

                            E Offline
                            E Offline
                            Eeli K
                            wrote on last edited by
                            #27

                            @Taz742 "Now I can not create http file downloader" - why not? You don't have http networking features available? Use for example libcurl, it was already mentioned. But this has nothing to do with Qt so you will get better help somewhere else.

                            Taz742T 1 Reply Last reply
                            0
                            • E Eeli K

                              @Taz742 "Now I can not create http file downloader" - why not? You don't have http networking features available? Use for example libcurl, it was already mentioned. But this has nothing to do with Qt so you will get better help somewhere else.

                              Taz742T Offline
                              Taz742T Offline
                              Taz742
                              wrote on last edited by
                              #28

                              @Eeli-K
                              Because libcurl can not be installed for Dev.
                              When I used to use the visual studio and transferred my project to visual studios that I had written on Dev. He asked .dll another computer to connect to the program.

                              Do what you want.

                              jsulmJ E 2 Replies Last reply
                              0
                              • Taz742T Taz742

                                @Eeli-K
                                Because libcurl can not be installed for Dev.
                                When I used to use the visual studio and transferred my project to visual studios that I had written on Dev. He asked .dll another computer to connect to the program.

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by
                                #29

                                @Taz742 said in Qt Static Build Is Very Big:

                                Because libcurl can not be installed for Dev.

                                Did you try to build libcurl with your compiler?

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

                                Taz742T 1 Reply Last reply
                                0
                                • jsulmJ jsulm

                                  @Taz742 said in Qt Static Build Is Very Big:

                                  Because libcurl can not be installed for Dev.

                                  Did you try to build libcurl with your compiler?

                                  Taz742T Offline
                                  Taz742T Offline
                                  Taz742
                                  wrote on last edited by
                                  #30

                                  @jsulm
                                  I tried but I could not

                                  Do what you want.

                                  1 Reply Last reply
                                  0
                                  • Taz742T Taz742

                                    @Eeli-K
                                    Because libcurl can not be installed for Dev.
                                    When I used to use the visual studio and transferred my project to visual studios that I had written on Dev. He asked .dll another computer to connect to the program.

                                    E Offline
                                    E Offline
                                    Eligijus
                                    wrote on last edited by
                                    #31

                                    @Taz742 That's offtopic but you need to link c++ redistributable statically also to have dependancy free application when compiling with MSVC. https://stackoverflow.com/questions/37398/how-do-i-make-a-fully-statically-linked-exe-with-visual-studio-express-2005

                                    1 Reply Last reply
                                    0

                                    • Login

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