Results 1 to 9 of 9

Thread: To large exe file

  1. #1
    Join Date
    Jan 2009
    Location
    Prague, CZE
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question To large exe file

    Hi,
    i compiled my program under winXP as static application (here is how-to wich i used http://wiki.qtcentre.org/index.php?t...c_applications) and its too large (its simple one widget application and it has about 70MB) because i use QNetwork module and QGui module...

    Please help. I need to run this application on PCs where are not installed QT libraries but 70MB software is too much.

    Thanks!

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: To large exe file

    Are you sure you compiled it in release mode?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2009
    Location
    Prague, CZE
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: To large exe file

    Quote Originally Posted by jpn View Post
    Are you sure you compiled it in release mode?
    If i try it, it has about 300kB but there are no libraries included. Program crashes on start with "cannot find QtCore4.dll" message.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: To large exe file

    Do you have Qt compiled statically in release mode?

  5. #5
    Join Date
    Jan 2009
    Location
    Prague, CZE
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: To large exe file

    Quote Originally Posted by wysota View Post
    Do you have Qt compiled statically in release mode?
    /data_server_client.pro
    Qt Code:
    1. SUBDIRS += src
    2. TEMPLATE = subdirs
    3. CONFIG += static \
    4. release
    To copy to clipboard, switch view to plain text mode 

    /src/src.pro
    Qt Code:
    1. SOURCES += data_server_client.cpp \
    2. magicpacketsender.cpp \
    3. daemonclient.cpp \
    4. main.cpp
    5. HEADERS += data_server_client.h \
    6. magicpacketsender.h \
    7. daemonclient.h
    8. TEMPLATE = app
    9.  
    10. CONFIG += static \
    11. release
    12.  
    13. TARGET = data_server_client
    14. DESTDIR = ../bin
    15. RESOURCES = application.qrc
    16. QT += network
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: To large exe file

    The instructions in our wiki tell you to pass "-release -static" (and "-no-exceptions" if you have MinGW) while configuring Qt. Apparently you didn't pass "-release", because the Qt libraries were built in debug mode.

    Edit: Oh, and you should have a separate installation for dynamic and static builds of Qt. Don't try to build a dynamic installation statically, but grab the Qt sources and do a static build for those.
    Last edited by jpn; 24th January 2009 at 16:28. Reason: updated contents
    J-P Nurmi

  7. #7
    Join Date
    Jan 2009
    Location
    Prague, CZE
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: To large exe file

    Quote Originally Posted by jpn View Post
    The instructions in our wiki tell you to pass "-release -static" (and "-no-exceptions" if you have MinGW) while configuring Qt. Apparently you didn't pass "-release", because the Qt libraries were built in debug mode.

    Edit: Oh, and you should have a separate installation for dynamic and static builds of Qt. Don't try to build a dynamic installation statically, but grab the Qt sources and do a static build for those.
    My qmake.conf
    Qt Code:
    1. #
    2. # qmake configuration for win32-g++
    3. #
    4. # Written for MinGW
    5. #
    6.  
    7. MAKEFILE_GENERATOR = MINGW
    8. TEMPLATE = app
    9. #CONFIG += qt warn_on release link_prl copy_dir_files debug_and_release debug_and_release_target precompile_header
    10. CONFIG += qt warn_on release incremental flat link_prl precompile_header autogen_precompile_source copy_dir_files debug_and_release debug_and_release_target
    11. QT += core gui
    12. DEFINES += UNICODE QT_LARGEFILE_SUPPORT
    13. QMAKE_COMPILER_DEFINES += __GNUC__ WIN32
    14.  
    15. QMAKE_EXT_OBJ = .o
    16. QMAKE_EXT_RES = _res.o
    17.  
    18. QMAKE_CC = gcc
    19. QMAKE_LEX = flex
    20. QMAKE_LEXFLAGS =
    21. QMAKE_YACC = byacc
    22. QMAKE_YACCFLAGS = -d
    23. QMAKE_CFLAGS =
    24. QMAKE_CFLAGS_DEPS = -MT
    25. QMAKE_CFLAGS_WARN_ON = -Wall
    26. QMAKE_CFLAGS_WARN_OFF = -w
    27. #QMAKE_CFLAGS_RELEASE = -O2
    28. QMAKE_CFLAGS_RELEASE = -O2
    29. QMAKE_CFLAGS_DEBUG = -g
    30. QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
    31.  
    32. QMAKE_CXX = g++
    33. QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
    34. QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS
    35. QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
    36. QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
    37. QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
    38. QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
    39. QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
    40. QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
    41. QMAKE_CXXFLAGS_RTTI_ON = -frtti
    42. QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti
    43. QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads
    44. QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -fno-exceptions
    45.  
    46. QMAKE_INCDIR =
    47. QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
    48. QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
    49.  
    50. QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src
    51. QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
    52. QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src
    53. QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
    54.  
    55. QMAKE_LINK = g++
    56. #QMAKE_LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
    57. QMAKE_LFLAGS = -static -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
    58. QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl
    59. QMAKE_LFLAGS_EXCEPTIONS_OFF =
    60. QMAKE_LFLAGS_RELEASE = -Wl,-s
    61. QMAKE_LFLAGS_DEBUG =
    62. QMAKE_LFLAGS_CONSOLE = -Wl,-subsystem,console
    63. QMAKE_LFLAGS_WINDOWS = -Wl,-subsystem,windows
    64. QMAKE_LFLAGS_DLL = -shared
    65. QMAKE_LINK_OBJECT_MAX = 10
    66. QMAKE_LINK_OBJECT_SCRIPT= object_script
    67.  
    68.  
    69. QMAKE_LIBS =
    70. QMAKE_LIBS_CORE = -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
    71. QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32
    72. QMAKE_LIBS_NETWORK = -lws2_32
    73. QMAKE_LIBS_OPENGL = -lopengl32 -lglu32 -lgdi32 -luser32
    74. QMAKE_LIBS_COMPAT = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32
    75. QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqtmain
    76.  
    77. !isEmpty(QMAKE_SH) {
    78. MINGW_IN_SHELL = 1
    79. QMAKE_DIR_SEP = /
    80. QMAKE_COPY = cp
    81. QMAKE_COPY_DIR = xcopy /s /q /y /i
    82. QMAKE_MOVE = mv
    83. QMAKE_DEL_FILE = rm
    84. QMAKE_MKDIR = mkdir
    85. QMAKE_DEL_DIR = rmdir
    86. QMAKE_CHK_DIR_EXISTS = test -d
    87. } else {
    88. QMAKE_COPY = copy /y
    89. QMAKE_COPY_DIR = xcopy /s /q /y /i
    90. QMAKE_MOVE = move
    91. QMAKE_DEL_FILE = del
    92. QMAKE_MKDIR = mkdir
    93. QMAKE_DEL_DIR = rmdir
    94. QMAKE_CHK_DIR_EXISTS = if not exist
    95. }
    96.  
    97. QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc.exe
    98. QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic.exe
    99. QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc.exe
    100.  
    101. QMAKE_IDL = midl
    102. QMAKE_LIB = ar -ru
    103. QMAKE_RC = windres
    104. QMAKE_ZIP = zip -r -9
    105.  
    106. QMAKE_STRIP = strip
    107. QMAKE_STRIPFLAGS_LIB += --strip-unneeded
    108. load(qt_config)
    To copy to clipboard, switch view to plain text mode 

    Is it OK? I am using MinGW

  8. #8
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: To large exe file

    Yes, it looks fine (-static was added to QMAKE_LFLAGS). The next step is to run configure:
    configure -static -release -no-exceptions
    J-P Nurmi

  9. The following user says thank you to jpn for this useful post:

    wydesenej (24th January 2009)

  10. #9
    Join Date
    Jan 2009
    Location
    Prague, CZE
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: To large exe file

    Quote Originally Posted by jpn View Post
    Yes, it looks fine (-static was added to QMAKE_LFLAGS). The next step is to run configure:
    Nice, it works Thanks!!!

Similar Threads

  1. Replot large wav file data
    By Sachtech in forum Qwt
    Replies: 1
    Last Post: 6th January 2009, 09:12
  2. large file handling
    By sakthi in forum Qt-based Software
    Replies: 1
    Last Post: 30th October 2008, 00:34
  3. large file management
    By sakthi in forum Qt Programming
    Replies: 1
    Last Post: 22nd October 2008, 08:13
  4. open large file in qt?
    By vishal.chauhan in forum Qt Programming
    Replies: 11
    Last Post: 29th May 2007, 07:25
  5. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.