Installing Gnucap

There are pre-built binaries of Gnucap availabe if you search for them. However, to use the latest features, it is best to install Gnucap from source. Many EDA software tools have been written on a Linux operating system. So is Gnucap. It is easy to build Gnucap on system such as Debian or Ubuntu. To build Gnucap on other operating systems (for example MacOS or Windows) see the last section of this chapter.

Prerequisites

To build Gnucap from source you need to install a number of buildtools and libraries:

  • A modern g++ compiler

  • Auto tools or CMake build tools

  • The readline library or debian package libreadline-dev

  • termcap library to interact with rendering characters to a terminal

If you want to build Gnucap with CMake, you need:

  • CMake 3.12 (or later)

  • A build system generator such as Make or Ninja

Building Gnucap on Linux

You can build Gnucap with help of autotools or CMake build tools. A short overview can be seen in the Gnucap wiki

If you are on a new system, you should install the dependencies first:

An example on OpenSuse would like as:

# zypper install readline-dev
# zypper install termcap

Then for Gnucap, you can download its source from the Gnu savannah repo:

or from the URL with https if your network does support that better:

This will give you the basic Gnucap directory structure:

As you will learn later, the architecture of Gnucap is based heavily on plugins. The apps and libs folder include a set of plugins. Gnucap consists of a set of models for simulations, simulation algorithms and a user interface. The main user interface is in the main folder. Modelgen is a utility to translate electrical components into models for simulation with Gnucap.

To build Gnucap, you should move to a recent tag or branch of the project. You can do this with:

You can see a list of tags with:

Or you can see the branches with:

For example, you can build the version "20171003" tag or cmake-4 branch.

The build process of gnucap will give some executables and some shared libraries such as gnucap.so (or .dll on Windows).

To build of these, you can run the default build commands:

Before you can start Gnucap, it might be necessary to reload the shared libraries with:

And set the Gnucap plugin path to your path that has gnucap-default-plugins.so

For example:

Other operating systems

To build gnucap on MacOS, a good reference is the gnucap build recipe https://github.com/guitorri/homebrew-tap/blob/master/gnucap.rb

Building with CMake

It is possible to build GnuCap with CMake. This approach can also be used on Windows with Cygwin and MinGW for example:

In this case, the Ninja build tool is selected. You can also select Make if you prefer.

One example configuration run is shown below

Now the build starts and you will get a library: libgnucap.dll and two main files:

  • modelgen

  • gnucap executables

However, when you start gnucap you might see an error such as:

You need to provide a path the gnucap plugin dll. Also, you need to set the environment variable:

Sometimes you also must have the dll and executable in the same directories.

Run gnucap

After a successfull build and installation, you should be able to run gnucap like this:

Last updated

Was this helpful?