Results 1 to 6 of 6

Thread: Dynamic vs. static in Linux (DLL analogs in Linux)

  1. #1
    Join Date
    Aug 2009
    Posts
    122
    Thanks
    74
    Qt products
    Qt4
    Platforms
    Windows

    Question Dynamic vs. static in Linux (DLL analogs in Linux)

    Hi,

    I know how to compile Qt apps statically and dynamically in Windows. Now I'm trying to do the same in Linux.
    My questions:

    1. Windows Qt has DLL's which you can put in the same folder with your compiled program if you compiled dynamically. What are the Linux analogs of DLL? Where are they located in Ubuntu? Do they work the same as in Win (i.e. simply put the right ones in the same folder with your executable)?

    2. Are there any instructions on how to compile statically for Linux?

    Thanks!

  2. #2
    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: Dynamic vs. static in Linux (DLL analogs in Linux)

    Quote Originally Posted by timmu View Post
    What are the Linux analogs of DLL?
    Files with "so" (shared object) extension.

    Where are they located in Ubuntu?
    Usually in system directories under /usr/lib or /usr/local/lib but you can point the linker elsewhere using LD_LIBRARY_PATH.

    Do they work the same as in Win (i.e. simply put the right ones in the same folder with your executable)?
    No, that would be a stupid security risk.

    2. Are there any instructions on how to compile statically for Linux?
    Build static Qt libs (and possibly other libraries you want static) and link your application against them just like you do with Windows.
    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.


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

    timmu (23rd January 2012)

  4. #3
    Join Date
    Aug 2009
    Posts
    122
    Thanks
    74
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Dynamic vs. static in Linux (DLL analogs in Linux)

    Hi,
    Thanks for your help.

    I typically compile my program like this:

    qmake -project
    qmake
    make

    This compiles dynamically. How do I compile statically? I'm assuming that the pro file will have to be changed by inserting a couple of new rows before I do "make". Is that correct? But how, are there instructions on how to change the pro file?

    Thanks!

  5. #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: Dynamic vs. static in Linux (DLL analogs in Linux)

    Quote Originally Posted by timmu View Post
    How do I compile statically?
    [wiki]Building static applications[/wiki]
    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.


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

    timmu (23rd January 2012)

  7. #5
    Join Date
    Aug 2009
    Posts
    122
    Thanks
    74
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Dynamic vs. static in Linux (DLL analogs in Linux)

    Thanks, Wysota

    I actually also found that link. But it seems that I need to build Qt itself statically to compile statically. How is that done? And is it going to interfere with the dynamic version of Qt which I currently have on my computer?

  8. #6
    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: Dynamic vs. static in Linux (DLL analogs in Linux)

    Quote Originally Posted by timmu View Post
    I actually also found that link. But it seems that I need to build Qt itself statically to compile statically. How is that done?
    Everything is described in the wiki.
    And is it going to interfere with the dynamic version of Qt which I currently have on my computer?
    No.
    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.


Similar Threads

  1. Qt 4.7.4 Static Link for Linux Info
    By bob2oneil in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2011, 10:54
  2. build 32 bit dynamic app on a 64 bit linux OS
    By yodasoda in forum Installation and Deployment
    Replies: 0
    Last Post: 24th April 2010, 01:44
  3. Static linking problem in Linux
    By daou in forum Qt Programming
    Replies: 1
    Last Post: 25th October 2009, 09:10
  4. Static linking in Linux
    By anupamgee in forum Qt Programming
    Replies: 4
    Last Post: 2nd June 2009, 14:34
  5. problem on static linking in Linux.
    By anupamgee in forum Installation and Deployment
    Replies: 1
    Last Post: 29th May 2009, 13:45

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.