clang-omp / clang

clang with OpenMP 3.1 and some elements of OpenMP 4.0 support
clang-omp.github.com
Other
91 stars 15 forks source link

fatal error: 'omp.h' file not found #58

Closed wdng closed 9 years ago

wdng commented 9 years ago

Followed steps from http://clang.llvm.org/get_started.html. After installation and setting up environment, it generates a error "fatal error: 'omp.h' file not found" when I used it to compile a OepnMP code like this: "clang -fopenmp test_openmp.c". Any ideas on this?

sfantao commented 9 years ago

Hi Wei,

Your omp.h header file may not be in the clang default search path. You need to find it first in your system, you can use the one that comes with the LLVM OpenMP library or even the one that comes with gcc. Notwithstanding the latter works in some cases, you should try to use an header files that matches your runtime. Then, you just need to tell clang about it by using '-I' or by setting C_INCLUDE_PATH (or CXX_INCLUDE_PATH) accordingly.

Regards, Samuel

Wei Ding notifications@github.com wrote on 01/12/2015 04:57:37 PM:

From: Wei Ding notifications@github.com To: clang-omp/clang clang@noreply.github.com Date: 01/12/2015 04:57 PM Subject: [clang] fatal error: 'omp.h' file not found (#58)

Followed steps from http://clang.llvm.org/get_started.html. After installation and setting up environment, it generates a error "fatal error: 'omp.h' file not found" when I used it to compile a OepnMP code like this: "clang -fopenmp test_openmp.c". Any ideas on this? — Reply to this email directly or view it on GitHub.[image removed]

wdng commented 9 years ago

Sfantao, thank you so much for your reply.

I put my solution here for other users' reference:

clang -fopenmp openmp_test.c -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include -L/OPENMP_RUNTIME_LIB

In order to get OPENMP_RUNTIME_LIB, we can checkout code from:

svn co http://llvm.org/svn/llvm-project/openmp/trunk openmp

and then compile and set up lib path manually.