Entropic Evolution

Thoughts of a Computational Biologist

Compiling NCBI’s blast 2.2.28+ in Mountain Lion

Note: left gutter and numbers in shell commands below to help differentiate the terminal commands and outputs from the text describing what I did.

Recently, NCBI sent an e-mail about the release of blast version 2.2.28+. Since my post on compiling NCBI’s blast 2.2.27+ there has been two updates to Apple’s Xcode, claiming to have solved some problems with the libraries and such. Therefore I thought it would be a good idea to test whether blast 2.2.28+ would compile with Xcode’s gcc (I mean the whole of gcc, including g++ and such). I have to say that I checked the versions of gcc each time I updated Xcode, and they did not seem to be any different from one update to the next. Anyway, before going there, you have to know that NCBI offers a precompiled package that’s installable in your mac with a few clicks. If you want to check the latest versions of blast, you can use rsync as follows:

% rsync rsync://rsync.ncbi.nih.gov/blast/executables/LATEST/

Warning Notice!

You are accessing a U.S. Government information system which includes this
computer, network, and all attached devices. This system is for
Government-authorized use only. Unauthorized use of this system may result in
disciplinary action and civil and criminal penalties. System users have no
expectation of privacy regarding any communications or data processed by this
system. At any time, the government may monitor, record, or seize any
communication or data transiting or stored on this information system.

-------------------------------------------------------------------------------

Welcome to the NCBI rsync server.


drwxr-sr-x        4096 2013/04/01 07:57:28 .
-rw-r--r--       12372 2013/04/01 07:56:14 ChangeLog
-rw-r--r--   167576531 2013/04/01 07:57:28 ncbi-blast-2.2.28+-1.i686.rpm
-rw-r--r--    11311115 2013/04/01 07:56:21 ncbi-blast-2.2.28+-1.src.rpm
-rw-r--r--   143314017 2013/04/01 07:57:24 ncbi-blast-2.2.28+-1.x86_64.rpm
-rw-r--r--   167568023 2013/04/01 07:56:21 ncbi-blast-2.2.28+-ia32-linux.tar.gz
-rw-r--r--    56884597 2013/04/01 07:56:23 ncbi-blast-2.2.28+-ia32-win32.tar.gz
-rw-r--r--    13468751 2013/04/01 07:57:28 ncbi-blast-2.2.28+-src.tar.gz
-rw-r--r--    16432579 2013/04/01 07:56:24 ncbi-blast-2.2.28+-src.zip
-rw-r--r--   272477554 2013/04/01 07:56:14 ncbi-blast-2.2.28+-universal-macosx.tar.gz
-rwxr-xr-x    56973053 2013/04/01 07:56:03 ncbi-blast-2.2.28+-win32.exe
-rwxr-xr-x    65109245 2013/04/01 07:56:25 ncbi-blast-2.2.28+-win64.exe
-rw-r--r--   143305527 2013/04/01 07:56:01 ncbi-blast-2.2.28+-x64-linux.tar.gz
-rw-r--r--    64865852 2013/04/01 07:56:27 ncbi-blast-2.2.28+-x64-win64.tar.gz
-rw-r--r--   273970314 2013/04/01 07:56:35 ncbi-blast-2.2.28+.dmg
%

Notice the last line? That’s a “dmg” package that you can use to install blast in your mac, and it has worked all right for me, only I have this mania to compile it in my machine for no other reason than being a maniac who suspects that compiling might help it run faster (I don’t think I might test this though), besides some dislike for “universal” binaries. I could not care less if my blast does not run in macs other than my own (muahahahahahahahahaha!). So I downloaded the “src.tar.gz” file for compilation.

So, first things first, we download the source:

% rsync -vz rsync://rsync.ncbi.nih.gov/blast/executables/LATEST/ncbi-blast-2.2.28+-src.tar.gz .

Warning Notice!

You are accessing a U.S. Government information system which includes this
computer, network, and all attached devices. This system is for
Government-authorized use only. Unauthorized use of this system may result in
disciplinary action and civil and criminal penalties. System users have no
expectation of privacy regarding any communications or data processed by this
system. At any time, the government may monitor, record, or seize any
communication or data transiting or stored on this information system.

-------------------------------------------------------------------------------

Welcome to the NCBI rsync server.


ncbi-blast-2.2.28+-src.tar.gz

sent 46 bytes  received 13474041 bytes  769947.83 bytes/sec
total size is 13468751  speedup is 1.00
% ls
ncbi-blast-2.2.28+-src.tar.gz
% 

Then we untar, move to the proper directory and run configure (I used “|tail -10″ to only show the last lines of the output for brevity, but you don’t need that part):

% tar zxvf ncbi-blast-2.2.28+-src.tar.gz | tail -10
ncbi-blast-2.2.28+-src/c++/src/html/ncbi_menu.js
ncbi-blast-2.2.28+-src/c++/src/html/indentstream.cpp
ncbi-blast-2.2.28+-src/c++/src/html/ncbi_menu_dyn.js
ncbi-blast-2.2.28+-src/c++/src/html/node.cpp
ncbi-blast-2.2.28+-src/c++/src/html/jsmenu.cpp
ncbi-blast-2.2.28+-src/c++/src/html/selection.cpp
ncbi-blast-2.2.28+-src/c++/src/html/components.cpp
ncbi-blast-2.2.28+-src/c++/src/html/page.cpp
ncbi-blast-2.2.28+-src/c++/src/html/html.cpp
ncbi-blast-2.2.28+-src/c++/configure
% cd ncbi-blast-2.2.28+-src/c++/
% ls
compilers/ configure* include/   scripts/   src/
% 
% ./configure --without-debug --with-mt --with-build-root=ReleaseMT --with-64 --with-static --prefix=/usr/local/ncbi |& tail -10
  disabled: bdb ctools gui gbench

