8

If a program is licensed under GPL, I have the right to receive the source code along with the binary.

But what if only commercial (non-free) compilers exist to compile the code?

This would make it expensive to actually modify the program. But would it be in violation of the GPL?

3
  • 4
    Does this answer your question? Do you violate the GPL if you provide source code that cannot be compiled? Commented May 22, 2023 at 21:15
  • 1
    @PhilipKendall Partly. I understand that you need to add detailed instructions how to compile, like Makefiles, Maven POMs etc. But it does not say whether the whole toolchain to build needs to be open source as well. I mean, I could write perfectly detailed instructions how to compile my COBOL code for the Java Virtual Machine, but require that you have the Visual COBOL compiler for this, which is commercial. Commented May 23, 2023 at 7:16
  • 3
    @JFabianMeier Most likely a COBOL compiler would be understood as a "general-purpose tool" and therefore does not need to be distributed along with the program. Although it would be nice if you tried to make it somewhat compatible with free COBOL compilers, doing so is not required by the license -- after all, the GPL is what allows interested parties to take your GPL code and do that porting work themselves if they are so inclined.
    – Brandin
    Commented May 23, 2023 at 7:52

1 Answer 1

8

There is no requirement that the compiler has to be open sourced.

Only the build scripts like Makefiles, CMakeLists.txt, Maven POM have to be open sourced.

If the compiler is not open source, somebody could take the GPL-ed source code and port it to be built using another compiler which is open source.

From GPLv3:

The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.

The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.

The GPL FAQ also states that "which programs you used to ... compile it ... usually makes no difference for issues concerning the licensing of that source code".

Can I release a program under the GPL which I developed using nonfree tools? (#NonFreeTools)

Which programs you used to edit the source code, or to compile it, or study it, or record it, usually makes no difference for issues concerning the licensing of that source code.

However, if you link nonfree libraries with the source code, that would be an issue you need to deal with. It does not preclude releasing the source code under the GPL, but if the libraries don't fit under the “system library” exception, you should affix an explicit notice giving permission to link your program with them. The FAQ entry about using GPL-incompatible libraries provides more information about how to do that.

8
  • 3
    For this to work, it depends a bit on the details and seems that the required compiler would have to fall under the definition of "... or general-purpose tools or generally available free programs ...". That is, if the required tool is a commercial C compiler (a non-free one), then I believe that would qualify -- it's not a free program, but it is a general-purpose tool. However, if the company have created their own custom language compiler and are not distributing it at all, then one could use the paragraph you quoted here to say that the company are not fulfilling their GPL obligations.
    – Brandin
    Commented May 23, 2023 at 7:38
  • 3
    With respect, ruben, I read what you've posted from GPLv3 exactly the opposite to how you read it. The GPL doesn't cover system libraries, agreed. The system libraries are "anything ... that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component". Since it then goes on specifically to define a compiler as a major component, the compiler cannot be a system library, and thus isn't exempted by the system library exemption. Brandin, I think I agree with you, and urge you to write that up as an answer.
    – MadHatter
    Commented May 23, 2023 at 10:44
  • @MadHatter I added a GPL FAQ statement that supports my answer.
    – ruben2020
    Commented May 23, 2023 at 11:54
  • 1
    I stand by my contention that compilers aren't System Libraries within the meaning of that particular GPL exemption, and I don't think what you've later quoted has anything to say about that. I have not said that compilers must always be provided, but I am persuaded by Brandin's argument that if no compiler is publicly available, then one may need to be provided, and what you've quoted doesn't preclude that ("[the compiler] ... usually makes no difference for issues concerning the licensing of that source code").
    – MadHatter
    Commented May 23, 2023 at 12:19
  • @MadHatter, what do you consider "publicly available"? Suppose I port a GPL-licensed application to run on my private OS and the code of the port is available in a publicly accessible repository, would I then also need to make my OS publicly available? Commented May 23, 2023 at 14:25

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.