26 February 2012

80. Compiling octave 3.6.1 on Debian Testing

I originally was hesitant towards building my own packages, not so much because it is difficult (well-maintained packages are easy to build using configure/make), but because you can end up with a system where dependencies break and you constantly have to manually track new releases of packages you want.

Having had to struggle with outdated or bug-ridden debian packages during the past year has made me change my mind. It obviously depends on what you use you computer for -- the debian packages are supposed to be of high quality and they do unarguably go through a lot of stability testing before being released down the chain from SID to Stable. But I also get the impression that some debian maintainers aren't...well...maintaining their packages sufficiently.

Take the alt+f2 gnome bug for example -- in an ideal world a fix should've been rolled out within 24 hours, rather than just waiting for future version increments to take care of it. The gnuplot bug is another example. There's no solution in sight, even though it has been solved in upstream. Maybe there are reasons to which I'm oblivious for this, but the end result is that I'm a lot more cautious with trusting the debian vs upstreams maintainers now.

So, as part of the  series of science packages that you should compile yourself, here's Octave 3.6.1
At the moment of writing the versions in the deb repos are 3.4.2-8, 3.4.2-12 and 3.4.2-12+b1.

As an aside, if you know what you'll be doing with each software package, create a couple of test scripts so you can track regressions. That way you can be just a little bit more confident in the results you obtain -- if you publish incorrect data you will have to go through the humiliating experience of a retraction or correction.

In addition to everything listed below you need to have a working build environment  with a good fortran compiler.
sudo apt-get install gfortran build-essential 
at a minimum thus.

-- START HERE ---
sudo apt-get install libqhull-dev libpcre++-dev libblas-dev liblapack-dev libreadline-dev
sudo apt-get install libcurl4-openssl-dev libfltk1.3-dev libgraphicsmagick++-dev libhdf5-serial-dev libqrupdate-dev libsuitesparse-metis-dev glpk gperf flex bison libfontconfig1-dev
 wget ftp://ftp.gnu.org/gnu/octave/octave-3.6.1.tar.gz
tar -xvf octave-3.6.1.tar.gz
cd octave-3.6.1/
./configure
make -j4

where 4 is the number of cores +1 (for me 3 cores)

To validate your  compiled version, run
make check

Summary:
  PASS  10008
  FAIL      0
There were 2 expected failures (see fntests.log for details).
Expected failures are known bugs.  Please help improve Octave
by contributing fixes for them.



To install
either
sudo checkinstall
or
sudo make install
Done.


Error:
checking for qhull.h... no
configure: WARNING: Qhull library not found -- this will result in loss of functionality of some geometry functions.
Solution:
sudo apt-get libqhull-dev


Error:
checking pcre.h usability... no
checking pcre.h presence... no
checking for pcre.h... no
checking pcre/pcre.h usability... no
checking pcre/pcre.h presence... no
checking for pcre/pcre.h... no
checking whether pcre.h defines the macros we need... no
configure: error: to build Octave, you must have the PCRE library and header files installed

Solution:
sudo apt-get install libpcre++-dev


Error:
checking if sgemm_ is being linked in already... no
checking for ATL_xerbla in -latlas... no
checking for sgemm_ in -lblas... no
checking for sgemm_ in -lmkl... no
checking for sgemm_ in -framework vecLib... no
checking for sgemm_ in -lcxml... no
checking for sgemm_ in -ldxml... no
checking for sgemm_ in -lscs... no
checking for sgemm_ in -lcomplib.sgimath... no
checking for sgemm_ in -lblas... (cached) no
checking for sgemm_ in -lblas... (cached) no
configure: error: You are required to have BLAS and LAPACK libraries
Solution:
sudo apt-get install libblas-dev

(libopenblas-dev is still only in the unstable repo)


Error:

checking for cheev_... no
checking for cheev_ in -llapack... no
checking for cheev_ in -llapack_rs6k... no
configure: error: You are required to have BLAS and LAPACK libraries
Solution:
sudo apt-get install liblapack-dev


Error:
configure: WARNING: I need GNU Readline 4.2 or later
configure: error: this is fatal unless you specify --disable-readline
Solution:
sudo apt-get install libreadline-dev


Error:

configure: WARNING: I didn't find gperf, but it's only a problem if you need to reconstruct oct-gperf.h
configure: WARNING: UMFPACK not found.  This will result in some lack of functionality for sparse matrices.
configure: WARNING: qrupdate not found.  The QR & Cholesky updating functions will be slow.
configure: WARNING: AMD library not found.  This will result in some lack of functionality for sparse matrices.
configure: WARNING: COLAMD library not found.  This will result in some lack of functionality for sparse matrices.
configure: WARNING: CCOLAMD library not found.  This will result in some lack of functionality for sparse matrices.
configure: WARNING: CHOLMOD library not found.  This will result in some lack of functionality for sparse matrices.
configure: WARNING: CXSparse library not found.  This will result in some lack of functionality for sparse matrices.
configure: WARNING: cURL library not found.  The ftp objects, urlread and urlwrite functions will be disabled.
configure: WARNING: GLPK library not found.  The glpk function for solving linear programs will be disabled.
configure: WARNING: GraphicsMagick++ library not found.  The imread function for reading image files will not be fully functional.
configure: WARNING: HDF5 library not found.  Octave will not be able to save or load HDF5 data files.
configure: WARNING: FLTK config script not found.  Native graphics will be disabled.
configure: WARNING: 
configure: WARNING: I didn't find the necessary libraries to compile native
configure: WARNING: graphics.  It isn't necessary to have native graphics,
configure: WARNING: but you will need to have gnuplot installed or you won't
configure: WARNING: be able to use any of Octave's plotting commands
configure: WARNING: 
configure: 
configure: NOTE: libraries may be skipped if a library is not found OR
configure: NOTE: if the library on your system is missing required features.

