abhinav dwivedi
abhinav dwivedi

Reputation: 198

OpenMP support on OSX 10.11, gcc errors with "file omp.h not found"

I have been using gcc version 5.3.0. It says that it comes with openmp support. But every time when I compile a program using either gcc [by terminal] or via xCode 7, I get same error, "file omp.h not found". I have searched too much on this issue and tried almost everything I found.

Upvotes: 1

Views: 4341

Answers (3)

rndblnch
rndblnch

Reputation: 323

the compiler on the mac is clang (based on llvm 3.5) which does not support openmp. you can try install llvm/clang/openmp from source or using prebuild binaries, but I must admit it does not work as advertised for meedit unless you use the -fopenmp=libomp flag.

Upvotes: 0

Jeff Hammond
Jeff Hammond

Reputation: 5652

You can install 'clang-omp' or 'gcc' (corresponds to GCC 5.3 right now) packages via Homebrew, both of which support OpenMP.

The built in GCC is based upon GCC 4.2.1 abs uses LLVM back end via Dragonegg, which is why it doesn't support OpenMP.

As noted already, Intel compilers support OpenMP on Mac.

I don't use Xcode editor so I don't know how to use any of these from there, but all will work from terminal just as they do on Linux.

Upvotes: 1

abhinav dwivedi
abhinav dwivedi

Reputation: 198

I changed the compiler and now I am able to run it. [It was issue of clang, which I couldn't solve]. I am a student and Intel is giving Intel Parallel Studio 1 year licence for free to students. So I downloaded, and installed it. In xCode, under build settings, I set my compiler to 'Intel C/C++ compiler' and in parallalization, I turned it to 'yes'. That was it. Then it compiled successfully. But, note that you won't be using header file 'omp.h' anymore. By the way, I am still looking for answers, just to know what I was doing wrong.

Upvotes: 2

Related Questions