The source code is:
#include "mex.h"
#include <omp.h>
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[] )
{
printf("Num threads %d.\n", omp_get_num_threads());
}
//The compile line is:
gcc -fopenmp -fPIC -O3 -Wall -otest.mexa64 -shared -fexceptions -I/thayerfs/apps/matlabR2008b/extern/include -I./test.c -L/thayerfs/apps/matlabR2008b/bin/glnxa64 -lm
(Of course, the path names are system dependent.)
It compiles fine, but when I run it, it reports error:
>> test
??? Invalid MEX-file '/thayerfs/home/songbai_ji/itk/test.mexa64':
/usr/lib/libgomp.so.1: cannot allocate memory in static TLS block.
Could someone tell me what is going wrong?