Solution:
First, make a few decisions:
Package libhdf5-dev is a virtual package provided by:
  libhdf5-serial-dev 1.8.4-patch1-3
  libhdf5-openmpi-dev 1.8.4-patch1-3
  libhdf5-mpich-dev 1.8.4-patch1-3
  libhdf5-lam-dev 1.8.4-patch1-3
You should explicitly select one to install.
Package libcurl-dev is a virtual package provided by:
  libcurl4-openssl-dev 7.24.0-1
  libcurl4-nss-dev 7.24.0-1
  libcurl4-gnutls-dev 7.24.0-1
You should explicitly select one to install.
Package libfltk-dev is a virtual package provided by:
  libfltk1.3-dev 1.3.0-5
  libfltk1.1-dev 1.1.10-10
You should explicitly select one to install.
Package libumfpack4-dev is a virtual package provided by:
  libsuitesparse-metis-dev 3.1.0-2
  libsuitesparse-dev 1:3.4.0-2
You should explicitly select one to install.
I chose thusly:

sudo apt-get install libcurl4-openssl-dev libfltk1.3-dev libgraphicsmagick++-dev libhdf5-serial-dev libqrupdate-dev libsuitesparse-metis-dev

The following errors/mesages remain:

  Do internal array bounds checking:  false
  Use octave_allocator:               false
  Build static libraries:             false
  Build shared libraries:             true
  Dynamic Linking:                    true (dlopen)
  Include support for GNU readline:   true
  64-bit array dims and indexing:     false

configure: WARNING: I didn't find gperf, but it's only a problem if you need to reconstruct oct-gperf.h
configure: WARNING: GLPK library not found.  The glpk function for solving linear programs will be disabled.
configure: 
configure: NOTE: libraries may be skipped if a library is not found OR
configure: NOTE: if the library on your system is missing required features.


The 64 bit issue can probably  be solved using ./configure --enable-64 BUT requires BLAS that is compatible with 64 bit integers.


Links to this page:
http://tata-box-blog.blogspot.nl/2012/04/install-octave-361-in-debian-squeeze.html
http://askubuntu.com/questions/124731/when-will-octave-3-6-1-be-available-to-be-installed

7 comments:

  1. Error:
    checking whether we are using the GNU C++ compiler... no
    checking whether g++ accepts -g... no
    checking dependency style of g++... none
    checking how to run the C++ preprocessor... /lib/cpp
    configure: error: in `/home/bachi/Downloads/octave-3.6.1':
    configure: error: C++ preprocessor "/lib/cpp" fails sanity check
    See `config.log' for more details

    Solution:
    sudo apt-get install g++

    ReplyDelete
    Replies
    1. Andreas, if you install build-essential (and gfortran as listed above) you'd get g++ too.

      Delete
    2. Oh, sorry! I skipped this part and just copy&paste the section '-- START HERE ---'. My fault!

      Delete
  2. Error:
    checking whether we are using the GNU Fortran 77 compiler... no
    checking whether accepts -g... no
    checking how to get verbose linking output from ... configure: WARNING: compilation failed

    checking for Fortran 77 libraries of ...
    checking for dummy main to link with Fortran 77 libraries... none
    checking for Fortran 77 name-mangling scheme... configure: error: in `/home/bachi/Downloads/octave-3.6.1':
    configure: error: cannot compile a simple Fortran program
    See `config.log' for more details

    Solution:
    sudo apt-get install gfortran

    ReplyDelete
  3. Error:
    configure: WARNING: I didn't find gperf, but it's only a problem if you need to reconstruct oct-gperf.h
    configure: WARNING: I didn't find flex, but it's only a problem if you need to reconstruct lex.cc
    configure: WARNING: I didn't find bison, but it's only a problem if you need to reconstruct parse.cc
    configure: WARNING: GLPK library not found. The glpk function for solving linear programs will be disabled.
    configure: WARNING: Fontconfig library not found. Native graphics will be disabled.

    Solution;
    sudo apt-get install glpk gperf flex bison libfontconfig1-dev

    ReplyDelete
    Replies
    1. Cheers Andreas, I'm including this in the dependencies above.

      Delete
  4. Thank you, your post successfully help me to get the 3.6.1 version of Octave in my Debian Squeeze (Crunchbang Linux 10). I will cite you in my blog.

    Greetings from Monterrey Mexico. Benjamin

    ReplyDelete