Tools / flags / paths:  /Users/xxx/EXAMPLE/ncbi-blast-2.2.28+-src/c++/ReleaseMT/build/Makefile.mk
Configuration  header:  /Users/xxx/EXAMPLE/ncbi-blast-2.2.28+-src/c++/ReleaseMT/inc/ncbiconf_unix.h

To build everything:  cd /Users/xxx/EXAMPLE/ncbi-blast-2.2.28+-src/c++/ReleaseMT/build && make all_r
or simply run make in the current directory


******* CONFIGURATION SUCCESSFUL *******
% make
... [a lot of the output not shown for brevity and sanity] ...
/Users/xxx/EXAMPLE/ncbi-blast-2.2.28+-src/c++/src/objtools/blast/seqdb_writer/build_db.cpp:1420: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[5]: *** [build_db.o] Error 1
FAILED: src/objtools/blast/seqdb_writer/Makefile.writedb.lib
/bin/rm -f libwritedb.a .writedb.dep .libwritedb.a.stamp
/bin/rm -f /Users/xxx/EXAMPLE/ncbi-blast-2.2.28+-src/c++/ReleaseMT/lib/libwritedb.a /Users/xxx/EXAMPLE/ncbi-blast-2.2.28+-src/c++/ReleaseMT/status/.writedb.dep \
	    /Users/xxx/EXAMPLE/ncbi-blast-2.2.28+-src/c++/ReleaseMT/lib/libwritedb-static.a /Users/xxx/EXAMPLE/ncbi-blast-2.2.28+-src/c++/ReleaseMT/status/.writedb-static.dep
make[4]: *** [all.nonusr] Error 2
make[3]: *** [all_r.real] Error 5
make[2]: *** [all_r.real] Error 5
make[1]: *** [all_r.real] Error 5
make: *** [all] Error 2
% 

I saved you the pain of looking at the make process only to see, by the end, that the compilation failed (segmentation fault: 11). So I was left again to compiling using gcc-4 as installed by fink (sorry, today I will not say anything but that fink is great to install gnu and other free software), which has the binaries at “/sw/bin”. I was a bit worried because I compiled the previous blast with gcc 4.7, but there was an update in fink to gcc 4.8:

% gcc-4 --version
gcc-4 (GCC) 4.8.0
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% which gcc-4
/sw/bin/gcc-4
% 

The only way to know if this one will work is to try it. So, I changed the environmental variables that help “configure” realize my preference for gcc-4 as follows (with options for better optimization just because):

% setenv CC /sw/bin/gcc-4
% setenv CXX /sw/bin/g++-4
% setenv CFLAGS "-O3"
% setenv CXXFLAGS "-O3"
%

(Remember that I use the tcsh, but you probably work with bash, therefore instead of setenv you should use “export CC=/sw/bin/gcc-4″ and so on instead.)

Then try again the stuff above (tar, cd, configure, and make). Now NCBI’s blast suite of programs will compile, and all you have to do after make is “sudo make install” and you will have blast compiled, optimized with “-O3″, at 64 bits, up and running:

% sudo make install
... [output not shown for sanity's sake]
% blastp -version
blastp: 2.2.28+
Package: blast 2.2.28, build Apr 11 2013 10:55:21
% file `which blastp`
/usr/local/ncbi/bin/blastp: Mach-O 64-bit executable x86_64
%

Have fun!
-SuperGabo

4 comments on “Compiling NCBI’s blast 2.2.28+ in Mountain Lion

  1. Charles
    August 30, 2013

    Thank you for saving me lots of time trying to figure out the fault on my own. I’m building it from scratch so i can try using gpu-blast and cuda to run blast on my mac’s gpu, potentially running it faster. This will help alot.

    • gabo
      August 31, 2013

      Not a problem.

    • gabo
      October 12, 2013

      Hi Charles,
      Let me know if gpu-blast runs faster.

  2. Pingback: NCBI’s blast 2.2.29+ compiled under mavericks | Entropic Evolution

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on April 12, 2013 by in Bioinformatics, Education, General Science, Work Habits and tagged , , , , .

Twitter Updates

  • Tiny bookstore at Mexican little mall. Oparin's origin of life for 32 pesos! (brand new edition, in Spanish) 1 day ago
  • @GaboTuitero ¿Se traduce aquí desarrollo como evolución? 3 days ago
  • Waking up to a rooster 5 days ago
  • RT @mongodbinc: Want to develop an app? Learn how with MongoDB. Free, online professional training at MongoDB University http://t.co/c29N7K… 2 weeks ago
  • A lot of the work in computational biology is figuring out where to find the data and how to work with it. Just do it! 2 weeks ago
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: