libiomp5.so problem on arm

Hi

I have successfully cross compiled libiomp5.so for ARM using clang and arm-linux-gnueabihf toolchain. Then I cross compiled a simple openmp program with libiomp5.so. But when I tried to run the program on ARM, I got a problem. The program is:

#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
int main(int argc, char** argv)
{
int i = 0;
#pragma omp parallel for
for(i = 0; i < 10; i++) {
int tid = omp_get_thread_num();
printf(“hello from thread %d\n”, tid);
}
return 0;
}

The output is:

hello from thread 0
hello from thread 0
hello from thread 2
hello from thread 2
hello from thread 1
hello from thread 1
hello from thread 3
hello from thread 3
hello from thread 4
hello from thread 4
pthread_mutex_lock.c:80: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0’ failed.
Aborted

Can someone provide some help?

Thanks!

Xiaokang

Can you provide more data about your build environment? i.e. exact llvm, clang, and openmp runtime versions?

I’ll take a look at this issue over the weekend (though I need to get my ARM box up and running again, it’s currently unbootable).