Compiling & Installing OpenBLAS in Ubuntu 16.04


  • $ sudo apt-get install gfortran

Getting OpenBLAS Source:

Building Source:

  • cd OpenBLAS
  • make FC=gfortran
make[1]: Leaving directory ‘/mnt/avkash/OpenBLAS/exports’
OS … Linux
Architecture … x86_64
BINARY … 64bit
C compiler … GCC (command line : gcc)
Fortran compiler … GFORTRAN (command line : gfortran)
Library Name … (Multi threaded; Max num-threads is 8)
To install the library, you can run “make PREFIX=/path/to/your/installation install”.


  • $ sudo make PREFIX=/usr/local install
make -j 8 -f Makefile.install install
make[1]: Entering directory ‘/mnt/avkash/OpenBLAS’
Generating openblas_config.h in /usr/local/include
Generating f77blas.h in /usr/local/include
Generating cblas.h in /usr/local/include
Copying LAPACKE header files to /usr/local/include
Copying the static library to /usr/local/lib
Copying the shared library to /usr/local/lib
Generating OpenBLASConfig.cmake in /usr/local/lib/cmake/openblas
Generating OpenBLASConfigVersion.cmake in /usr/local/lib/cmake/openblas
Install OK!
make[1]: Leaving directory ‘/mnt/avkash/OpenBLAS’
Error:  If you hit the following error:  /usr/bin/ld: cannot find -lgfortran

-Wl,–whole-archive ../ -Wl,–no-whole-archive \
-Wl,-soname, -lm -lpthread -lgfortran -lm -lpthread -lgfortran
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
Makefile:133: recipe for target ‘../’ failed
make[1]: *** [../] Error 1
make[1]: Leaving directory ‘/home/ubuntu/toolkit/OpenBLAS/exports’
Makefile:85: recipe for target ‘shared’ failed
make: *** [shared] Error 2
Solution: You just need to use NO_LAPACK=1 parameter along with make.

$ make FC=gfortran NO_LAPACK=1

Thats it!!


Leave a Reply

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

You are commenting using your 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 )

Connecting to %s