4

If I understand correctly, the LGPL v2.1 (and the subsequent licenses) allow an user to link a proprietary program to the LGPL licensed library as long as the open source library can be modified and re-linked.

However, what happens if one wishes to link an LGPL software to a proprietary library? I am also confused about why LGPL treats everything as a library.

For example, there is a scientific software routinely used in my field, which is released under the LGPL v2.1. When compiled, the source code produces an executable (and also a library that other softwares can link to). Now, the software needs a BLAS and LAPACK routines, which can be provided by Intel MKL a.k.a. Math Kernel Library. However, Intel MKL is proprietary code. Their simplified software license does allow redistribution of everything (headers, static libraries, dynamic libraries).

Now the thing is that the scientific software does not provide precompiled binaries and only provides source code, which I think causes a lot of problems to beginners in the field. So, I want to distribute precompiled binaries of the software linked to Intel MKL (for free of course). The linking can be static or dynamic.

Am I allowed to do this? I am new to open source, so an explanation in simple words would be the most helpful.

There is another post here that is similar, but I do not understand how linking to the library and from the library are different. I have tried reading the LGPL v2.1 license, but there does not seem to be anything distinguishing them.

3 Answers 3

5

However, what happens if one wishes to link an LGPL software to a proprietary library?

The aim of the GPL (and to a slightly lesser extent the LGPL) is that a recipient of the (L)GPL-licensed code has the right to make changes to any part of the code. For that reason, the GPL stipulates that the entire project must conform to the terms and conditions of the GPL.

The LGPLv3 is an extension to the GPLv3 (and the LGPLv2.1 is a separate license with a similar change compared to the GPLv2) that adds an exception to the requirement that all code must follow the GPL terms and conditions. That exception is carefully written such that it is unidirectional and only gives the code that has a dependency on the LGPL code permission to remain non-free. The permission does not extend to dependencies of the LGPL code itself.

So, I want to distribute precompiled binaries of the software linked to Intel MKL (for free of course). The linking can be static or dynamic.

Am I allowed to do this?

It is not simple.

Without an additional exception to the LGPL license, you are not allowed to distribute a binary version of the software that depends on the Intel MKL. Such an exception is a change in the license and can only be given when all copyright holders agree with it. That might be a problem if the software depends on a third-party LGPL component.

However, if you use dynamic linking and your binary can work with a number of dynamically loaded/linked libraries providing the needed BLAS/LAPACK routines, and you provide multiple versions of that library (where some are under a GPL-compatible open-source license and some are not), then it is less clear-cut that your binary depends on code with a GPL-incompatible license.

As a side benefit, you can also serve people that don't use Intel hardware and thus can't benefit from the Intel MKL.


I am also confused about why LGPL treats everything as a library.

The LGPL license is intended to be used for software that is used as a sub-component in a larger software application. Those sub-components are typically libraries.

If your software is not intended to be used in a larger application, then the exception granted by the LGPL license does not have added value and you could just as easily use the GPL license.

1
  • 1
    We used a similar definition for OpenCL software in Debian -- there are free software implementations, which form a complete stack and can be distributed, so there is no dependency as such on closed source components. The user still needs a license for the required run-time linking, but that is usually handled by the rather liberal licensing of software using OpenCL. Aug 27, 2021 at 10:32
3

From the compatibility matrix in the GPL FAQ, we find that the LGPLv2.1-only and the LGPLv3 are incompatible licenses. If code from software licensed under one of these licenses is copied to software licensed under the other license, the resulting combination must be licensed under GPLv3, according to the compatibility matrix.

Modifications of LGPLv2.1-only code must be licensed under the same license or GPLv2+. Modifications of LGPLv3 code must be licensed under the same license or GPLv3+. Hence the combination of the two must be licensed under GPLv3.

But it's different for the case of libraries.

There's no issue if an LGPLv3 licensed library is used by an LGPLv2.1-only licensed software, or vice versa, according to the same compatibility matrix.

So it looks like a software licensed under an incompatible license, may be used as a library, by an LGPLv2.1 licensed software.

Hence, a proprietary library may be used as a library by LGPLv2.1 licensed library/ software. They must be separated components that can be linked to each other.

Looking into the LGPLv2.1 license text, I surmise that the following section supports this:

  1. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:

a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.

b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

0
0

Probably yes. LGPL allows linking to a program with an incompatible license, and the keyword is "linking". If you are the copyright holder of your program, you can even publish it under the ordinary GPL with a written exception (https://www.gnu.org/licenses/gpl-faq.en.html#GPLIncompatibleLibs).

For the question of why LGPL is treating everything as library, I believe that's because of it was originally called "Library GPL" (now "Lesser GPL"), and was designed to be used on certain libraries. (https://www.gnu.org/licenses/why-not-lgpl.html)

However, if you are writing a very important program, that will be better to ask a lawyer.

4
  • Thank you!. I don't own the LGPL program, nor the library I am linking to. But the main issue I see is that once I link the program statically/dynamically, the source code of the LGPL program cannot be modified and relinked by the end-user. One of the things that LGPL mention is that the LGPL part of the executable has to be modifiable.
    – S R Maiti
    Aug 15, 2021 at 3:10
  • 1
    @SRMaiti If users cannot use your source code to modify and relink, that will not be acceptable by LGPL. But I'm just curious about why can't they redo your process of linking?
    – Moebie Wu
    Aug 15, 2021 at 10:34
  • Because for relinking, the header files(.h) and static libraries(.lib) of Intel MKL would be required. I believe the Intel's license allows distribution of those, but I would rather not go into that much trouble. Is it enough if I point to the link to download those libraries, headers etc. ? Intel MKL is completely free.
    – S R Maiti
    Aug 15, 2021 at 12:33
  • 1
    @SRMaiti According to LGPL v2.1 Section 6d, you can offer the required "materials" (i.e. the materials needed for relinking) but in the license, you must offer them "from the same place" that you offer your Program. Therefore, a link to Intel's site might technically be insufficient depending on how you read this; hosting a copy of the required files on your site (next to your Program) would be much better if it's possible to do that.
    – Brandin
    Oct 13, 2022 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.