POSTS
Building GHDL from source on macOS Big Sur
As an alternative to using a prebuilt GHDL version, I wanted to build it from source.
I cloned the repo from GitHub, as
git clone https://github.com/ghdl/ghdl.git
Following the instructions on the GitHub page, I started with getting an Ada compiler.
I downloaded and ran an installer for Mac, from the AdaCore site.
The installed Gnat Ada compiler was installed in
$HOME/opt/GNAT/2020
In the ghdl repo, I now set up the PATH, by adding the Gnat Ada compiler directory at the end (I noted that adding it at the front led to the gcc inside Gnat Ada being picked up by mistake when building GHDL), as
export PATH=$PATH:$HOME/opt/GNAT/2020/bin
Doing configure and make, as indicated on the GitHub page for building the mcode backend, as
./configure --prefix=$HOME/opt/ghdl_from_src
make
led to a successful configure step, but there were errors from the make command, as
ld: library not found for -lz
and
ld: library not found for -lSystem
Following the information on this page, where a problem with Fortran is discussed, I decided to install Xcode from the App Store.
Having done the installation of Xcode (which took some time to download), the configure and make commands, as shown above, succeeded.
I could now proceed, by installing GHDL as
make install
The installed GHDL was then tried, on the code used when trying out the prebuilt GHDL version, as
$ export PATH=$HOME/opt/ghdl_from_src/bin:$PATH
$ ghdl -a hello.vhdl
$ ghdl -r hello_world
Hello, world
$