[SystemC] Setting Up the Environment

My operating system is Ubuntu 12.04.

0. Checking Your Compilers

First thing first, you will need the tools beforing making stuffs.

  • Type "g++ --version" to check if you have g++, if not use "sudo apt-get install g++" to install it first. (Fedora users can use command "yum")
  • Type "make --version" to check if you have GNU make, otherwise you know what to do...

1. Downloading SystemC

The first step is to download the source package of SystemC. The official download page is http://www.accellera.org/downloads/standards/systemc. You need to register with your email for accepting the licenses. Currently the newest and stable version of SystemC is 2.3.0.

2. Making SystemC Library Step-by-step

The downloaded tar file are for example located here: ~/Downloads/

cd ~/Downloads/
tar zxvf systemc-2.3.0.tar
cd systemc-2.3.0
mkdir objdir
cd objdir
sudo mkdir /usr/local/systemc/
sudo ../configure --prefix=/usr/local/systemc/
sudo make
sudo make install

Here "sudo" is kind of important if you are not root.

3. Compling SystemC Files

Suppose you have already have your SystemC example files here: ~/hello_word/, with file hello.h, and main.cpp.

To compile your SystemC files, use

g++ main.cpp -I$SYSTEMC_HOME/include -L$SYSTEMC_HOME/lib-linux64 -o hello -lsystemc

Of coursee you need to set the environment variable SYSTEMC_HOME first:

export SYSTEMC_HOME=/usr/local/systemc/

or anywhere you actually built it.

In this way your code will be compiled successfully.

4. Running the Executable

The title looks stupid but I still think it is necessary to address it here. Your compilation will be successful but you might face an error when you are trying to run the executable, for example:

./hello: error while loading shared libraries: libsystemc-2.3.0.so: cannot open shared object file: No such file or directory

In this case, you need to set LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=/usr/local/systemc/lib-linux

For 64-bit system users, you may set the variable value to:

export LD_LIBRARY_PATH=/usr/local/systemc/lib-linux64

In my case I need to set it to the latter one (To be frank I didn't set it right at the first time). If you are not sure which one you need to set, simply go to that folder, to see you have "lib-linux" or "lib-linux64".

At this stage, you may run your executables without errors.

转载于:https://www.cnblogs.com/cheese-bacon/p/3381748.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值