Results 1 to 6 of 6

Thread: Release libraries bigger than debug libraries

  1. #1
    Join Date
    Aug 2008
    Posts
    132
    Thanks
    23
    Thanked 3 Times in 3 Posts

    Default Release libraries bigger than debug libraries

    Hi

    I have strange problem where my release libraries are bigger than my debug libraries. What's strange is that it only happens on one machine, for all my own libraries. I've done tests on the following machines with the exact same code base:

    -> Windows 7, Qt 4.8.4 = release libraries smaller than debug libraries as expected
    -> Ubuntu 10.04, Qt 4.8.4 = release libraries smaller than debug libraries as expected
    -> Fedora 17, Qt 4.8.1 = release libraries BIGGER than debug libraries

    As I've said the code and pro file are exactly the same on all machines. I have no idea on what can possibly cause this.

    Here is the PRO file for one of the libraries:
    Qt Code:
    1. TEMPLATE = lib
    2.  
    3. CONFIG(debug, debug|release) {
    4. TARGET = QHexViewd
    5. } else {
    6. TARGET = QHexView
    7. }
    8.  
    9. DESTDIR = $OUT_PWD/../../lib
    10.  
    11. DEFINES += QHEXVIEW_LIBRARY
    12.  
    13. DEPENDPATH += .
    14. INCLUDEPATH += .
    15.  
    16. # Input
    17. HEADERS += QHexView.h QHexView_global.h
    18. SOURCES += QHexView.cpp
    To copy to clipboard, switch view to plain text mode 

    And here is the beginning of the generated Makefile:
    Qt Code:
    1. ####### Compiler, tools and options
    2.  
    3. CC = gcc
    4. CXX = g++
    5. DEFINES = -DQHEXVIEW_LIBRARY -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
    6. CFLAGS = -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
    7. CXXFLAGS = -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
    8. INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I.
    9. LINK = g++
    10. LFLAGS = -Wl,-O1 -Wl,-z,relro -shared -Wl,-soname,libQHexView.so.1
    11. LIBS = $(SUBLIBS) -L/usr/lib64 -lQtGui -lQtCore -lpthread
    12. AR = ar cqs
    13. RANLIB =
    14. QMAKE = /usr/bin/qmake-qt4
    15. TAR = tar -cf
    16. COMPRESS = gzip -9f
    17. COPY = cp -f
    18. SED = sed
    19. COPY_FILE = $(COPY)
    20. COPY_DIR = $(COPY) -r
    21. STRIP =
    22. INSTALL_FILE = install -m 644 -p
    23. INSTALL_DIR = $(COPY_DIR)
    24. INSTALL_PROGRAM = install -m 755 -p
    25. DEL_FILE = rm -f
    26. SYMLINK = ln -f -s
    27. DEL_DIR = rmdir
    28. MOVE = mv -f
    29. CHK_DIR_EXISTS= test -d
    30. MKDIR = mkdir -p
    To copy to clipboard, switch view to plain text mode 

    Any help or hints will be much appreciated.
    Thanks
    Jaco

  2. #2
    Join Date
    Nov 2007
    Posts
    55
    Thanks
    1
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Release libraries bigger than debug libraries

    hello Jaco,

    I am not a linux user, but I searched the equivalent of dependency walker (windows) for *nix and found a perl script to list all dependencies:
    http://www.redhat.com/archives/rhl-l.../msg01670.html

    I hope this can help

    Alain

  3. #3
    Join Date
    Aug 2008
    Posts
    132
    Thanks
    23
    Thanked 3 Times in 3 Posts

    Default Re: Release libraries bigger than debug libraries

    Hi Alain

    Thanks for the response. However the issue is not related to what the library is linking against, its the library itself that is really big that does not make sense. I don't link anything statically against it, everything is linked dynamic.

    Quote Originally Posted by alainstgt View Post
    I am not a linux user, but I searched the equivalent of dependency walker (windows) for *nix and found a perl script to list all dependencies:
    http://www.redhat.com/archives/rhl-l.../msg01670.html
    Linux ships with something similar to Dependency Walker called ldd which shows nothing suspicious.

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

    Default Re: Release libraries bigger than debug libraries

    If you have -g in your CXXFLAGS then debug symbols are being inserted into your library which bloats your library.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    JPNaude (4th April 2013)

  6. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,543
    Thanks
    13
    Thanked 1,577 Times in 1,506 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Release libraries bigger than debug libraries

    Just for comparison, this is what an out-of-the-box Qt 4.8.4 on Linux does for a basic program in release mode:
    Qt Code:
    1. DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
    2. CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
    3. CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
    To copy to clipboard, switch view to plain text mode 
    and debug:
    Qt Code:
    1. DEFINES = -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
    2. CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
    3. CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
    To copy to clipboard, switch view to plain text mode 
    You need to find out where all the other cruft in the CXXFLAGS is coming from.

  7. The following user says thank you to ChrisW67 for this useful post:

    JPNaude (4th April 2013)

  8. #6
    Join Date
    Aug 2008
    Posts
    132
    Thanks
    23
    Thanked 3 Times in 3 Posts

    Default Re: Release libraries bigger than debug libraries

    Hi

    Thanks for the replies.

    After my post I decided to get the Qt 4.8.4 sources and compile Qt myself. After compiling it, I set up as a new kit in Qt Creator and pointed qmake to the qmake I built from the 4.8.4 sources. When I rebuild everything against this newly compiled 4.8.4 version, the problem is gone.

    The culprit was indeed the -g flag which inserted the debug symbols. Not sure why the 4.8.1 qmake created a Makefile with all the other garbage and the 4.8.4 does not. Here is the Makefile from 4.8.4 which gives me nice small release libs again.

    Qt Code:
    1. CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
    2. CXXFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
    To copy to clipboard, switch view to plain text mode 
    Just to be complete in case anyone else runs into this problem:
    I also noticed that after I deployed the application with the big release libraries it does not run properly. Nothing is painted on any widgets and lots of these messages appears:

    Qt Code:
    1. X Error: BadDrawable (invalid Pixmap or Window parameter) 9
    2. Major opcode: 62 (X_CopyArea)
    3. Resource id: 0x2a0007a
    4. X Error: BadDrawable (invalid Pixmap or Window parameter) 9
    5. Major opcode: 62 (X_CopyArea)
    6. Resource id: 0x2a0007a
    To copy to clipboard, switch view to plain text mode 
    The reason for these messages is a bad Qt 4.8.1 linux distro according to http://qt-project.org/forums/viewthread/16819. Thus, I guess I have the same bad 4.8.1 linux distro over here which also has issues in qmake.

    Thanks for the help again.
    Jaco

Similar Threads

  1. Setting up Debug / Release Qt Libraries on Linux
    By gmat4321 in forum Installation and Deployment
    Replies: 3
    Last Post: 8th September 2011, 05:22
  2. Debug libraries
    By enno in forum Installation and Deployment
    Replies: 3
    Last Post: 9th February 2011, 17:18
  3. Replies: 3
    Last Post: 20th March 2008, 14:26
  4. Libraries in debug mode ?
    By SteM in forum Installation and Deployment
    Replies: 5
    Last Post: 8th August 2007, 10:28
  5. Replies: 11
    Last Post: 22nd March 2006, 19:06

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.