Bundling Libraries with Qt Application



  • Hi,

    I am making a Qt Application for Windows and Linux, I have a question,
    I am using Qt LGPL license which is dynamic.
    How can I bundle the dependencies(libraries) other then Qt libraries with my executable for both Windows and Linux?
    Also is it possible to do so if I am using LGPL license?


  • Moderators

    On Windows it's quite easy, just copy the .dll files together with your executable. On Linux, due to security reasons and a different system philosophy, using system libs is preferred. If you insist on bundling, you can do it, but need to set the environment prior to launching your app (namely, LD_LIBRARY_PATH). Take a look at how Qt Creator is working on both platforms - it bundles all libs it uses with it, so it's exactly the scenario you want, isn't it?

    AFAIK, you are allowed to copy and distribute the libraries with your app. You are required to publish any changes to LGPLed libraries (that does not mean your application or other libs you create yourself - just ones that are bound by LGPL. For example, if you have patched QString for your app, you have to publish that patch).



  • Hi,

    Thanks for the reply,
    What I want to do is build a Qt static Application which bundles the dependencies in itself other then Qt libraries.


  • Moderators

    Uh, static is different. There is much discussion about that, but I think the general consensus (tm) is that Qt cannot be included statically under LGPL. But you keep referring to "other libraries" - what do you mean by that? Qt's licensing has nothing to do with other libraries, you have to abide their licenses if you want to include them in your project. Those 2 things are independent.



  • Hi,

    Actually I know that I can't build static Qt Applications under LGPL license, but what my problem is, in linux when I run my executable on another linux machine it gives me error related to many dependencies(Qt libraries and other system libraries), so I thought to bundle the system libraries in my executable and distribute the Qt libraries with my Application, so this way I am not violating Qt's LGPL license.



  • It depends on the lisence of your own application. If your own application is GPL, you might use that. That allows static building. Static building using the Qt LGPL version is dark-grey territory. You have to provide a way to re-link your code to another version of the libraries. If you don't provide sources, that means at least distributing object files. However, opions differ on the question if that is sufficient.

    If you have a closed source application and you want to use static linking, I would recommend you contact Digia for a commercial license on Qt.


  • Moderators

    In general on Linux it's better to use package manager - so a RPM or a DEB. Alternatively - again - take a look into Qt Creator, it does bundle it's libs. Be careful though, as Andre said this is tricky stuff from legal point of view.



  • Hi,

    I don't want to statically build Qt libraries, I just want to statically build the system libraries, for eg: libz


  • Moderators

    So what is still not clear here for you? Both me and Andre have given answers to all of your questions, as far as I can see.

    If you want to compile system libs and the license permits you to do that - feel free to do it.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.