How to install the Vienna RNA Package on Ubuntu

I’ve been trying to install the Vienna RNA Package from source on Ubuntu Lucid Linx (10.04), but every time I tried make it would fail with the following errors:

rnafuncs.cpp:341: error: ‘sprintf’ was not declared in this scope
rnafuncs.cpp:361: error: ‘sprintf’ was not declared in this scope

rnafuncs.cpp:582: error: ‘sprintf’ was not declared in this scope
rnafuncs.cpp:588: error: ‘sprintf’ was not declared in this scope

I thought that looked a bit odd (how could a standard function like sprintf not be declared?) but after a little googling I found this page (in Japanese – I suggest using Google translate if you can’t read Japanese), where the author points out that the source file in question does not include stdio.h which defines sprintf. After editing rnafuncs.cpp to include including stdio.h everything compiled without any errors (although there were still a few minor warnings).

Solution

Inside the Vienna RNA Package source folder (for me this is ViennaRNA-1.8.4), open RNAforester/src/rnafuncs.cpp and add #include <stdio.h> on line 9, so that it looks like this:

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#ifndef WIN32
#include "config.h"
#endif

After saving, it should compile and install without errors.

Note

If you want to use RNAForester you will also need to install the g2 graphics package (as explained in INSTALL). In Ubuntu this package is called libg20, and you can install it using Synaptic.

Advertisements

About this entry