Regarding GPL software use in a commercial project, I have the following situation:

I would like to commercially distribute an Excel-Macro application, which uses a GPL licensed software (G77 compiler) and some Fortran codes. The Macro and Fortran codes are all written by myself. No changes are made to any of the GPL software.

My understanding of GPL is that if I want to commercially distribute all above files together, I would have to make all (Macro and Fortran codes) available as source code.

My goal is to protect my own source code (or at least the Fortran files). However, I guess that the GPL license is intended to exactly avoid that.

Therefore I consider following two scenarios as work-around:

1) I provide "scrambled" source code. Thus, actual source code but with all variable/function names given random names. However, that might be prohibited by the GPL license, stating that:

The "source code" for a work means the preferred form of the work for making modifications to it.

2) I distribute two individual packages: One containing my own codes (as closed-source), the other containing only the GPL software. The end-user would just need to later on move the GPL software into the appropriate folder in my own codes.

My questions are:

A) Is any of above work-arounds legal fine?

B) Is there maybe any other way to achieve my goal besides above workarounds?

Thanks a lot!

  • 7
    I am disappointed by this kind of questions. You're building upon other people's work who have put it under the GPL because they wanted it to be free and remain free. You're now trying to use that work in a way that you seem to know is against the spirit of the GPL and therefore presumably against the intention of its author hoping you can twist the legal fine print beyond recognition. What makes you believe you should be able to take without giving?
    – 5gon12eder
    May 9, 2016 at 4:52
  • In my total personality: I dont believe that I take without giving. Reasons for commercializing or distributing closed-source software are extremly broad topics. I do think that an appropriate answer to your question is not able or appropriate for this comments section. Thanks for commenting anyway.
    – user233558
    May 9, 2016 at 5:11
  • 1
    @5gon12eder -- I am not disappointed by these kinds of questions. The questioner simply wants to compile his or her own code and have that form the basis of a sellable product. Even the GNU community has backed off on this a bit. They now explicitly exclude code that is merely compiled with GCC and/or linked to GCC runtime libraries from the onerous burdens of GPLv3. They didn't do so originally; this was one of the key factors that led to the formation of LLVM. May 9, 2016 at 9:18
  • 1
    @DavidHammen: interesting theory how LLVM was created in response to GPL3 when LLVM predates GPL3 by several years. May 9, 2016 at 15:13
  • 4
    @DavidHammen That's incorrect. The output of GCC compilation is not itself covered by the GPL (unless other conditions apply, of course). Where did you get this idea?
    – Andres F.
    May 9, 2016 at 17:35

3 Answers 3


If you are merely distributing the executable output of the Fortran compiler, and not the compiler itself, then you're not distributing the compiler, and therefore not triggering the GPL's copyleft provision. Under those conditions, you are not bound by the GPL.

This is generally true of all compilers, unless your program requires the compiler's services on an ongoing basis to function in the user's environment. If your program requires the compiler to be distributed to the end user, then you must abide by the GPL's terms.

To avoid distribution that would trigger the copyleft clause in the GPL, you must meet the conditions for a "separate work," and avoid the conditions that would cause it to be a "derived work" of the GPL'd software.

In order for a distributed GPL'd library or program to be considered a "separate work" from your program and not a "derived work," your program must meet all of the following conditions:

  1. It must communicate with the GPL'd software at arms length. In practice, that means it cannot be linked into your program via a DLL-like mechanism, either statically or dynamically. "Arms length" usually means some mechanism like a Unix pipe via stdio.

  2. Your program must be able to function independently from the GPL'd software; that is, it must be able to provide substantially its core functionality without using the GPL'd software at all.

  3. You must make the API that your software uses to communicate with the GPL'd software publicly available, in sufficient detail to allow someone to completely replace the GPL'd software with some other software of their own choosing.

You cannot obfuscate the source. The source code that you provide under the GPL must be in the same form that you used to develop the software with.

  • Dear Robert, Thanks for the sophisticated answer. I think my software agrees with all three points to define a "separate work". It would be able to provide substantially its core functionality without the GPL software. In fact, the g77 compiler is only needed to speed up a specific part of the program, the results are substantially the same. One follow up question on the "arms length": The Macro would create a batch file which is then automactially executed to compile (with that very GPL-g77) and generate an executable from my own Fortran codes. Does that qualify as "arm length"? Thanks!
    – user233558
    May 9, 2016 at 6:04
  • My program requires the compiler to be present on the end user system.
    – user233558
    May 9, 2016 at 6:09
  • @user233558: If the end-user can replace the g77 compiler with a different version without breaking your macro/batch file, then the two are considered to be at-arms-length and the GPL license of the compiler will not affect your code. May 9, 2016 at 6:43
  • Thanks, Bart. Yes, the user could replace the compiler easily, of course the g77 command in the batch must be re-written to the new compiler. But functionality wise, it could be replaced with any compiler.
    – user233558
    May 9, 2016 at 6:54
  • 2
    @user233558: I don't think your software agrees with any of the three points to define a separate work. May 9, 2016 at 14:21

Though Robert gave you a very good answer, IMHO he missed one point: if you do not want to open the source of your program, you simply must avoid to distribute the Fortran compiler together with your program, not in one package, and not in two. But if your program starts at the end user's machine, tests for the presence of the G77 compiler, and if it is not there, gives the end user detailed instructions how he can get that compiler by himself, your program will technically not violate the GPL.

The point is: as long as you avoid the distribution of the compiler, it does not matter if your program is a "derived work" or not. There will be no need for you to check the three bullet points in Robert's answer. Even if your program will download and install the compiler for the end user automatically, this does not count as "distribution" - technically, the end user does the installation by himself.

I have seen this approach by some programs which have a plugin mechanism to allow the usage of GPLed plugins. For a compiler, it would be pretty much the same.

  • Thanks, Doc. This is the best option in my case. Will go for it.
    – user233558
    May 10, 2016 at 1:20

G77 compiler

First off, nobody wants to see your archaic FORTRAN code, not even modern Fortran programmers. Code written to that standard is best left in the previous millennium, prior to when the internet existed.

Secondly and more importantly, the GNU license specifically allows you to distribute binaries if those binaries were compiled with unmodified GNU compilers and linked with unmodified GNU libraries. You do not have to release your source code if you follow those rules. Specifically, you need to follow the rules spelled out in the GCC Runtime Library Exception.

Thirdly, if even those rules are too strong for you, there are alternatives. LLVM provides Fortran compilers, and it's licensing agreement is much less restrictive than is GPLv3.

  • Thanks, David. I would need to distribute all compiler relevant files to the end-user, not sure those can all be packed into binaries. The LLVM compiler might be another option though, I will have a look. Also thanks for the comment on F77, I always considered myself modern, as I do not use the F66 standard... Time is flying bye ;-)
    – user233558
    May 9, 2016 at 6:21
  • FORTRAN 77 is not modern. Time flew by you. That language is a fairly simple language. Suppose you obfuscated your code and then compiled it at the highest optimization level. Even a halfway competent modern hacker could quickly disassemble your code in no time flat. May 9, 2016 at 6:39
  • "Time flew by you." > That is what I meant.
    – user233558
    May 9, 2016 at 6:49
  • FORTRAN77 = 1977 = 39 years ago. There are people whose grandparents are younger than that.
    – Brendan
    May 9, 2016 at 10:43
  • @Brendan - Ouch. I was first asked if I was a grandparent in 1988 in a snail mail for a high school reunion. I graduated from a high school in Hicksville, USA, where apparently some people became grandparents at the ripe age of 32 (or less). May 9, 2016 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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