Compiling SystemC and SystemC-AMS on Linux
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 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
3. Compiling SystemC and SystemC-AMS
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.
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:
In both I have changed from:
#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:
and paste the following line at the end of the file:
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.