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.

  • 相关阅读:
    了解大数据的特点、来源与数据呈现方式
    结对项目-四则运算 “软件”之升级版
    个人项目-小学四则运算 “软件”之初版
    大数据应用期末作业
    分布式文件系统HDFS 练习
    安装Hadoop
    爬虫大作业
    爬取全部的校园新闻
    理解爬虫原理
    中文词频统计与词云生成
  • 原文地址:https://www.cnblogs.com/cheese-bacon/p/3381748.html
Copyright © 2011-2022 走看看