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.

  • 相关阅读:
    java.lang.NoClassDefFoundError的原因及解决
    关于安卓应用(APK文件)的二次打包
    Android应用Icon大小在不同分辨率下定义
    Android常见错误
    RelativeLayout相对布局 安卓布局技巧
    onTextChanged参数解释及实现EditText字数监听
    Django 基础
    Django 入门
    paramiko模块实现堡垒机
    Python操作MySQL
  • 原文地址:https://www.cnblogs.com/cheese-bacon/p/3381748.html
Copyright © 2011-2022 走看看