I'm not sure if a simple test case exists - this bugs seems to manifest in fairly unusual scenarios. We experienced this while creating "mex" modules for Matlab.
Using this trivial example (test.c): #include <omp.h> #include "mex.h" void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { int nthreads, tid; #pragma omp parallel private(nthreads, tid) { tid = omp_get_thread_num(); printf("Hello World from thread = %d\n", tid); if (tid == 0) { nthreads = omp_get_num_threads(); printf("Number of threads = %d\n", nthreads); } } } And compiling with: gcc -fopenmp -fPIC -o test.mexa64 -shared -I/opt/matlab/extern/include test.c We get the following error: $ export OMP_NUM_THREADS=4; echo "test" | matlab -nodisplay >> ??? Invalid MEX-file '/home/user/testmex/test.mexa64': /usr/lib/libgomp.so.1: cannot allocate memory in static TLS block. This is with gcc-4.2-base and libgomp1 4.2.4-1ubuntu3 After upgrading to gcc-4.2-base and libgomp1 4.2.4-1ubuntu4, the code works properly: $ export OMP_NUM_THREADS=4; echo "test" | matlab -nodisplay >> Hello World from thread = 1 Hello World from thread = 3 Hello World from thread = 2 Hello World from thread = 0 Number of threads = 4 So, at least for this specific case of a Matlab mex module dynamically linked to libgomp, 4.2.4-1ubuntu4 fixes the problem. I hope this helps... -- Please apply libgomp patch to GCC for Hardy Heron https://bugs.launchpad.net/bugs/235070 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs