I found a small C++ code example (containing a function) that is under CC-BY-SA-4.0 license. I am thinking about revising that example, extending it to multiple functions and using it in a much bigger commercial project. That license is share-alike. AFAIK this means I need to publish the modified code under the same license.

But what exactly are the consequences?

  1. How would I need to publish the code? At the same platform? In the web via HTTP? Or is it enough to provide the code on request by e-mail?
  2. How much would I need to publish? Only the functions that contain parts of the original code? The entire module? Or even the entire project?
  • Is the code itself CC-BY-SA or is it part of an article which is CC-BY-SA?
    – Brandin
    Mar 7, 2019 at 7:32
  • @Brandin: The code itself. Mar 7, 2019 at 8:25

2 Answers 2


Creative Commons (the people who wrote CC-BY-SA 4 and earlier versions) specifically recommend against using any Creative Commons license on software, because:

Unlike software-specific licenses, CC licenses do not contain specific terms about the distribution of source code, which is often important to ensuring the free reuse and modifiability of software. Many software licenses also address patent rights, which are important to software but may not be applicable to other copyrightable works. Additionally, our licenses are currently not compatible with the major software licenses, so it would be difficult to integrate CC-licensed work with other free software. Existing software licenses were designed specifically for use with software and offer a similar set of rights to the Creative Commons licenses.

However, perhaps in recognition of the increasing tendency of developers to license code with CC-BY-SA in particular, for 4.0 and later they added a one-way compatibility clause with the GNU GPL version 3. This means that, instead of distributing your modified code under CC-BY-SA 4, you may choose to distribute it under GPL 3. This is very likely a Good Idea, because the GPL is specifically designed for software and ensures that downstream reusers will share their source code and build scripts.

If you decide to relicense under the GPL, you should comply with all of the standard requirements on a GPL redistribution. Roughly speaking, that means:

  • Make both source code and binaries available in the same way. The usual way to do this is to either bundle them together or to publish them side-by-side but separately. Section 6 of the GPL lists a few alternatives if neither of those options work for you.
  • Include a copy of the GPL in your source distribution, and put a license notice in each file, as the FSF recommends.
  • The FSF also recommends getting a copyright waiver from your school or employer, if applicable.
  • Your source distribution should also include any build scripts or other such materials that are required to build the binaries which you want to distribute. You need not include system libraries or headers.
  • The FSF is of the opinion that the line between separate pieces of software is usually drawn at the process boundary. That is, if you have two or more separate processes, then you may only need to GPL the one which includes the code you started with. However, if you choose to divide your program into a lot of tiny processes that are intimately related and not independently useful, then this analysis may not be applicable and you may have to GPL the whole thing. This is the FSF's opinion, and is not necessarily the actual law.
  • You should place prominent notices in the source code, README, or other ancillary files that are included in the source distribution (such as a changelog), indicating that you modified the code, and when you did so. It may also be wise to indicate what you changed or added (although your version control system should already have that information, changelogs are easier to read).
  • Finally, you should update the copyright notice to add your name and the year(s) of your modifications.
  • The GPL part is interesting, however I am not allowed to publish most parts of the source code of the application. This means GPL would be no option. Regarding my questions... could you be a more explicit please? I guess the lack of rules in the license means I can freely choose how to publish the code. Does this give me the same freedom regarding the amount of published code? Mar 7, 2019 at 9:01
  • @Silicomancer: Since CC licenses were not designed for software, the most we can do is guess. That's why the GPL is, in my opinion, the most straightforward option. Your alternative is to hire a lawyer.
    – Kevin
    Mar 7, 2019 at 17:27
  • I see your point. Alas I can't change the fact that GPL is not possible nor the fact that the original author used a CC license for software. I hoped my situation would be easier to clarify than by hiring professional help. If nobody here is able to help I will need to avoid that code. Mar 7, 2019 at 18:16

The CC BY-SA license has two main requirements

  • Attribution to the original author for the original work (the BY clause of the license)
  • Giving recipients of the derived work you create the same rights that you have received (the SA clause of the license)

This means that you must give the recipients of the derived work that you created the right to make changes to that work and to redistribute. However, as the CC BY-SA license does not differentiate between source code and object code, people that received the compiled product (object code) don't have the right to demand the source code.

The big question is what exactly is the derived work. This probably depends on how the product is structured but it can range from just the revised functions to the entire product.

If you intend to use this code in a commercial product, then I strongly urge you to discuss this with a lawyer specializing in intellectual property rights. The easiest route from a legal perspective is to use the GPL compatibility option outlined in the answer from @Kevin.

  • I would prefer to publish derived source code not object code. Publishing object code feels wrong. However I could publish only the related code, not the entire project. I still wasn't able to clarify if the latter is (probably) legal or not, so I will need to refrain from using that CC code completely :( Mar 9, 2019 at 11:48

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.