Results 1 to 4 of 4

Thread: Building Qt statically

  1. #1

    Default Building Qt statically

    Hi,
    Kind of a newb question. Does building Qt statically ensure me it will run on ANY machine (giving it is the correct platform), without any environment/libs/etc' dependencies, Is is guaranteed to run on any freshly installed Linux?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Building Qt statically

    Statically linking an application means that the library code used by the application is part of the application executable.

    But that library could have also used libraries, so you need to statically link those as well. And so forth.
    Some application or library code might load plugins at runtime, so the code to do that needs to be replaced with build-time link code.

    But yes, if you statically link everything down to including libc you could essentially run the application on top of just the OS kernel.

    In general lots of work for little gain.

    Cheers,
    _

  3. #3

    Default Re: Building Qt statically

    Quote Originally Posted by anda_skoa View Post
    Statically linking an application means that the library code used by the application is part of the application executable.

    But that library could have also used libraries, so you need to statically link those as well. And so forth.
    Some application or library code might load plugins at runtime, so the code to do that needs to be replaced with build-time link code.

    But yes, if you statically link everything down to including libc you could essentially run the application on top of just the OS kernel.

    In general lots of work for little gain.

    Cheers,
    _
    So what would be the best way of building a Qt application in such a way that a freshly installed with no internet connection, would be able to run this?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Building Qt statically

    It depends on what you expect the target system to have already and which things you don't.

    Then you bundle all the things you don't expect to be present and let your start script set e.g. LD_LIBRARY_PATH so that your libraries can be found by the runtime linker.

    Cheers,
    _

Similar Threads

  1. Building shared lib with statically built Qt
    By grayfox in forum Qt Programming
    Replies: 2
    Last Post: 22nd August 2012, 13:48
  2. Building applications statically in Qt
    By mathewjmanavalan in forum Newbie
    Replies: 6
    Last Post: 5th July 2012, 11:59
  3. building qt statically help
    By terhje in forum Installation and Deployment
    Replies: 1
    Last Post: 25th July 2011, 05:11
  4. building qt statically on Mac OSX
    By aarti.nagpal in forum Installation and Deployment
    Replies: 0
    Last Post: 4th February 2011, 10:32
  5. building qt statically
    By eleanor in forum Installation and Deployment
    Replies: 7
    Last Post: 9th May 2009, 10:03

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
  •  
Qt is a trademark of The Qt Company.