zoukankan      html  css  js  c++  java
  • [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.

  • 相关阅读:
    SQL 分组 行变列的一个例子
    用JS如何獲得DropDownList所選Text和Value?
    用了.net2.0,再用1.1的问题。1.1里修改.cs文件不重新编译,.dll不重新生成。
    ASP.NET中上传文件
    获得用户控件的值!
    在没有vs2005环境里部署Crystal Reports 10水晶报表
    onkeypress,onkeydown,onkeyup区别
    2012湖南大学第八届程序设计竞赛 Incredible[公式]
    POJ3624 Charm Bracelet[01背包问题入门]
    HDOJ1257 最少拦截系统[DP入门]
  • 原文地址:https://www.cnblogs.com/cheese-bacon/p/3381748.html
Copyright © 2011-2022 走看看