Compiling SystemC and SystemC-AMS on Linux

Keywords: SystemC, SystemC-AMS, Linux

1. Introduction

Compiling SystemC and SystemC-AMS on modern Linux distributions should be strait-forward as most of these distributions have the latest gcc compiler.

This tutorial was tested with the following software versions:

  • Ubuntu 17.10
  • gcc 7.2
  • SystemC 2.3.2
  • SystemC-AMS 2.1

2. GCC Install

Run the following command in the command line:

sudo apt-get update
sudo apt-get install build-essential

If everything went well, one should be able to run the following command:

$ gcc --version
gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

3. Compiling SystemC and SystemC-AMS

SystemC 2.3.2 library can be downloaded from Accellera's website while SystemC-AMS PoC 2.1 (Proof-of-Concept) can be downloaded on Coseda's website.

3.1 SystemC

This should be strait forward. SystemC library is in a more advanced phase of development and I never had any problem compiling it in several different machines and operating systems.

cd systemc-2.3.2/
mkdir build && cd build
../configure --prefix=/usr/local/systemc-2.3.2
make -j4
sudo make install

Note the first to lines telling the configure utility to use gcc 7.3.

3.2 SystemC-AMS

Now there is a trick. SystemC-AMS 2.1 is not compiling out of the box with SystemC 2.3.2. But this is very simple to fix updating the following files:

  • ./src/scams/impl/predefined_moc/tdf/sca_tdf_ct_ltf_nd_proxy.h
  • ./src/scams/impl/predefined_moc/tdf/sca_tdf_ct_vector_ss_proxy.h

In both I have changed from:

#include "systemc-ams"


#include <cstring>
#include "systemc-ams"

Otherwise the make process fails on these modules, complaining that "memset" is not defined. Now just follow the standard procedure:

cd systemc-ams-2.1
mkdir build && cd build
../configure --prefix=/usr/local/systemc-ams-2.1 --with-systemc=/usr/local/systemc-2.3.2
make -j4
sudo make install

4. Setting up the libraries path

In order to Linux to find the libraries, it is necessary to edit the LD_LIBRARY_PATH environment variable. The most practical way to do that is editing the bash profile file:

gedit ~/.profile

and paste the following line at the end of the file:

export LD_LIBRARY_PATH=/usr/local/systemc-2.3.2/lib-linux64:/usr/local/systemc-ams-2.1/lib-linux64:$LD_LIBRARY_PATH

5. Conclusion

After completing this tutorial you should be able to compile applications using the SystemC and SystemC-AMS libraries. If you need an example project you might use my PLL simulator.

If you found a bug, have suggestions or just want to share your opinion about this tutorial, please leave a comment bellow.