While libstdc++ (and GCC) is licensed under GPLv3 + GCC Runtime Library Exception, and glibc is under LGPLv2.1, the header files (see, for example, <memory> and <vector> for libstdc++-v3) contain additional licenses - for example from Hewlett Packard and SGI and some others.

I need to distribute binaries (compiled for linux; and some object files) dynamically linked with libstdc++ and glibc. I'm not distributing copies of libstdc++ and glibc. Since the code is in C++ and header files contain a lot of templates (and because C's macros exist), I've chose to also add those additional licenses to the mix (in case the templated/macro code is covered by them and inlines).

So, to comply with the terms of the licenses, I've "grepped" all copyright notices from preprocessor output (gcc -C -E) and after a few scripts and a lot of manual checking I ended up with a file like this:

Third party copyright notices and licenses:
<Library name: libstdc++, GCC (build-ins and etc.), glibc>
(notice the difference in spelling and years)
Copyright (c) 1000-1100 Company name
Copyright (c) 1000-1100 Company name, Inc
Copyright (c) 1000 - 1100 Company name, Inc
Copyright (C) 1001-1102 Company name, Inc
Copyright (C) 1208 Company name, Inc.
Copyright (C) 1208 Company name, Inc. <an.email@example.com>
Copyright (C) 1208, 1209-1300 Company name, Inc.
Copyright (c) 1208, 1209, 1300 Company name Inc.
This library is available under the license GPLv3 with GCC Runtime Exception (see below).
In addition, some code is available under different licenses:

Copyright (c) Invividual
Copyright (c) Invividual <email@example.com>
Copyright (C) Invividual Full Name <email@example.com>
<Text of the license>

(repeated several times for different libraries, licenses and notices)

<GPLv3 license text>
<GCC Runtime Exception license text>
<LGPLv2 license text>
<other named licenses>

Keep in mind that some licenses demand to put them in documentation separatedly, so I couldn't just grab the source code and distribute them with my binary.

The process was rather cubersome and unintuitive, as I couldn't find any lists of "add those copyright notices and licenses for this release of GCC/libstdc++/glibc and you are good to go" in the manual or on the internet and had to write regular expressions and scripts myself. I'm still not sure if I've included everything, since I haven't checked the respective non-header source code (I assume that dynamic linking makes my life easier in this regard) and checked only the included files - not to mention that some copyright notices, theoretically, might have had a weird format. Come to think of it, I'm not sure if GCC's built-ins are linked statically (which means that I have to check libgcc's sources) or are separated in libgcc dynamic library.

The binary distribution is a very common task, but to manually re-check every included standard header every time before release doesn't seem right. There has to be a better way and I'm not sure that my process is even correct.

Homework: by googling I've found ScanCode toolkit, which seems to automate the process for arbitrary third-party libraries. As for the license notice format, I'm staring at the "Open Source Software Notice" by Huawei (PDF of several megabytes, no link), which has the similar format of "Software name -> Copyright notices -> License". Mozilla Firefox's "about" section also demonstrates something similar. It's just the lack of specific instructions on automating this common process for standard libraries makes me concerned.

Surely there has to be an automated tool (that can come with the compiler itself) for such a common task as compiling all used in the binary standard library's licenses? How do open-source projects that distribute binaries do this? I'm not experienced in open source - do they just use tools like ScanCode and simply don't talk about it, as it actually something obvious?


I couldn't find any lists of "add those copyright notices and licenses for this release of GCC/libstdc++/glibc and you are good to go" in the manual or on the internet

This is not surprising. As you say, GCC is in its entirety under GPLv3 with the GCC runtime library exception, and glibc is similarly under LGPLv2.1. The former states in s1 that

You have permission to propagate a work of Target Code formed by combining the Runtime Library with Independent Modules, even if such propagation would otherwise violate the terms of GPLv3, provided that all Target Code was generated by Eligible Compilation Processes. You may then convey such a combination under terms of your choice, consistent with the licensing of the Independent Modules.

while the latter states in s6 that

you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice

In other words, as long as you are not distributing any code from glibc or libstdc++, which you say you are not, then you may do almost anything you like and still be licence-compliant. LGPLv2.1 s6 says that

You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License.

though in my experience this is a custom more honoured in the breach than the observance. You will have additional requirements if you link statically against glibc, but you say you are not doing so.

So the likely reason why you can't find any simple "do this and this" lists is that there are nearly no obligations placed upon you when you act as you are acting. You can license your program how you like ("terms of your choice"), proprietary or free, and you can advertise and label it how you like. Strictly, you should honour the labelling requirements of LGPLv2.1 s6 with respect to glibc. But that's it.

| improve this answer | |
  • It's true, that the GCC's stuff as a whole is under GPLv3, but that doesn't mean its every component is. There are "Copyright (c) 1994 Hewlett-Packard Company" and "Copyright (c) 1996 Silicon Graphics Computer Systems, Inc.", that demand to include the copyright notice and their license text ("notice... permission... appear in documentation") right when I open "vector" header file. In fact, there are even more notices like that - even the libstdc++ documentation lists one. The STL is heavily templated, so if any template is under their non-GPL license, then I have to comply with it. – ZebraEel May 22 at 15:03
  • And I simply can't presume that FSF has obtained permission to re-license this code under GPLv3, since then they wouldn't even put different licenses in header files in the first place. Unless HP/SGI's license is about comments only (libstdc++'s documentation mentions "comments and notes"), then it becomes OK - but there's no clarification. – ZebraEel May 22 at 15:04
  • @ZebraEel "It's true, that the GCC's stuff as a whole is under GPLv3, but that doesn't mean its every component is." Yes, it does, that's what GPLv3 s5c means: "You must license the entire work, as a whole, under this License". But in this case it's immaterial because the GCC runtime exception exempts you from all the things GPLv3 would normally require in order for your compliance to make your propagation lawful under the licence: "even if such propagation would otherwise violate the terms of GPLv3". – MadHatter May 23 at 5:07
  • But you can't re-license third-party code when you don't have necessary rights to do so (be it sufficient exclusive rights, sufficient sublicense rights and so on). BSD-licensed library inside GPL software is still BSD-licensed library (see the next comment) apart from any modifications done under GPL. "As a whole" merely means that the entire software in combination should be under GPL - it can't change the license of its components, unless components were modified and contain GPL code (in that case you'll have to obey both GPL and components' license). – ZebraEel May 23 at 9:35
  • See the FAQ: modules may be under various compatible licenses. Also see the GPLv3 §7, 1st paragraph, last sentence ("If additional permissions...") and the second-to last paragraph ("If you add terms..."). The whole §7 is what enables different licenses like BSD, MIT to work with GPL (see subitems a, b, c...). §5.c can't control the code you don't have the control over (3rd-parties didn't agree to the re-licensing), and the Exception is for GPLv3 only - it can't drop requirements under §7.b for 3rd-party licenses. – ZebraEel May 23 at 9:37

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.