Building GNU Scientific Library(GSL) from source

In the DPS915 workshop 2 we started working with the GNU Scientific Library(GSL) to perform some matrix operations.

GSL is an implementation of Basic Linear Algebra Subprograms(BLAS)

By default, the GSL libraries don’t come pre install on OSX, so if you want to use them you gotta install it yourself


You can download the latest stable release from here.
At this time, the latest stable one is version 1.15


Unzip the files and navigate to the folder.
The steps to install:

Check if all the dev dependencies are installed


Build the libraries.

time make -j12 > /dev/null

  • time will output how much the build process took
  • -j lets you specify how many cores to use during the build
  • > /dev/null redircts the output to make the build faster

Finally, it is time to install the libraries

sudo make install

The header files are installed in:


And some libraries in:


Test it

To check if the gsl libs are working you can try to run a sample program:

 // matMult.cpp

 extern "C" {  
 using namespace std;  
 #define WIDTH 5

 int main(int argc, char** argv) {  
 if (argc != 2)  
 cerr << "** invalid number of arguments**" << endl;  
 else {  
 int n = atof(argv[1]);  
 float* a = new float[n * n];  
 float* b = new float[n * n];  
 float* c = new float[n * n];  
 int k = 0;  
 double f = 1.0 / RAND_MAX;  
 for (int i = 0; i < n; i++)  
 for (int j = 0; j < n; j++)  
 a[k++] = rand() * f;  
 k = 0;  
 for (int i = 0; i < n; i++)  
 for (int j = 0; j < n; j++)  
 b[k++] = rand() * f;

 // compute matrix product  
 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,  
 n, n, n, 1.0, a, n, b, n, 0.0, c, n);

 // output result  
 k = 0;  
 cout << setprecision(6) << fixed;  
 for (int i = 0; i < n; i++) {  
 cout << setw(5) << i+1 << ‘:';  
 for (int j = 0; j < n; j++) {  
 cout << setw(10) << c[k++] << ‘ ‘;  
 if (j % WIDTH == WIDTH – 1)  
 cout << endl << setw(5) << i+1 << ‘:';  
 cout << endl;  
 cout << endl;  
 delete [] a;  
 delete [] b;  
 delete [] c;  

To compile:

g++ -std=c++0x -Wall matMult.cpp -o matMult -lgslcblas

-std=c++0x enables c++0x support

To run the program:

./matMult 2

The first argument is the size of the matrix you want to generate

If you see a 2 by 2 matrix then it means it worked :)

*The code sample was taken from

Debug Build of Firefox on Ubuntu

Following the tutorial on MDN  and with the help of the #developer channel on IRC I was able to build firefox in debug mode.
These are the steps I followed to get the build working:

Install dependencies:

apt-get build-dep firefox
apt-get install mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13 yasm

Create .mozconfig file in the root of your project

. $topsrcdir/browser/config/mozconfig
mkaddoptions MOZOBJDIR=@TOPSRCDIR@/ff-dbg
addoptions –disable-optimize
addoptions –enable-debug
add_options –enable-tests


make -f build

It took me around 1h 10min to finish the build

To run firefox:

cd ff-dbg/dist/bin

For some reason, when I start the browser, after a few seconds it goes to sleep and crashes

Also if I try to run the firefox-bin I get this error: