Osra is a a utility designed to convert graphical representations of chemical structures create by Igor Filippov at the National Cancer Institute. This page documents how to compile and install Osra on Ubuntu Linux 11.10. These instructions may work on other versions of Ubuntu Linux and on Debian Linux. Please leave a comment if you have compiled Osra using these instructions on a different version of Ubuntu, or on other Linux distributions.
At the time of writing this doc, March 2012, the Osra version is 1.3.8 and is available at:
I copied all the source to a directory in /tmp. If you need the source code at some later point in time, don’t use /tmp as files in /tmp are deleted upon reboot (if they’re older than 14 days). Also, at the time of writing Osra requires a patched version of Gocr for Osra to work. You need to install Gocr before you try to compile and install Osra, you also need to install other packages required for Osra to compile. Most are listed below, but see the Osra Homepage for more details.
An overview of the steps are:
- Install required Ubuntu packages
- Compile and Install Gocr
- Compile and Install Osra
I’ve also written instructions on how to install Osra 1.2.1 on Ubuntu 9.04, however that was written in 2009.
Install Ubuntu Packages
These packages are required to build Osta. Install the following (you will also need some gaphicsmagick packages also, libgraphicsmagick1-dev libgraphicsmagick++3 and maybe some others).
sudo apt-get install libtclap-dev libpotrace0 libpotrace-dev libocrad-dev openbabel libopenbabel-dev libgraphicsmagick++1-dev libgraphicsmagick++1-dev libgraphicsmagick++3 libgraphicsmagick1-dev libgraphicsmagick3 libnetpbm10-dev
Copy and paste the following line to make a directory in /tmp called OSRA, download the source, extract the packages, and build and install both:
cd /tmp; mkdir OSRA; cd OSRA; wget http://cactus.nci.nih.gov/osra/osra-1.3.8.tgz ; wget http://cactus.nci.nih.gov/osra/gocr-0.50pre-patched.tgz ; tar xzvf osra-1.3.8.tgz; tar xzvf gocr-0.50pre-patched.tgz; cd /tmp/OSRA/gocr-0.50pre-patched; ./configure; make libs; sudo make all install; cd /tmp/OSRA/osra-1.3.8/; ./configure; make all; sudo make install
Osra should be installed in /usr/local/bin .
Below are the same steps, but with more detail so that you know what your doing:
Create Directory to Build the Packages
Download the Source
If you have wget install you can download the source via the command line:
wget http://cactus.nci.nih.gov/osra/osra-1.3.8.tgz ;
Otherwise go to the Osar home page and download the source code pacakge for both Osra and Gocr and save it in the directory you created.
Extract both packages
tar xzvf osra-1.3.8.tgz
tar xzvf gocr-0.50pre-patched.tgz
Compile & Install Gocr
You need to make and install the patched Gocr before you try to build Osra:
sudo make all install;
This will install the patched gocr into /usr/local and copy Gocr header files to /usr/local/include/gocr. This may cause conflicts if you’ve installed gocr using another methods for instance using apt-get or aptitude. The gocr binary will be in /usr/local . If you have any problems, remove any other version of Gocr you may have build.
Before you continue to the next step, make sure the Gocr header files are installed:
$ ls /usr/local/include/gocr/
config.h* gocr.h* list.h* output.h* pgm2asc.h* pnm.h* unicode.h*
If you don’t see the header files, make sure you followed all the steps above.
Compile & Install Osra
Next compile Osra:
To install Osra on your system, run the following using sudo:
sudo make install
Look for it in /usr/local/bin:
Note: If you break your system while following these instructions, it’s not my fault. These are give in good faith, but if I’ve typed something wrong, too bad, I am not responsible! 🙂
/usr/local/bin/osra version: 1.3.8
Updated April 12th 2012: Added libnetpbm10-dev to the list of required packaged to pre-install.
Updated April 16th 2012: Added missing build steps to Gocr section. Was missing ./configure step
Updated April 17th 2012: Added “make libs” to the Gocr build steps, and fixed typo in the quickie install section.
Updated April 20th 2012: Added libocrad-dev to list of packages to add. Note: This package is not available for Lucid!
Updated April 21st: Updated dependencies and cleaned up the document.
14 thoughts on “Build & Install Osra 1.3.8 on Ubuntu 11.10”
I’m trying to build OSRA, and am having some issues with getting the patched version of GOCR running. I wondered if you could suggest any solution.
I’m running Ubuntu 12.04b2, and when I build the GOCR I get a Error: cannot find -lnetpbm.
I previously had the unpatched version of GOCR installed from a repository, but removed it before I tried building the patched version. I had netpbm10 ibstalled, and have now added netpbm9 to test if v10 was too recent.
Any help would be grateully recieved, cheers. Dave
Maybe you don’t have the netpbm dev packages installed? These contain the library and header files needed to build against netpbm.
Try installing libnetpbm10-dev or libnetpbm9-dev, and if that works let me know and I’ll update the posting.
Thanks, that seemed to fix the problem with regards to GOCR. Now I just have to find out how to get the pgm2asc.h headers. When trying to build OSRA 1.3.8 itself I get the error – error: pgm2asc.h header(s) is missing. Check the default/listed above headers locations.
I can see that the header is in the src directory of the patched GOCR tar file that I started with – but I can’t find the header anywhere else on my system. Do you have any pointers?
Thanks for your help once again.
If you installed GOCR, the header file should be in:
To install it, you need to change directory to the where the gocr-0.50pre-patched source and run:
sudo make install;
Thanks for the response Mick. The issue was that while gocr had built (and I could run it) there was an error in the make process which means that while /usr/local/include/gocr/ was created none of the headers were written to it. I’ve filed this on the Sourceforge page – but I’m currently stuck.
Dave, are you using the patched version of Gocr from the Osra download page at:
I am using the patched version of gocr
That Sourceforge link doesn’t work for me. I downloaded all the packages from the Osra page at: http://cactus.nci.nih.gov/osra/#6 .
I’d suggest walking through the instructions again, and downloading the source code from the Osra page.
Hi Mick & Dave,
I have the same problem with GOCR. I’ve tried installing the patched version from the OSRA website, but the /usr/local/include/gocr directory remains empty after ‘sudo make install’.
OSRA configure is not happy – it looks in /usr/include/gocr then /usr/local/include/gocr for pgm2asc.h, which it can’t find!
The GOCR/src Makefile includes this list of .h files in variable INCLUDEFILES = pgm2asc.h output.h list.h unicode.h gocr.h pnm.h.
I’ve tried copying these files into /usr/include/gocr/, but that did not do the trick… (I can’t find a detailed explanation of the INSTALL function and how it works – it appears that MAKE INSTALL simply pastes the compiled files across to the destination dirs).
pgm2asc.h output.h list.h unicode.h gocr.h pnm.h
I’m interested to know how you fixed this problem!
Ha! I think I figured out the problem, ./configure needs to be run first.
I cleaned out /usr/local/include/gocr/ . Then I grabbed the sources and tried rebuilding and encountered the same problem. The header files weren’t being copied!
This is what you have to do to build gocr:
sudo make install
And that’s it! 🙂
I’ll update the posting.
Ant e-mailed me about the problems he was having. We determine that there’s a step missing from the Gocr build steps you need to run “make libs” before make install:
sudo make install;
Thanks! I would have been hung up on building gocr for some time without your pointers…
Greetings, I followed the instructions above, also installed dependencies potrace, tclap etc, as per OSRA site.
It seems that my osra folder is empty
I cleaned out with
then ran (to no avail)
sudo make install;
I’m running debian squeeze. Any suggestions?
Look at the output of “sudo make install”, it should produce output that should help troubleshoot the problem.