RNAstructure logo

RNAstructure Installation and Overview
Building Instructions

General Build Information

Do I need to build the package?

RNAstructure is provided both as source code and as prebuilt executables. Prebuilt executables are currently available for 32-bit Linux, 64-bit Linux, Max OS-X (Leopard and higher), 32-bit Windows, and 64-bit Windows. If you are using one of these operating systems, then you probably do not need to build the package. The available executables will work fine.

DATAPATH Variable

In order to successfully use the data tables in the RNAstructure repository during calculations, an environment variable called DATAPATH must be set to the location of the data tables folder on the current machine.

For example, in BASH, this is accomplished with:
  $ export DATAPATH=<PATH-TO-RNAstructure>/data_tables/


Building the RNAstructure JAVA GUI


The RNAstructure Graphical User Interface (GUI) is composed of two important components:  the graphical front-end, written in Java and the native back-end, RNAstructure_GUI libary written in C++. The two are linked using the Java Native Interface (JNI). In addition, SWIG is used to generate C++ and Java "glue code" to provide necessary bindings on each side.

Due to this architecture, there are three phases to building the GUI, of which only two are usually required:
  1. (Optional) Generating the SWIG code
  2. Compiling the C++ libarary
  3. Compiling the Java source code into class files and/or a Java JAR file.

The first step involves running swig, which reads *.i files and parses C++ header files to generate *.cxx files that are later included in the compilation of the native RNAstructure_GUI libary. However, the RNAstructure distrubution already includes the pre-generated SWIG files, so it is NOT necessary to run SWIG or even to have it installed unless you plan to make changes to the public interface of the RNAstructure_GUI library (i.e. to the header files inside the java_interface\SWIG directory: RNAstructureBackendCalculator.h, DotPlotBackend.h, or StructureBackend.h)

Compilation of the C++ libary and the Java interface BOTH require installation of the Oracle Java SE JDK. (The latest version is recommended for security reasons, but the minimum version is 1.7).  The Java JDK is required (instead of just the JRE) because it includes javac, the Java compiler, as well as several C++ JNI header files that are necessary for compiling the native library.  Usually the location of javac as well as the JNI header files can be determined automatically (during the "Make" commands, below) however it might be necessary to modify some variables inside the file "compile-java.h", especially on Linux systems, where the installation location of Java can vary widely from one Linux distributionand/or package manager to another.

All steps involved in building the GUI are performed using a Makefile in the RNAstructure/java_interface directory.  Importantly, this Makefile is distinct from the Makefile in the root RNAstructure directory, however it does include several of the same files (e.g. compiler.h). These java-specific commands can be run in a terminal/shell from within the RNAstructure/java_interface directory:
  • make gui - Bulilds the native C++ libary as well as the Java JAR file. This is usually the only operation most users will need to perform.
  • make swig - Generates the SWIG "glue code" (only necessary if changing the public interface of the native library)
  • make tester - Builds the Java GUI Regression test program  (only necessary for perfoming automated regression tests on the GUI)
  • make all - Performs all of the above build operations.
  • make help - Show a list of all valid Makefile goals.

When the JAVA GUI is built correctly, two new files will exist in the RNAstructure/exe directory: a single large dynamic RNAstructure library (whose name depends on the operating system), and a JAVA JAR archive, called RNAstructure.jar. See Running the RNAstructure JAVA GUI for details on how to use these files.


Building the Command Line (Text) Interfaces

Configuring the Build on Unix/Linux/OS-X

The command line (text) interfaces for RNAstructure are built using the Makefile in the main directory (RNAstructure/). The definitions for compiler and flags are in RNAstructure/compiler.h. This file is provided with the defaults set for compiling on Linux using g++. To change the platform and/or compilers, this file should be manually edited. Example flags are provided for Linux, Mac, and Cygwin platforms. To change the operating system to a non-Linux system, simply remove the "#" symbol (which denotes comments) from the variable definitions under the target type. Also, add "#" in front of the Linux flags.

Note also that flags for building with OpenMP can be set (CXXOPENMPFLAGS). The default flags will work for Linux and Mac using g++ and g++/LLVM, respectively. An example flag set is also provided for Intel compilers, and this will need to used if Intel compilers are being used.

Building on Unix/Linux/OS-X

To build the package, use the command "make all" in RNAstructure/. The command line executables are built and placed in RNAstructure/exe/. You should probably then update your PATH variable to include this directory.

Building CUDA on Unix/Linux/OS-X

In adition, if you have a CUDA compiler, you can build partition-cuda by typing "make cuda" in the RNAstructure directory. This can then be run if you have a CUDA-capable graphics card.

An optional "make install" command will copy all the executables to the /usr/local/RNAstructure/ directory. This is helpful in a shared computing environment. This command can only be executed as root.

Building Serial and SMP on Unix/Linux/OS-X

Dynalign, Fold, Multilign, and TurboFold can be built in SMP form, which allows them to delegate their workload across multiple processors at once in a shared memory environment.

By default, "make all" will build the serial programs and their SMP counteparts. To build only the serial programs, for example if the compiler does not have OpenMP support, "make serial" can be used with the Makefile in the main directory (RNAstructure/). To build only the SMP programs, use the "make SMP" target.

Building Multifind

Multifind is built separately from the rest of the package. After setting the INCLUDESVM variable, it can be built with the command make Multifind or make Multifind-smp.

Building on Windows

There are two options for compiling RNAstructure on Windows: 
  • Linux-style build process using Cygwin and MingW-W64
    Cygwin provides a complete POSIX environment on Windows and allows compilation of RNAstructure using the same framework as on Linux (i.e. gcc/g++ and GNU make). 
    • Text (Command-line) Interfaces:
      In the root RNAstructure folder run "make all". The compiled executables will be placed in the RNAstructure/exe directory.
    • RNAstructre_GUI library (required for the Java GUI)
      In the folder RNAstructure/java_interface, run "make gui
      The compiled Java JAR file (RNAstructure.jar) and native library (RNAstructure_GUI.dll) will will be placed in the RNAstructure/exe directory.
  • Microsoft Visual Studio 2012 and the Intel C++ compiler
    The Intel C++ Compiler can be integrated with Visual Studio, and is required for building the RNAstructure applications because bugs in the the stanard VS compiler introduce errors in the RNAstructure calculations.
    • Text (Command-line) Interfaces:
      In the folder RNAstructure_windows_text_interfaces, use Visual Studio 2012 to open the solution  RNAstructure_windows_text_interfaces.sln
      Then build using Visual Studio. The executables will be deposited in the Release sub-folder.
    • RNAstructre_GUI library (required for the Java GUI)
      In the folder RNAstructure_windows_dll, use Visual Studio 2012 to open the solution  RNAstructure_GUI.sln
      Then build using Visual Studio. The executables will be deposited in the Release sub-folder.