runtime-errorlapackblasgcc4.9gcc6

C code that uses blas, lapack and openmp working with gcc 4.9 but gives run time error with gcc 6


I have written a code in C.

You can find the source code here.

It makes use of the libraries blas, lapack and openmp.

I have compiled the blas and lapack libraries following these instrucions.

I use these flags to tell the compiler the libraries that it should link: -lblas -llapack -fopenmp.

I was using gcc 4.9 and the program can run correctly.

Recently I have updated gcc to gcc 6 and it shows many warning msgs about the implicit declaration of the blas and lapack functions:

src/PSIRWLS-train.c:152:17: warning: implicit declaration of function 'dgemm_' [-Wimplicit-function-declaration]
                 dgemm_(&trans, &trans, &(dataset.l), &ncols, &size,&factorA, KSC, &(dataset.l), miZ, &size, &factor, miKSM, &(dataset.l));

And when I run the app a segmentation fault error appears.

I am completely lost about the differences of gcc 4.9 and gcc 6, do you know any explanation about this?


Solution

  • Problem solved.

    1 - Some default flags are different in gcc 4 and 6. gcc 6 shows warnings when you don't decleare blas and lapack functions this way:

    extern void dgemm_(...)

    2 - It scaped me the initialization of one variable that had to be initialized to 0. I coded int i,j = 0; when I had to code int i=0, j=0;

    gcc 4 initialized i to 0 (and the program was running correctly) and gcc 6 didn't (creating a segmentation fault because these variables were to index)