PDA

View Full Version : Static vs.dinamic linking (LGPL)



cpuinthebrain
27th June 2015, 07:27
Hi,

I'm about to make a simple program for OS X.
As i read in order to cover LGPL rules i shoud use only dynamic linking to Qt.
What does it mean?
In Qt there is a tool macdeployqt which generate OSX App.Inside the needed libraries are included and this is standalone independent app.Is it static?Is Dinamic when we make an installer and the Qt libraries are installed on the machine separately?

ChrisW67
27th June 2015, 08:24
Static linking: The parts of the Qt libraries you use are actually built into your program executable at compile/link time. The aim (usually) is to make a single -file program that does not need separate Qt libraries in support. To do this you would have to build your own Qt libraries to support static linking.

Dynamic linking: Your program binary is separate from the dynamic libraries for Qt and connected to them only at run time. Whether the Qt libraries are provided in the application bundle or pre-installed on the system is not relevant. All the pre-built library bundles from the Qt Project site are dynamic library bundles.

The LGPL requires that anyone you distribute your program to is able to relink your program to a modified/later Qt version. This can be arranged with statically linked program (by distributing the source, or object files and a way for the user to link them) but it is more difficult than using a dynamically linked executable where they can simply replace the Qt library binaries.

cpuinthebrain
27th June 2015, 08:50
does it mean that using macqtdeploy and get standalone app with Qt libraries inside as seprate files is dynamic linking and is OK with LGPL?

ChrisW67
27th June 2015, 21:54
If you are using only the pre-built binaries from the Qt Project then you will be dynamic linking.
If you have not built your own Qt libs for static linking, and arranged your project to link with that version, then you are probably using dynamic linking.

Macedeployqt produces a bundle containing your program and its Qt dependencies, if any, as private frameworks. Users of that bundle can replace the Qt frameworks if they wish.
I suggest you read the documentation so you understand what goes into a bundle
http://doc.qt.io/qt-5/osx-deployment.html

The linking style is not the only condition of the LGPL you might have to meet.

dongeng
27th June 2015, 22:34
Static linking: The parts of the Qt libraries you use are actually built into your program executable at compile/link time. The aim (usually) is to make a single -file program that does not need separate Qt libraries in support. To do this you would have to build your own Qt libraries to support static linking.

Dynamic linking: Your program binary is separate from the dynamic libraries for Qt and connected to them only at run time. Whether the Qt libraries are provided in the application bundle or pre-installed on the system is not relevant. All the pre-built library bundles from the Qt Project site are dynamic library bundles.

The LGPL requires that anyone you distribute your program to is able to relink your program to a modified/later Qt version. This can be arranged with statically linked program (by distributing the source, or object files and a way for the user to link them) but it is more difficult than using a dynamically linked executable where they can simply replace the Qt library binaries. http://mazpics.science/44/g.png
good answer, Thanks for sharing

cpuinthebrain
28th June 2015, 08:07
thank you.

I thing i cover LGPL requirements.No change of Qt, dynamic liinking, basic Qt modules for OS X.