GCC has a special exception that doesn't force you to use GPL for programs compiled with GCC. If I for example had program foo, how can I apply the classpath/GCC/linking exception to it as well? Do I have to modify the GPLv3 adding the exception or make a separate file stating the exception? Do I have to put a notice on every file that there is a special exception?

  • This exception is somehow surprising for me, maybe future readers could profit if you would cite it in your question. – peterh - Reinstate Monica Dec 20 '20 at 19:23

You should use the GNU Lesser General Public License instead.

It is essentially the GPL with the Classpath exception, but it requires that a user is able to run their own version of the LGPL library in place of the original.

  • But I wish to use GPL because that's what GCC uses. I like the GPL over LGPL. – jay Dec 20 '20 at 14:51
  • I'm confused myself about the difference between the two. All I want is for someone who uses my project foo to not have to have anything made with it not be forced to use GPL and they can use a license of their choice. What must I do to invoke the classpath exception? – jay Dec 20 '20 at 14:53
  • Is the MIT, BSD or Apache license what you want? Or do you want the library itself to be copyleft? – JNic Dec 20 '20 at 14:55
  • 2
    The LGPL is the easiest to add. The LGPL is GPL-compatible. The LGPL is exactly the same as the Classpath and similar exceptions, with an important requirement that a user is able to run their own version of the LGPL library in place of the original. – JNic Dec 20 '20 at 14:57
  • 2
    If you really want to add the Classpath exception, copy and paste from en.wikipedia.org/wiki/…. Where should it go? At the end of the license notice in your files. Confused? Again, the LGPL is your friend. – JNic Dec 20 '20 at 15:00

GCC has a special exception that doesn't force you to use GPL for programs compiled with GCC

Correct. Its output does not have to be under the GPL. Similarly:

  • an image created with Photoshop doesn't need to follow the license that Photoshop is distributed under, even if fancy filters are used
  • a picture taken and edited with an Apple iPhone isn't owned by Apple
  • a document created with Microsoft Word doesn't need to be distributed under the same terms as MS Word itself

These all deal with what the program produces at runtime. GCC adds its own bits of code to the final binary, so it needs the exception to ensure that those small functions don't cause the whole program to be under the GPL. If this applies:

  • Programs that use your library must use the GPL, and
  • Your program includes part of itself in its output, and
  • The part that is included is enough to be copyrightable (e.g. some bits of JSON/XML probably doesn't), and
  • you don't want to place only those specific bits under a more permissive license

then you can consider using some of the GCC Runtime Library Exception. However, it's written very specifically for GCC, and mentions its name and behavior several times, so you'd need to modify it to fit your program. To apply it, add the full text somewhere in your project, and add the specific bits of the standard copyright header to every source file in which it applies.

However, you seem to mix in your question the "GCC Runtime Library Exception" and the "GNU Classpath" exception. If you actually want the latter, and you instead want to allow others to link to your library without being considered under the GPL, use LGPL instead.

Finally, if you truly do not want to "permit modifications of the combined work and reverse engineering for debugging such modifications" and confuse many people who aren't familiar with GPL2 + classpath exception, then use this file as your LICENSE, and add "with the Classpath Exception" in your copyright header in each source file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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