Build zsim-nvmain

I have spent much time building nvmain-zsim (2nd times!), and here is what I did (common errors).

What is zsim-nvmain?

ZSim is an emulator made by stanford, which is originally used to evaluate the implementation of ZCache.

NVMain is a set of interfaces based on ZSim or Gem5, which provides support on emulating Non-Volatile Memory. Now we can easily add a 3d stacked DRAM or PCM Main Memory to the system…

ZSim github repo: https://github.com/s5z/zsim
NVMain github repo: https://github.com/AXLEproject/axle-zsim-nvmain

Before you read…

How to build nvmain-zsim

  1. download source code
    git clone https://github.com/cyjseagull/SHMA

  2. deal with depenencies
    My environment:

    • ubuntu 18.04 (linux kernel 4.4.0)
    • gcc, g++ 4.8.5

      How to deal with multiple gcc/g++ version?
      update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10, where 10 is a number indicating the priority
      we should do the same to g++

    • pin-2.13-61206-gcc.4.4.7-linux (which is embedded in SHMA project)

    • boost 1.59
      if you have encountered “fatal error: bzlib.h: No such file or directory”, try apt install libboost-all-dev libbz2-dev
    • libconfig 1.7.2
    • hdf5 1.10.5
      most of those tools are installed in /usr/local/ by default.
  3. configure env.sh
    Now we should modify env.sh to assign where we install our dependencies. I recommend set a BASEPATH and use that indirect path.
    Then source env.sh to export those parameters into environment

  4. build nvmain-zsim
    cd $BASEPATH
    scons -j4

  • encounting “fatal error: src/memory_hierarchy.h: No such file or directory”
    go to build/opt/tlb/common_func.h, change header into "#include "memory_hierarchy.h"

  • encounting “fatal error: src/nvmain_mem_ctrl.h: No such file or directory”
    go to build/opt/tlb/page_table_walker.h and change the header in the same way

  • encounting “fatal error: glog/logging.h: No such file or directory”
    try apt-get install libgoogle-glog-dev

  • encounting “build/opt/version.h:1:4: error: stray ‘#’ in program”
    change “echo -e” into “echo” in SConstruct

  • (docker-only) [H] Panic on build/opt/zsim_harness.cpp:292: Could not change personality to disable address space randomization!
    try rerun docker with privileged mode
    docker run -it --privileged CONTAINER_ID bash
    echo 0 | tee /proc/sys/kernel/randomize_va_space

  • E:4.4 is not a supported linux release
    insert at pin_cmd.cpp:52

    1
    2
    3
    args.push_back("-injection");
    args.push_back("child");
    args.push_back("-ifeellucky");

build until you see scons: done reading SConscript files.

  1. Check installation
    ./bin/zsim config/shma-static.cfg
    congrats!

  2. A known problem
    according to this issue: https://github.com/s5z/zsim/issues/154
    zsim is not supported to run ls.

If you have any question, feel free to comment here.

---以上---