Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, September 2007
Building static libraries for Qt


Message 1 in thread

I'm using Qt 4.3 in Windows, and I'd like to build static libraries for my 
projects to link against.  I only see dlls and files beginning with 
"libQt*.a" in the lib folder after installing Qt.  Does anyone know how I 
can build static libs?  Thanks! 


--
 [ signature omitted ] 

Message 2 in thread

Hello Jim,


On Tue, 4 Sep 2007 22:07:07 -0700 "Jim Bancroft" <sdfsk@xxxxxxx> wrote:

> I'm using Qt 4.3 in Windows, and I'd like to build static libraries for my 
> projects to link against.  I only see dlls and files beginning with 
> "libQt*.a" in the lib folder after installing Qt.  Does anyone know how I 
> can build static libs?  Thanks! 

Those 'dlls' as you say, are what one would call 'static' libs,
provided that they have the .a file extension! It's now up to you to
link statistically against them.


Regards,

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: PGP signature


Message 3 in thread

> Von: wwp
> Hello Jim,
> 
>
> On Tue, 4 Sep 2007 22:07:07 -0700 "Jim Bancroft" <sdfsk@xxxxxxx> wrote:
> 
> > I'm using Qt 4.3 in Windows, and I'd like to build static libraries for
> my 
> > projects to link against.  I only see dlls and files beginning with 
> > "libQt*.a" in the lib folder after installing Qt.  Does anyone know how
> I 
> > can build static libs?  Thanks! 
> 
> Those 'dlls' as you say, are what one would call 'static' libs,
> provided that they have the .a file extension!
That's nonsense! The libQt*.a in /lib are static *import* libs needed to link against Qt*.dll.

@Jim:
You have to rebuild your Qt package with the '-static' option passed to configure.exe. See also http://doc.trolltech.com/4.3/install-win.html (point 1 is not needed for the open source version)

I would not use a precompiled binary package for this task but download the source packages from ftp.trolltech.com/pub/qt/sources


HTH
Christian
-- 
 [ signature omitted ] 

Message 4 in thread

Hello Christian,


On Wed, 05 Sep 2007 08:35:35 +0200 "Christian Ehrlicher" <Ch.Ehrlicher@xxxxxx> wrote:

> > Von: wwp
> > Hello Jim,
> > 
> >
> > On Tue, 4 Sep 2007 22:07:07 -0700 "Jim Bancroft" <sdfsk@xxxxxxx> wrote:
> > 
> > > I'm using Qt 4.3 in Windows, and I'd like to build static libraries for
> > my 
> > > projects to link against.  I only see dlls and files beginning with 
> > > "libQt*.a" in the lib folder after installing Qt.  Does anyone know how
> > I 
> > > can build static libs?  Thanks! 
> > 
> > Those 'dlls' as you say, are what one would call 'static' libs,
> > provided that they have the .a file extension!
> That's nonsense! The libQt*.a in /lib are static *import* libs needed to link against Qt*.dll.

Oh, it seems that I've misread the "and" in "dlls and .. libQt*.a"!


> @Jim:
> You have to rebuild your Qt package with the '-static' option passed to configure.exe. See also http://doc.trolltech.com/4.3/install-win.html (point 1 is not needed for the open source version)
> 
> I would not use a precompiled binary package for this task but download the source packages from ftp.trolltech.com/pub/qt/sources

I don't think that Jim has to rebuild his Qt at all, since the .a files
are there, he just has to explicitly use them. Remember that when
building Qt lib, you have the choice between building the .so, the .a
or both at the same time, the packager of his installed Qt lib has
probably done both.


Regards,

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: PGP signature


Message 5 in thread

> Von: wwp
> Hello Christian,
> 
> On Wed, 05 Sep 2007 08:35:35 +0200 "Christian Ehrlicher"
> <Ch.Ehrlicher@xxxxxx> wrote:
> 
<snip>
> > @Jim:
> > You have to rebuild your Qt package with the '-static' option passed to
> configure.exe. See also http://doc.trolltech.com/4.3/install-win.html
> (point 1 is not needed for the open source version)
> > 
> > I would not use a precompiled binary package for this task but download
> the source packages from ftp.trolltech.com/pub/qt/sources
> 
> I don't think that Jim has to rebuild his Qt at all, since the .a files
> are there, he just has to explicitly use them. Remember that when
> building Qt lib, you have the choice between building the .so, the .a
> or both at the same time, the packager of his installed Qt lib has
> probably done both.
> 
That's not possible on win32 as there is a name clashing between the static and the import libs (therefore we rename the import libs from .a to .dll.a when packaging e.g. the win32libs for kde4/win32). Maybe tt should also use this naming convention.

