文档开发者中心
我的

常见的开源License例外条款

采用GPL或者LGPL许可的开源软件有着最严格的开源义务履行要求,一般情况下,修改、链接GPL软件是需要对外开源的。不过“There is no general rule without some exception(任何法规均有例外)”,GPL类license的条款中也有着一些例外,正是因为这些例外保证我们可以借助开源构筑一个宏大的技术架构,而不用担心受到法务风险的威胁,下面主要给大家总结一下常见的开源License例外条款:


第一类:GPL类License的链接例外


No.1  GCC运行时库例外

GCC是一款应用广泛的C/C++语言程序编译器,其采用GPLv3 License发布。用过GCC的同学可能留意过一个细节,当用户使用GCC编译程序时,GCC可能会将一些头文件一并编译到目标程序中,形成事实上的“静态链接”。按照GPLv3的要求,这些目标代码会被GCC的GPLv3 License“感染”而需要被动开源。

这就相当有意思了,用了GCC,岂不是自家代码都得对外开源了?如果你看了GCC在业界编译器市场的占有率,就会知道事情没有这么简单——原来GCC的GPLv3许可是有例外条款的,下面让我们来看看这个例外条款长啥样——

When you use GCC to compile a program, GCC may combine portions of certain GCC header files and runtime libraries with the compiled program. The purpose of this Exception is to allow compilation of non-GPL (including proprietary) programs to use, in this way, the header files and runtime libraries covered by this Exception.

Source:

简单来说,就是为了让GCC作为通用编译器能够编译出非GPL License许可的程序(包括私有/商用程序),GCC对可能会编译进目标程序的头文件和运行时库做了例外。当然,这么做也不是没有约束条件的,你要保证整个编译过程是“纯净”的,即保证你没有使用其他的非GPL软件去优化/影响整个编译过程。

最后有人会问,到底哪些文件会得到例外,主要包括包括libgcc、libstdc++、libfortran、libgomp、libdecnumber、libgcov以及其他和GCC一起发布的库。


No.2  GNU Classpath例外

上面说到了C,下面讲一下Java。看过上一节的同学,应该会马上反应过来,Java已经采用GPL License对外开源(),那基于java开发的代码也需要对外开源吗?

先把结论告诉大家,不需要,至少你不需要因为调用jdk的方法和使用jvm运行java代码而被动开源自己的项目。

原因就在于Java采用了GNU Classpath例外——

Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination.

As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.

Source:

如果你只是调用JDK的方法或者使用JVM的公共API,那么目标代码就不受GPL License的约束。


No.3  LGPL链接例外

这种例外情况特别少,出现在glibc中。通过fossology工具对glibc的扫描,我们发现有个别文件的LGPL许可描述中出现这样一段话——

In addition to the permissions in the GNU Lesser General Public License, the Free Software Foundation gives you unlimited permission to link the compiled version of this file with other programs, and to distribute those programs without any restriction coming from the use of this file. (The GNU Lesser General Public License restrictions do apply in other respects; for example, they cover modification of the file, and distribution when not linked into another program.)

如果目标代码链接了glibc中的某些文件,那么是可以不受LGPL许可的约束。被豁免的文件清单如下:

csu/elf-init.c

stdlib/atexit.c/

stdlib/at_quick_exit.c

io/stat.c

io/fstat.c

io/lstat.c

io/stat64.c

io/fstat64.c

io/lstat64.c

io/fstatat.c

io/fstatat64.c

io/mknod.c

io/mknodat.c

debug/warning-nop.c

debug/stack_chk_fail_local.c

nptl/pthread_atfork.c


第二类:GPL类内容例外


常见的就是字体依赖:

GPL Font exception

按照GPL的逻辑,如果一个字体采用GPL许可发布,那么采用该字体的数字文献(例如可以在网上传播的各种word/pdf/图片等)也会被当做是“衍生作品”而被开源。为了避免这一情况发生,作者可以在GPL许可中增加字体例外——

As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.

Source:https://www.gnu.org/licenses/gpl-faq.html#FontException


总结:

任何开发人员都应该像爱护我们的自研代码一样,关注开源代码,了解使用开源软件的成本、风险以及需要履行的义务。随着理解的深入,你会慢慢对开源的玩法(也就是License)所吸引。开源之道,博大精深,需要我们大家一起来探索。

其他更多的License例外可以参考:


——————————————————


BY:HW-LZ

点赞
收藏
回复
4
分享
举报
浏览1381 发布于2019-10-30 03:42未知归属地
全部评论
最多点赞
最新发布
最早发布

蛮难的样子,我不会


4楼回复于2019-10-30 14:50 未知归属地

这个,我也搞不明白


3楼回复于2019-10-30 14:43 未知归属地

开源之道,博大精深,欢迎大家回帖分享

2楼回复于2019-10-30 03:43 未知归属地

作为一名开发人员,开源代码也是需要关注的!

1楼回复于2019-10-30 03:43 未知归属地
写回答
新增插入模板功能
一键使用模板,快速填写内容,轻松发帖~
知道了
  • 为了保障您的信息安全,请勿上传您的敏感个人信息(如您的密码等信息)和您的敏感资产信息(如关键源代码、签名私钥、调试安装包、业务日志等信息),且您需自行承担由此产生的信息泄露等安全风险。
  • 如您发布的内容为转载内容,请注明内容来源。

我要发帖子

了解社区公约,与您携手共创和谐专业的开发者社区。