Skip to content

How to build STEPS kernel

Changgang Li edited this page Feb 5, 2021 · 3 revisions

This is the very first step before using STEPS. It requires only basic knowlege of code complilation.

Download STEPS codes

Colone STEPS from https://github.com/changgang/steps or download the source codes from the following links:
(1) master branch
(2) dev branch

Install Code::Blocks (CB)

Installation of CB is not compulsory but highly recommended. STEPS is originally developed with CB. It is convinient to compile STEPS with CB.
Please go to CB official website to download the latest version of CB. If you are using Unix-like system, check your OS version and maybe you can directly install CB with package manager (yum or apt-get).

Install C and C++ compiler

The compiler must support C++14. GCC of verion 4.9 or higher is recommended.

Unix-like systems

Follow guides of your OS, use package manager to install gcc and g++ with the latest version.

Windows system

MinGW-64 is suggested on Windows system. Use 64-bit version!

Go to MinGW-64 official website and redirect to MinGW-64 sourceforge page.
Go to files and scroll down to find the installer of the latest version named "x86_64-posix-seh".
Unpack the downloded 7z file to any folder, remember the folder location.

Configure CB toolchain

Start CB and configure its toolchain exectuable. If you use Windows system, the location of unpacked MinGW-64 is required here.

Build STEPS with CB

Compile CSparse

  1. Open csparse.cbp in the code/ folder with CB.
  2. Go 'Project'-'Properties'-'Build targets'and set type as 'static library'.
  3. Compile CSparse. You should get a libCSparse.a in folder build/bin/Release/.

Complie CXSparse

  1. Open cxsparse.cbp in the code/ folder with Code::Blocks
  2. Go 'Project'-'Properties'-'Build targets'and set type as 'static library'.
  3. Compile CXSparse. You should get a libCXSparse.a in folder build/bin/Release/.

Compile CppTest.

  1. Open cpptest.cbp in the code/ folder with Code::Blocks, set build target as 'static library'.
  2. Compile CppTest. You should get a libCppTest.a in folder build/bin/Release/.

Compile STEPS

  1. Open STEPS.cbp in the code/ folder with Code::Blocks.
  2. Go 'Project'-'Build options'-'Linker settings', and add the libCsparse.a, libCXSparse.a, and libCppTest.a library to 'Link libraries'.
  3. Go 'Project'-'Properties'-'Build Target', and select build target - If you want to compile STEPS as dynamic library, select 'Dynamic library', and set the output file name as 'libsteps.so' for Unix-like systems or 'libsteps.dll' for Windows systems.
  4. Compile the STEPS. You should get the output file in folder build/bin/Release/.

Summary of compilation procedure

  1. Compile CSparse as static library. You can find CSparse.cbp in the code/ folder.
  2. Compile CXSparse as static library. You can find CXSparse.cbp in the code/ folder.
  3. Compile CppTest as static library. You can find CppTest.cbp in the code/ folder.
  4. Compile STEPS as dynamic library or exectuable file. Include libCSparse.a, libCXSparse.a, and libCpptest.a.

Build STEPS in shell mode (Linux)

To build in Linux shell mode, you can simply run the code/linux_make.sh script in the STEPS source. Before you run the script, install cbp2make first.

  1. Download and install the cbp2make from sourceforge page. Remember to add x mode to the cbp2make file to make it executable.
  2. Add x mode to the linux_make.sh file to make it executable.
  3. Run linux_make.sh.

Remarks

  1. Build STEPS into dynamic library is strongly recommended. But if you do want to build STEPS into console application, here is the procedure 1.1 In the Compile STEPS step, select 'Console application'.
    1.2 Enable 'Link' option for only one of Source files with leading name of 'main'.
  2. We strongly recommend compile STEPS as 64-bit version. But if you do want to compile it into 32-bit version, it is Okay. Just remember to use the correct version of Python.