[Qt-interest] Qt 4.5.2 Problem with static library gui.a creation

Thiago Macieira thiago.macieira at trolltech.com
Thu Aug 20 15:54:16 CEST 2009


Em Quinta-feira 20 Agosto 2009, às 15:16:32, Sam Simon escreveu:
> a result, I get file gui.a which size is only 48 KB. So it doesn't have
> qt libraries statically inside it. It doesn't link qt libraries when
> creating the gui.a file. Why?

HI Sam

That's how static libraries work. Static libraries aren't linked. They are 
simply packaged: the .o are simply packaged inside an archive (.a) and that's 
it. The dependencies are not recorded in the .a either.

When the final application is being linked, it must link to all the indirect 
dependencies of all its static libraries.

> I would like to have an independent gui.a file which size would be
> approximately 15 MB. What modifications should I make for the *.pro -file?

You'll need to write your own "link" step. You need to extract all the .o from 
libQtCore.a and libQtGui.a, add your own to the mix, then package them all 
together into your gui.a.

Take a look at ar's manual page to see how to extract files and how to create 
archives. Also, you should run ranlib after creating the .a file.

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Development Frameworks
     Sandakerveien 116, NO-0402 Oslo, Norway

Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14     San Francisco, California: Nov 2 - 4
      http://qt.nokia.com/qtdevdays2009
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090820/e3e16a65/attachment.bin 


More information about the Qt-interest-old mailing list