Building GHDL from Sources¶
GHDL can be downloaded as a zip-file/tar-file
(latest ‘master’ branch) or cloned with
git clone from GitHub. GitHub
offers HTTPS and SSH as transfer protocols. See the Downloading Source Files
page for further details.
Since GHDL is written in Ada, independently of the code generator you use,
the a compiler is required. Most GNU/Linux package managers provide a package
gcc-gnat. Alternatively, GNU Ada compiler, GNAT GPL,
can be downloaded anonymously from libre.adacore.com (2014, or later; for x86, 32 or 64 bits).
Then, untar and run the doinstall script.
v0.37, GHDL’s synthesis features require GCC >=8.1, due to some new GNAT features which
are not available in previous releases. Users with older versions (who don’t need synthesis)
can configure GHDL with option
GHDL currently supports three different back-ends (code generators):
- mcode - built-in x86 (or x86_64) code generator
- GCC - Gnu Compiler Collection (gcc.gnu.org)
- LLVM - Low-Level Virtual Machine (llvm.org)
Here is a short comparison, so that you can choose the one you want to use:
The output of both GCC and LLVM is an executable file, but mcode does not
generate any. Therefore, if using GCC/LLVM, the call with argument
be replaced with direct execution of the binary. See section Quick Start Guide.
After making your choice, you can jump to the corresponding section. However, we suggest you to read Directory structure first, so that you know where the content will be placed and which files are expected to be created.
In these instructions, the configure script is executed in the source directory; but you can execute in a different directory too, like this:
$ mkdir ghdl-objs $ cd ghdl-objs $ ../path/to/ghdl/configure ...
On Windows, building GHDL with mcode backend and GNAT GPL 32 bit seems to be the only way to get a standalone native executable.
- MINGW/MSYS2 builds depend on the environment/runtime.
- For 64 bit, no native compiler exists from AdaCore.
- That Ada to .NET compiler, which might work for 32 or 64 bit. is not up-to-date.