cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
3,529 Views
Registered: ‎08-10-2017

How to build an OpenMP application using gcc compiler in PetaLinux 2016.4?

I'm trying to run a basic OpenMP example on the ZedBoard using PetaLinux 2016.4.

 

#include <stdio.h>
#include <omp.h>

int main(){
  int x;
  x = 2;
  #pragma omp parallel num_threads(2) shared(x)
{
    if (omp_get_thread_num() == 0) {
       x = 5;
    } else { 
    /* Print 1: the following read of x has a race */ 
      printf("1: Thread# %d: x = %d\n", omp_get_thread_num(),x ); 
    }
    #pragma omp barrier
    if (omp_get_thread_num() == 0) {
    /* Print 2 */ 
      printf("2: Thread# %d: x = %d\n", omp_get_thread_num(),x );
    } else {
    /* Print 3 */ 
      printf("3: Thread# %d: x = %d\n", omp_get_thread_num(),x );
    }
  }
  return 0; 
}

As you can see, this is a very basic example. If I run this application in my PC (native), everything is O.K.

 

But when I try of building this application using petalinux-build, all the time a mistake appear. The error indicates the next: "no package provides libgomp.so.1.

 

I tried to modify the file located at /build/conf/local.conf, I added there IMAGE_INSTALL_append = " libgomp", but this solution did not work.

 

I also tried to modify the file located at Petalinux/components/yocto/source/arm/layers/poky/meta/recipes-devtools/gcc/gcc-5.3.inc. I commented the line --disable-libgomp \. But again, it did not solve the problem.

 

Apparently, libgomp is part of gcc. So, I don't not why it doesn't work. Google has not been very useful.

 

Does anyone know a solution for this problem? How can I repair the mistake mentioned above?

0 Kudos
0 Replies