trbvm
trbvm

Reputation: 141

Dynamically linking ada runtime

I've installed GPS GPS 6.1.1 (20150118) hosted on i686-pc-mingw32 GNAT GPL 2015 (20150428-49).

It successfully compiles Hello World, but even release executable is huge since it includes statically compiled not-optimized runtime and (what is more important) as far as I understand ada runtime is licensed under GPL and can not be statically linked into closed-source executable.

How can I configure GPS / gcc to link runtime dynamically?

Upvotes: 1

Views: 973

Answers (2)

Simon Wright
Simon Wright

Reputation: 25501

This is very close to this question, and the same answer applies.

However, in case you’d prefer to edit your project properties in GPS via the Project > Properties dialog:

  1. go to the Switches tab (on the left hand side)

  2. go to the Binder tab (at the top)

  3. tick the Shared GNAT run time checkbox.

While you’re there, tick the Store call stack in exceptions checkbox too; this can help debugging an unhandled exception (the binder switch is -E).

Upvotes: 2

user1818839
user1818839

Reputation:

I will let someone else answer the specific question, which is (IMO) a good one.

Also good are related questions of minimising the runtime size where the full featured runtime is not necessary, as for "Hello World". Comparing the executable size with the memory installed on your platform, one might conclude this is a case of premature optimization. But for bare-bones executables, e.g. on embedded microcontrollers, it is certainly worth asking.

However there is another implicit question :

How do I divorce my executable from a GPL-encumbered runtime?

and I will answer this.

Historically, the Gnat RTS was not always so encumbered. At one time it featured the "Gnat Modified" GPL, (GMGPL), in which the runtime files contained additional permission above the GPL rights, allowing you to link those components of the RTS with an executable, without burdening your executable with the GPL - effectively allowing you to release such an executable under a closed-source license. (Provided none of its other components were pure GPL).

The Gnat GPL compiler comes with a pure GPL runtime (completely legally) to distinguish it from commercial offerings from the same authors - who have the right to put food on their own table, and their commercial products have an excellent reputation and first class support.

However there is another fork of the older Gnat compiler, offered by the FSF as part of mainstream GCC, which is kept up to date with modern Ada developments including Ada-2012. In some respects it is ahead of Gnat GPL - in the underlying gcc version for example, while in some respects it is behind, as newer Ada features take longer to make it into the FSF branch. But the point here is that it inherited the GMGPL license, and then the very similar "Runtime Exception" in GPLv3. The linked "Rationale and FAQ" should let you determine if this satisfies your needs.

If so. you can compile gcc (including Gnat) from source to meet your needs. This is not a trivial project, however! So for most common platforms, you can find pre-built binaries of the FSF Gnat compiler from the imaginatively named getadanow.com

Disclaimer : I am only pointing out this option. As always with licensing issues, don't take the word of "random guy on the internet" but study the actual licenses of the compiler and RTS you are using and take appropriate legal advice.

Upvotes: 2

Related Questions