SystemCInstallation

SystemC Installation

If you are about to install SystemC on your platform you should pause one moment and think about the compiler selection. At a first glance, SystemC is built on top of ANSI C++, so a standard compiler should work. Unfortunately this is not the case, i.e. you can't simply use any compiler.

In the following we suppose you want to install the actual version of SystemC (2.1) and the SystemC Verification Library (1.0p1). Go to the download page and select the appropriate packages.

Installation under UNIX-like systems

For using SystemC under e.g. Linux/Solaris/MacOS the GNU compilers are the right choice. The compiler of your choice could either be gcc 2.95.3 or gcc 3.2.3, for instance. It should be able to install the compiler of your choice.

If there occur any errors, please refer to the GNU manual pages. Binary packages should also exist for most distributions and operating systems.

(!) Note: SystemC was developed and tested using different operating systems and compilers. So, you are advised to check out the INSTALL and README file coming with the SystemC package. All possible combinations are listed there, so have a look at that!

Anchor(compiler)

Installing SystemC with a specified compiler

Next, we want to install SystemC 2.1 using our dedicated compiler. The compiler should be in your environment search path. You can check the compiler version by typing:

 {{{
gcc --version </nowiki>

If your compiler was installed to another directory (let's assume /usr/local/), you may need to set the environment variables CXX and CC to the location of your compiler.

According to your local shell, type

 {{{
export CXX=/usr/local/gcc-x.y.z/bin/g++ export CC=/usr/local/gcc-x.y.z/bin/gcc </nowiki>

or

 {{{
setenv CXX /usr/local/gcc-x.y.z/bin/g++ setenv CC /usr/local/gcc-x.y.z/bin/gcc </nowiki>

The variables CXX and CC point to the installation of our compiler and will be used by the configure script. In other words we advise the installation routine to use our specified compiler. You can check if the variables are set by typing:

 {{{
echo $CXX echo $CC </nowiki>


Now, we are ready to install SystemC:

Create a temporary folder in the SystemC sources folder and switch to that folder, like

 {{{
mkdir objdir cd objdir </nowiki>

Now, we need to do some more steps (on some systems you might rather use gmake instead of make):

 {{{
../configure --prefix=/usr/local/systemc-2.1 make make install </nowiki>

(!) The call make will compile SystemC, make install will install the package to the specified target folder and must be executed as user root!

It makes sense to provide an installation folder with --prefix=/usr/local/systemc-2.1. All necessary and important files are kept together, and there can easily be installed multiple versions of SystemC that way. If you want to get rid of the installation you can simply delete the whole folder.

Anchor(known_issues)

Known issues

If there occur any problems like error messagers during the installation process, you may need to switch to another compiler. If done so, you have to re-configure the build process. As we have created a temporary folder, we simply delete that one and restart the build process.

 {{{
rm -rf * ../configure --prefix=/usr/local/systemc-2.1 make make install </nowiki>

/!\ Note: Take care when removing files by typing rm -rf *. All files will be deleted irrevocably, so be sure you're in the right folder, like the temporarily created folder objdir.


The command make install needs to be executed as user root, whereas the other commands do not necessarily need to be executed as user root. Sometimes problems may occur if you do execute configure and make as root!


Maybe you need to do something more before the build and configuration process. Change to user root and explicitly create the target folders. These folder names can be applied to both SystemC and SCV.

 {{{
cd /usr/local mkdir systemc-2.1 mkdir systemc-2.1/include mkdir systemc-2.1/lib-linux mkdir systemc-2.1/doc mkdir systemc-2.1/examples </nowiki>

Anchor(folders)

Note: In this example we want to run SystemC under Linux, as the path to the library is lib-linux. According to your platform, other names for folders may be more rational (see table)!

Platform Name of folder
colspan=2 |
Linux lib-linux
Sun Solaris (GNU compiler) lib-gccsparcOS5
Sun Solaris (Sun C++ compiler) lib-sparcOS5
MacOS X lib-macosx
HP UX (GNU compiler) lib-gcchpux11
HP UX (HP C++ compiler) lib-hpux11
Cygwin lib-cygwin
Installing the SystemC Verification Library (SCV)

With SystemC installed, we can now install the SystemC Verification Library.

(!) You should use exactly the same compiler for installing SystemC and installing SCV!

Remember to set the variables CXX and CC to your compiler installation, if not done already! Perform the same steps as already stated #compiler above.

 {{{
mkdir objdir cd objdir ../configure --prefix=/usr/local/scv --with-systemc=/usr/local/systemc-2.1 make make install </nowiki>

The SCV installation needs the SystemC installation as a reference. This can be achieved with --with-systemc=/usr/local/systemc-2.1. We also choose an installation folder with --prefix=/usr/local/scv, so SCV will be installed to that specified folder.

Due to the compiler problem, you should carefully read the INSTALL and README files in the SCV package. If any problems occur, have a look at the #known_issues known issues.

Running SystemC and SCV

To run programs you need to do some more things. The SCV library can be loaded dynamically, so your executable specification needs to know the installation path.

There are two possibilities how to facilitate that (in this example we want to run SystemC and SCV under Linux, hence the folder name lib-linux. If your platform is a different one, please look #folders here):


According to your shell, type

 {{{
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/scv/lib-linux </nowiki>

or

 {{{
setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/scv/lib-linux </nowiki>

You need to do that once in your shell. Maybe useful if you are working with multiple versions of the library.

As an alternative, you can add the line above in your ~/.bashrc or ~/.profile so the variable is set everytime when you open a new shell.


Another alternative is the following: one of the folders where your system stores dynamically loadable libraries may be /lib, /usr/lib or /usr/local/lib. Check for that -- let's assume it is /usr/local/lib on your system:

 {{{
cd /usr/local/lib ln -s /usr/local/scv/lib-linux/libscv.so . ln -s /usr/local/scv/lib-linux/libscv.a . ldconfig </nowiki>

First we go to that folder. The ln -s command will create a symbolic link, that is, you create a reference to the original file without duplicating it. The command ldconfig will update the internal dynamic linker database. After that the library will be found and loaded dynamically at runtime.

These commands (especially ldconfig) have to be executed as user root.

(!) Every model specification must be build with the same compiler you used to build SystemC and SCV! This can be achieved by appropriate Makefiles.

By the way, you may need to adapt the Makefiles for the SystemC examples to your compiler and installation paths.

Running SystemC and SCV examples

After having successfully installed the libraries, you can test the installation. Stay in the temporarily created folder objdir and check if there are folders named include and lib-linux (if Linux is not your platform, please look #folders here).

If that folders do not exist, we again create symbolic links by typing:

 {{{
ln -s /usr/local/systemc-2.1/include . ln -s /usr/local/systemc-2.1/lib-linux . </nowiki>

Otherwise, the installation routine has created that folders itself, and we can test the installation. Just type

 {{{
make check </nowiki>

This will compile and run each and every example.


Another way to check the installation is to visit the example folders separately, like

 {{{
cd examples/systemc/simple_bus make check </nowiki>

Please note that the sources are not contained in the objdir.


PageComment2(commentfirst=1,nosmiley=1,articleview=1)


NewPage(PublicTemplate,New Page Here,SystemC/SystemCInstallation)