It's a little bit different on win32... ;)


Christian
-- 
 [ signature omitted ] 

Message 6 in thread

You can try adding the following line to your .pro file:

CONFIG += staticlib release

I'm not sure what this does under Win32 but it does what your asking under 
UNIX.

Karl

On Wednesday 05 September 2007 01:53, wwp wrote:
> Hello Christian,
>
> On Wed, 05 Sep 2007 08:35:35 +0200 "Christian Ehrlicher" 
<Ch.Ehrlicher@xxxxxx> wrote:
> > > Von: wwp
> > > Hello Jim,
> > >
> > > On Tue, 4 Sep 2007 22:07:07 -0700 "Jim Bancroft" <sdfsk@xxxxxxx> wrote:
> > > > I'm using Qt 4.3 in Windows, and I'd like to build static libraries
> > > > for
> > >
> > > my
> > >
> > > > projects to link against.  I only see dlls and files beginning with
> > > > "libQt*.a" in the lib folder after installing Qt.  Does anyone know
> > > > how
> > >
> > > I
> > >
> > > > can build static libs?  Thanks!
> > >
> > > Those 'dlls' as you say, are what one would call 'static' libs,
> > > provided that they have the .a file extension!
> >
> > That's nonsense! The libQt*.a in /lib are static *import* libs needed to
> > link against Qt*.dll.
>
> Oh, it seems that I've misread the "and" in "dlls and .. libQt*.a"!
>
> > @Jim:
> > You have to rebuild your Qt package with the '-static' option passed to
> > configure.exe. See also http://doc.trolltech.com/4.3/install-win.html
> > (point 1 is not needed for the open source version)
> >
> > I would not use a precompiled binary package for this task but download
> > the source packages from ftp.trolltech.com/pub/qt/sources
>
> I don't think that Jim has to rebuild his Qt at all, since the .a files
> are there, he just has to explicitly use them. Remember that when
> building Qt lib, you have the choice between building the .so, the .a
> or both at the same time, the packager of his installed Qt lib has
> probably done both.
>

--
 [ signature omitted ] 

Message 7 in thread

Karl Ruetz skrev:
> You can try adding the following line to your .pro file:
>
> CONFIG += staticlib release
>
> I'm not sure what this does under Win32 but it does what your asking under 
> UNIX.
>   
Sorry, but this is not correct. From the qmake manual:

staticlib: The target is a static library (lib only).

staticlib is used when you build libraries in your own project.

The OP has no choice - rebuild Qt. One of the configuration choices is 
to build a static version.

Bo.

Thorsen Consulting - Qt expert services
www.qt-experts.com


> Karl
>
> On Wednesday 05 September 2007 01:53, wwp wrote:
>   
>> Hello Christian,
>>
>> On Wed, 05 Sep 2007 08:35:35 +0200 "Christian Ehrlicher" 
>>     
> <Ch.Ehrlicher@xxxxxx> wrote:
>   
>>>> Von: wwp
>>>> Hello Jim,
>>>>
>>>> On Tue, 4 Sep 2007 22:07:07 -0700 "Jim Bancroft" <sdfsk@xxxxxxx> wrote:
>>>>         
>>>>> I'm using Qt 4.3 in Windows, and I'd like to build static libraries
>>>>> for
>>>>>           
>>>> my
>>>>
>>>>         
>>>>> projects to link against.  I only see dlls and files beginning with
>>>>> "libQt*.a" in the lib folder after installing Qt.  Does anyone know
>>>>> how
>>>>>           
>>>> I
>>>>
>>>>         
>>>>> can build static libs?  Thanks!
>>>>>           
>>>> Those 'dlls' as you say, are what one would call 'static' libs,
>>>> provided that they have the .a file extension!
>>>>         
>>> That's nonsense! The libQt*.a in /lib are static *import* libs needed to
>>> link against Qt*.dll.
>>>       
>> Oh, it seems that I've misread the "and" in "dlls and .. libQt*.a"!
>>
>>     
>>> @Jim:
>>> You have to rebuild your Qt package with the '-static' option passed to
>>> configure.exe. See also http://doc.trolltech.com/4.3/install-win.html
>>> (point 1 is not needed for the open source version)
>>>
>>> I would not use a precompiled binary package for this task but download
>>> the source packages from ftp.trolltech.com/pub/qt/sources
>>>       
>> I don't think that Jim has to rebuild his Qt at all, since the .a files
>> are there, he just has to explicitly use them. Remember that when
>> building Qt lib, you have the choice between building the .so, the .a
>> or both at the same time, the packager of his installed Qt lib has
>> probably done both.
>>
>>     
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>   

