LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 23492 - -fopenmp does not define _OPENMP macro
Summary: -fopenmp does not define _OPENMP macro
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: trunk
Hardware: PC All
: P normal
Assignee: Alexey Bataev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-12 06:39 PDT by zhouyan
Modified: 2015-05-19 23:25 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zhouyan 2015-05-12 06:39:31 PDT
Following recent news of Clang is OpenMP 3.1 complete, which is wonderful, I tried to use clang with OpenMP support. Before I can run any more test, it seems that the _OPENMP macro is not properly defined at all.

The following is a minimal example

#ifndef _OPENMP
#error NO OPENMP defined
#endif

int main () {}

And on compile line clang++ -fopenmp -o test test.cpp (or clang)

The following is more details of the build of clang
OS : CentOS 7 (updated daily)

LLVM subprojects in the build tree: LLVM, clang, compiler-rt, polly, clang-extra-tools, libcxx, libcxxabi

CMake options: 

args="$args -DCMAKE_BUILD_TYPE=Release"
args="$args -DCMAKE_INSTALL_PREFIX=/opt/LLVM/$prefix"
args="$args -DBUILD_SHARED_LIBS=ON"
args="$args -DLLVM_ENABLE_BACKTRACES=OFF"
args="$args -DLLVM_ENABLE_CRASH_OVERRIDES=OFF"
args="$args -DLLVM_ENABLE_PEDANTIC=OFF"
args="$args -DLLVM_ENABLE_WARNINGS=OFF"
args="$args -DLLVM_INCLUDE_DOCS=OFF"
args="$args -DLLVM_INCLUDE_EXAMPLES=OFF"
args="$args -DLLVM_INCLUDE_TESTS=OFF"
args="$args -DLLVM_TARGETS_TO_BUILD=host"
Comment 1 Alexey Bataev 2015-05-13 01:29:13 PDT
-fopenmp does not turn on OpenMP support by default. Will be fixed soon.
Use -fopenmp=libiomp5 for now.
Comment 2 zhouyan 2015-05-13 01:33:09 PDT
-fopenmp=libiomp5
appears to have the same problem. And -fopenmp seems to turn on OpenMP but only it links to libgomp. In either case, the _OPENMP macro is not defined.

A minor issue, I also have Intel Compilers paths/ld_library_path in my environment, and it appears that -fopenmp=libiomp5 cause to executable to find Intel's libiomp5.so, which is in LD_LIBRARY_PATH. Surely I can avoid this issue by using rpath etc. But is the libiomp5.so runtime distribution with Intel compilers also supported? Or only the one compiled in the LLVM tree?
Comment 3 Alexey Bataev 2015-05-19 23:25:41 PDT
Fixed in revision 237769.
-------------------
I don't expect any troubles with bundled libiomp5. You can use it.