Search code examples
haskellopenmpghc

Use fopenmp in ghc to link with openmp


I have created a dynamic library that is using openmp. Whenever I want to use this lib I have to link with -fopenmp, so gcc or clang links correctly.

Now, I want to call this lib via FFI, but I have no clue, how to pass this -fopenmp-flag to ghc:

  1. Static linking is not an opinion for openmp
  2. If I link the library and ghc with the specific version of openmp (-L/usr/lib/gcc/--GCCVERSION--/ -lgomp.h) the linking does not complain but it is not activating openmp and ignoring the parameters

Does anyone has any clue how to reenable the -fopenmp


Solution

  • Ok, I guess it is a simple naming problem:

    gcc names it's openmp gomp while clang calls it omp. So, I just had to change extra librarie toomp and now, it is compiling.