--
 [ signature omitted ] 

Message 8 in thread

Hello,

2007/9/5, Jim Bancroft <sdfsk@xxxxxxx>:
>
> I'm using Qt 4.3 in Windows, and I'd like to build static libraries for my
> projects to link against.  I only see dlls and files beginning with
> "libQt*.a" in the lib folder after installing Qt.  Does anyone know how I
> can build static libs?  Thanks!


Take a look at  http://qtnode.net/wiki?title=Building_static.

regards,
Francisco

--
 [ signature omitted ] 

Message 9 in thread

Thanks for the link.  I followed the steps on the page (configure -static followed by make sub-src) and after 30-40 minutes the rebuild was complete.  However, I still don't appear to have any .lib files?  

I do have a lot of new files in there with .a extensions as well as .prl, along with the dlls that came with my binary distribution, but nothing else.  I did a recursive search of the Qt source directory but I can't find any lib files.  I must be doing something wrong?
  "Francisco Gonzalez" <gzmorell@xxxxxxx> wrote in message news:fffd86390709050504xee1f32apc589e0f4b518709c@xxxxxxxxxxxxxxxxx
  Hello,


  2007/9/5, Jim Bancroft <sdfsk@xxxxxxx>:
    I'm using Qt 4.3 in Windows, and I'd like to build static libraries for my
    projects to link against.  I only see dlls and files beginning with
    "libQt*.a" in the lib folder after installing Qt.  Does anyone know how I 
    can build static libs?  Thanks!

  Take a look at  http://qtnode.net/wiki?title=Building_static.

  regards,
  Francisco 



    --
    To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
    List archive and information: http://lists.trolltech.com/qt-interest/




Message 10 in thread

Jim Bancroft schrieb:
> Thanks for the link.  I followed the steps on the page (configure -static followed by make sub-src) and after 30-40 minutes the rebuild was complete.  However, I still don't appear to have any .lib files?  
> 
> I do have a lot of new files in there with .a extensions as well as .prl, along with the dlls that came with my binary distribution, but nothing else.  I did a recursive search of the Qt source directory but I can't find any lib files.  I must be doing something wrong?
You're using mingw - so .a is correct for static libs.

Christian

--
 [ signature omitted ] 

Message 11 in thread

Jim Bancroft schrieb:
> Thanks for the link.  I followed the steps on the page (configure -static followed by make sub-src) and after 30-40 minutes the rebuild was complete.  However, I still don't appear to have any .lib files?  
> 
> I do have a lot of new files in there with .a extensions as well as .prl, along with the dlls that came with my binary distribution, but nothing else.  I did a recursive search of the Qt source directory but I can't find any lib files.  I must be doing something wrong?
>
You're using mingw - so .a is correct for static libs.

Christian

--
 [ signature omitted ] 

Message 12 in thread

Thanks Christian.  Just so I follow, I should use the ".a" files in Visual 
Studio to link against?

Interesting-- a few of these files are really, really big.  libQtGuid.a for 
instance, is a 369 MB(!) in size.  I notice it has a cousin named 
libQtGuid4.a that is much more reasonable-- 7 MB.  Some other examples are 
to be found in the lib folder, though none quite so pronounced.  Is this 
normal behavior?


"Christian Ehrlicher" <Ch.Ehrlicher@xxxxxx> wrote in message 
news:fbpbft$ntt$2@xxxxxxxxxxxxxxxxxxxxx
> Jim Bancroft schrieb:
>> Thanks for the link.  I followed the steps on the page (configure -static 
>> followed by make sub-src) and after 30-40 minutes the rebuild was 
>> complete.  However, I still don't appear to have any .lib files?  I do 
>> have a lot of new files in there with .a extensions as well as .prl, 
>> along with the dlls that came with my binary distribution, but nothing 
>> else.  I did a recursive search of the Qt source directory but I can't 
>> find any lib files.  I must be doing something wrong?
>>
> You're using mingw - so .a is correct for static libs.
>
> Christian 


--
 [ signature omitted ] 

Message 13 in thread

Jim Bancroft schrieb:
> Thanks Christian.  Just so I follow, I should use the ".a" files in Visual 
> Studio to link against?
> 
You build for mingw so the files can't be used with msvc. The OpenSource 
version does not (officially) support the msvc compiler.


Christian

--
 [ signature omitted ]