LLVM-openmp install problem

I tried to build and install openmp project in llvm, but met these errors.
The llvm-project commit is 40b9c3.
I built llvm with this instruction:

cmake ../llvm \
            -DLLVM_TARGETS_TO_BUILD="host" \
            -DCMAKE_INSTALL_PREFIX=../install \
            -DLLVM_ENABLE_PROJECTS="llvm;mlir;clang;openmp" \
            -DCMAKE_BUILD_TYPE=Release \
            -G Ninja

and then installed:

cmake --build . --target install

but got these errors:

In file included from /root/llvm/SWStencil/llvm-project/openmp/runtime/src/kmp_csupport.cpp:15:
In file included from /root/llvm/SWStencil/llvm-project/openmp/runtime/src/kmp.h:118:
/root/llvm/SWStencil/llvm-project/openmp/runtime/src/kmp_barrier.h:111:51: error: use of undeclared identifier 'KMP_INTERNAL_MALLOC'
    distributedBarrier *d = (distributedBarrier *)KMP_ALIGNED_ALLOCATE(
/root/llvm/SWStencil/llvm-project/openmp/runtime/src/kmp_barrier.h:43:47: note: expanded from macro 'KMP_ALIGNED_ALLOCATE'
#define KMP_ALIGNED_ALLOCATE(size, alignment) KMP_INTERNAL_MALLOC(size)
/root/llvm/SWStencil/llvm-project/openmp/runtime/src/kmp_barrier.h:131:52: error: use of undeclared identifier 'KMP_INTERNAL_FREE'
  static void deallocate(distributedBarrier *db) { KMP_ALIGNED_FREE(db); }
/root/llvm/SWStencil/llvm-project/openmp/runtime/src/kmp_barrier.h:44:31: note: expanded from macro 'KMP_ALIGNED_FREE'

any help can make this install successfully is appreciated !

What OS and GCC version were you using?

my os is Debian GNU/Linux(Ubuntu 9.3.0-17ubuntu1~20.04) and my GCC version is 11.1.0. And my cpu is arm cpu

I can’t reproduce the error on my local ARM system with same GCC but different OS, CentOS Linux release 8.1.1911 (Core). Can you put the complete log here?

I found the reason. This is because I used gcc compiler for c and used clang for c++. When I unified them, the error was solved. Thanks so much !

1 Like