LLVM 3.9 openmp build failure on linux -- cannot find atomic

With Release 3.9, kmp_lock.h is now including under #ifdef __cplusplus. This wasn’t the case with Release 3.8.1. However, there are ‘.c’ files that are compiled as C++ files with ‘-x c++’ but they are not compiled with -stdlib=libc++. As a result, clang does not find and gives the following error:

… Building C object projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_error.c.o

:

:

In file included from /remote/vgsource7/riyaz/llvm/projects/openmp/runtime/src/kmp_error.c:16:

In file included from /remote/vgsource7/riyaz/llvm/projects/openmp/runtime/src/kmp.h:92:

/remote/vgsource7/riyaz/llvm/projects/openmp/runtime/src/kmp_lock.h:26:10: fatal error: ‘atomic’ file not found

#include

^

1 error generated.

Should LIBOMP_USE_STDCPPLIB be set to TRUE?

-Riyaz

Hi Riyaz,

I’m always building LLVM OpenMP runtime with latest LLVM and Clang (from git master) and I on every of my Linux machines I never had to set any additional flags. What system are you building it on?

Hi,

-stdlib=libc++ is needed if you wish to use libc++ on a Linux system that would otherwise require a recent version of libstdc++ from GCC.

The flag is currently passed in by the LLVM root build system but probably does not work because the .c files are compiled as C++.

Intel’s plan was to clean that up by the end of September which should fix the problem.

In the meantime, could you try to specify LIBOMP_CXXFLAGS which should inject the parameters to the right places?

Note: The runtime does not really use or link against libc++ nor libstdc++ but clang requires the flag to actually find the atomic header…

Cheers,

Jonas

Hi,

-stdlib=libc++ is needed if you wish to use libc++ on a Linux system that would otherwise require a recent version of libstdc++ from GCC.

The flag is currently passed in by the LLVM root build system but probably does not work because the .c files are compiled as C++.

Intel’s plan was to clean that up by the end of September which should fix the problem.

In the meantime, could you try to specify LIBOMP_CXXFLAGS which should inject the parameters to the right places?

Note: The runtime does not really use or link against libc++ nor libstdc++ but clang requires the flag to actually find the atomic header…

Cheers,

Jonas