Failed to Compile Serial C Code with -liomp5 for armhf

Asked by Claudia White

Hi,

I'm using Raspberry Pi 3 Model B with Ubuntu MATE 16.04 installed.

I tried to run a C code (with OpenMP API) serially (without -fopenmp) with the command below:
$ gcc t.c -liomp5 && ./a.out

However, I got error as such:
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../arm-linux-gnueabihf/libiomp5.so: undefined reference to `ffi_type_void'
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../arm-linux-gnueabihf/libiomp5.so: undefined reference to `ffi_prep_cif'
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../arm-linux-gnueabihf/libiomp5.so: undefined reference to `ffi_type_pointer'
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../arm-linux-gnueabihf/libiomp5.so: undefined reference to `ffi_call'

FYI, the version of libiomp-dev is 3.7.0-3
And, the version of gcc is 5.4.0
With the same command, I can compile & run the same code on PC which has Intel processor.

Below is the code:
#include <stdio.h>
#include <omp.h>

int main () {
 #pragma omp parallel {
  printf("This is thread %d\n", omp_get_thread_num());
 }
 return 0;
}

For benchmarking purpose, I need OpenMP function, such as "omp_get_thread_num()", to be recognized by the GCC compiler when the code is being compiled serially.

Do let me know if you need more info.
Thank you.

Best Regards,
Claudia

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
Best Manfred Hampl (m-hampl) said :
#1

Try adding the parameter -lffi after -liomp5

Revision history for this message
Claudia White (claudiawhite123) said :
#2

Hi,
Thanks for the reply.

Tried adding the parameter -lffi after -liomp5

I got the error:
usr/bin/ld: cannot find -lffi

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3
Revision history for this message
Claudia White (claudiawhite123) said :
#4

Thanks Manfred Hampl, that solved my question.

Revision history for this message
Claudia White (claudiawhite123) said :
#5

I feel that "thank you" is a necessity.

Thanks to Manfred Hampl & actionparsnip. ^^