Compiling OpenSees on Linux
OpenSees (Open System for Earthquake Engineering Simulation) is a structural analysis platform to simulate the performance of structural systems subjected to earthquake loads. The software does not have any graphical user interface and is based on object-oriented programming. Users can develop and implement their own models in the existing framework. The source code of OpenSees is written in C++ but uses Tcl and Python as interpreter languages.
This post will explain how to compile OpenSees with Tcl interpreter on Linux operating system.
OpenSees (Open System for Earthquake Engineering Simulation) is a structural analysis platform to simulate the performance of structural systems subjected to earthquake loads. The software does not have any graphical user interface and is based on object-oriented programming. Users can develop and implement their own models in the existing framework. The source code of OpenSees is written in C++ but uses Tcl and Python as interpreter languages.
This post will explain how to compile OpenSees with Tcl interpreter on Linux operating system.
Linux
1. Download the source code for OpenSees from the GitHub page here https://github.com/OpenSees/OpenSees
2. Extract and copy the content of the downloaded zip file in a folder named “OpenSees” in $Home directory.
3. Create folders ‘lib’ and ‘bin’ in the home directory by typing the following commands in the terminal. The libraries will be created in ‘lib’ folder and the final shared object file (OpenSees.so) will be created in ‘bin’ folder.
mkdir lib bin
1. Download the source code for OpenSees from the GitHub page here https://github.com/OpenSees/OpenSees
2. Extract and copy the content of the downloaded zip file in a folder named “OpenSees” in $Home directory.
3. Create folders ‘lib’ and ‘bin’ in the home directory by typing the following commands in the terminal. The libraries will be created in ‘lib’ folder and the final shared object file (OpenSees.so) will be created in ‘bin’ folder.
mkdir lib bin
4. Required packages to compile OpenSees on linux are,
tcl8.6
tcl8.6-dev
gcc
g++
gfortran
The latest version of Ubuntu comes with gcc and tcl8.6 pre-installed. Install tcl8.6-dev and gfortran packages by typing the following commands in the terminal,
sudo apt-get install tcl8.6-dev
sudo apt-get install gfortran
5. Copy appropriate makefile from OpenSees/MAKES folder to main OpenSees folder and name it Makefile.def. Edit the makefile with the following changes,
Line 63: INTERPRETER_LANGUAGE = TCL
Line 74: OPERATING_SYSTEM = LINUX
for HOME path, use your home directory name. Type ‘pwd’ in terminal to know.
Line 91: HOME = /home/anurag
Line 98: SUPERLUdir = $(HOME)/OpenSees/OTHER/SuperLU_5.1.1/SRC
# check the location of libtcl8.6.so file on your computer and put appropriate path for Tcl library
Line 138: TCL_LIBRARY = /usr/lib/x86_64-linux-gnu/libtcl8.6.so
Line 291: TCL_INCLUDES = -I/usr/include/tcl8.6 # tcl version
Now, type following in the terminal to compile.
cd OpenSees && make
This should complete the compilation process. This process may take several (10-15) minutes. Keep an eye on the compilation process to see if there are any errors. Sometimes a few packages may be missing from Linux, which will show error and fail the compilation process. Just install the packages and run the process again.
Once compilation process is complete, type ‘OpenSees’ in the terminal to run OpenSees. This command is case sensitive, which means that the command should match the name of the shared object file created in ‘bin’ folder.
tcl8.6
tcl8.6-dev
gcc
g++
gfortran
The latest version of Ubuntu comes with gcc and tcl8.6 pre-installed. Install tcl8.6-dev and gfortran packages by typing the following commands in the terminal,
sudo apt-get install tcl8.6-dev
sudo apt-get install gfortran
5. Copy appropriate makefile from OpenSees/MAKES folder to main OpenSees folder and name it Makefile.def. Edit the makefile with the following changes,
Line 63: INTERPRETER_LANGUAGE = TCL
Line 74: OPERATING_SYSTEM = LINUX
for HOME path, use your home directory name. Type ‘pwd’ in terminal to know.
Line 91: HOME = /home/anurag
Line 98: SUPERLUdir = $(HOME)/OpenSees/OTHER/SuperLU_5.1.1/SRC
# check the location of libtcl8.6.so file on your computer and put appropriate path for Tcl library
Line 138: TCL_LIBRARY = /usr/lib/x86_64-linux-gnu/libtcl8.6.so
Line 291: TCL_INCLUDES = -I/usr/include/tcl8.6 # tcl version
Now, type following in the terminal to compile.
cd OpenSees && make
This should complete the compilation process. This process may take several (10-15) minutes. Keep an eye on the compilation process to see if there are any errors. Sometimes a few packages may be missing from Linux, which will show error and fail the compilation process. Just install the packages and run the process again.
Once compilation process is complete, type ‘OpenSees’ in the terminal to run OpenSees. This command is case sensitive, which means that the command should match the name of the shared object file created in ‘bin’ folder.