I’m starting to work on a C library, and I am having trouble choosing a license, so I need some help.
Keeping in mind that:
- I want as many people as possible to be able to use my lib, without them worrying about license compatibility, both for libre and proprietary programs;
- My lib is designed to be statically linked, so its license must allow static linking without compromises;
But, also:
- I want for whoever uses my lib to credit me: I think mentioning my library’s name, optionally with an URL to my repo and the license text copypasted, in the final software’s documentation / credit page / whatever would be enough;
- I want for people that make changes to my library, and then use the modified version in their program, be it free or proprietary, to publish the modified source code of my library, under my license (but they can keep the rest of their program under whatever license they want).
What license should I choose? I really have no idea.
I think that if I only cared about the first 3 points, I could choose MIT, but considering the last one?
LGPL has restrictions on static linking, actually. It’s one of the reasons why SDL 2.0 had to recently drop it in favour of the zlib license. So, not really a good choice in my case, it goes against point 2 of mine.
The zlib license, however, doesn’t respect point 3 and 4.
I heard of a LGPL with static linking exception (no additional restrictions on static linking), but it’s not vastly used, so I don’t know much about that. Maybe you do?
Ahh didn’t know about that. What restrictions are there exactly?
Maybe you do?
Sorry :/
If you use an LGPL library in a proprietary program or with incompatible open licenses:
- If you dynamically link, you can keep your parts of the program under your license;
- If you statically link, you have to make sure that an user can actually modify the parts of the LGPL library in your program. For proprietary programs, this means that the developers would have to distribute their unlinked .o files, which quickly becomes a mess (and, on some platforms, notably embedded ones, it becomes a real mess).
Today I learned. Interesting. I did not know about this at all. Never mind, then.
Very good and accurate explanation! More info at GNU’s FAQ.
This is the first licence that came to my mind as well.
I think it should be what we are looking for here.Not ideal for static linking, though (see other replies to this comment).
Personally I think a BSD license (or similarly an MIT license), is best at meeting your “primary” goals. Note the traditional BSD license does require attribution.
However your last goal is somewhat contradictory with your first goals, so choosing a matching existing license to combine this last goal is difficult.
Personally I’ve decided to use the Creative Commons Attribution-ShareAlike 4.0 International License for my software (even though it is not strictly recommended for software). I attach my own specific terms, as seen here:
Actually CC BY-SA was the first license that came to my mind for accomplishing this goal, but yeah, not ideal at all for code. Code projects that use this are actually considered non-free.
But still, thanks!
For some of my simple scripts, config files, and HTML+CSS templates, I actually do use CC BY-SA already though (mostly for convenience, for example I have my whole website licensed under CC BY-SA, including my CI scripts (maybe 30 lines total, the bulk of my code is in a static site generator I released as AGPL3) and HTML+CSS code, because text and media are like 90% of the entire thing)
Code projects that use this are actually considered non-free.
Why?
Because it explicitely doesn’t grant patent rights.
Just a few weeks ago, Fedora tackled this issue by announcing the stop on accepting CC0 (license that is actually really popular for software, in comparison to CC BY-SA) software: https://www.theregister.com/2022/07/25/fedora_sours_on_creative_commons/
All Creative Commons licenses have this issue, not only CC0, including CC BY-SA.
Patent rights don’t apply to me as much – I live in Canada, and though it’s a bit more complicated than I let on here, we effectively don’t have software patents.
deleted by creator
LGPL is the license that fits more to your requirements but as some responses already pointed out, only dynamic linking would be allowed, not static linking too as you want. Perhaps you could create a new (non free) license based on LGPL license, but I don’t recommend you to do that.
In your case, you can weight up the dual licensing. If you publish the code under LGPLv3 license AND copyright license, like MySQL does, people will understand that it’s a free software project; they can choose the LGPL version for dynamic linking and the other version when they need to link statically.
To avoid further problems and keep a unique software project, you would ask software contributors (if any) to assign the copyright of the modification to you, so you can keep both version of the software (the LGPLed and the copyrighted one) always exactly the same.
For a big project this is risky, because someone could say no and create a fork of the LGPLed version of your project with his/her modifications, but if it’s a little project and you explain that the copyrighted version is just to allow static linking for those developers they need it, I don’t think you will have problems.
NOTE: in the copyright license you will need to explain that the software can’t be modified (at least that exact version), that can be used, copied and distributed freely without previous permission, that dynamic and static linking is explicitly allowed, that you require authorship recognition this way, and that for all the usages not requiring static linking you recommend the LGPL licensed version of the library. This is just a proposal.
Oh, I didn’t think of this, might be an option, thank you!
A question: for the contributors copyright, instead of having all contributors have to give the copyright to me, can I just say that all contributions have to be made under my same double license directly by the contributor? This way everyone retains their own copyright but the double-license thing can still stand. Or am I missing something here?
In case the free version and the proprietary version of the software can be slightly different (the free version’s source code is on a public repository, but the proprietary one is in another place and some files are different), you must ensure that the contributor really understands there is another version of the software and his/her contribution is going to be added to that version too. And perhaps in the proprietary version you will need to merge the contribution in a different way, and in the future remove or extend that part. How can the contributor agree now or in the future what you do and how you do if he/she can’t even see that software? It’s weird and probably that’s way people use to recommend to give the copyright to the proprietary version owner. Actually, I’m not sure.
Anyway, in your case, if the repository is unique and public (and will be in the future), and both licenses are clearly referenced (LICENSE files, README file and source files), I think contributors don’t need to give you the copyright and can contribute just normally. Note that you don’t want to say that both license apply, but that one of them apply in a given moment. You can’t use SPDX in your case because one of the licenses will not be free, but I’m talking about something equivalent to the OR operator of this specification.
I have been thinking about this subject and my opinion about dual licensing for this case has changed. Let me explain:
The dual licensing requires you to create a non free license different to the other LGPLv3 license. I think it’s complex to write a good and clear license with the requirements you want: dynamic and static linking, authorship recognition… In case you need to modify the license in the future, you need to write it in a way that the contributions of the past automatically will accept the new license. Finally, you could end writing the whole LGPL license again just changing the linking part!
For that reason, perhaps the most simple and secure way to do what you want to do is just use the LGPLv3 license with the linking exception just the same way other projects already do (follow the link to see 3 examples). This is what @octt@feddit.it mentioned at first. Basically you create a LICENSE file containing the LGPLv3 license (as many libraries and software projects do) and above the license you include the exception:
All files in this repository are licensed as follows. If you contribute to this repository, it is assumed that you license your contribution under the same license unless you state otherwise.
This software is licensed under the LGPLv3, included below.
As a special exception to the GNU Lesser General Public License version 3 (“LGPL3”), the copyright holders of this Library give you permission to convey to a third party a Combined Work that links statically or dynamically to this Library without providing any Minimal Corresponding Source or Minimal Application Code as set out in 4d or providing the installation information set out in section 4e, provided that you comply with the other provisions of LGPL3 and provided that you meet, for the Application the terms and conditions of the license(s) which apply to the Application.
Except as stated in this special exception, the provisions of LGPL3 will continue to comply in full to this Library. If you modify this Library, you may apply this exception to your version of this Library, but you are not obliged to do so. If you do not wish to do so, delete this exception statement from your version. This exception does not (and cannot) modify any license terms which apply to the Application, with which you must still comply.
As far as I know, this will make the software to become not free according to GNU, but at least you will get what you want in a quite reliable way.
Actually, LGPL with linking exception seems quite a good solution. I will probably use this, then. Thanks again!