Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Harry_W_1
Beginner
93 Views

Compile failed with clang on Linux

I cannot use tbb well on Linux when comes to LLVM/Clang. The problem I found is that, because I use clang with libstdc++ not libc++.

In this file 'tbb_config.h L164':

#define __TBB_CPP11_RVALUE_REF_PRESENT  (__has_feature(__cxx_ravlue_references__) && (__TBB_GCC_VERSION >= 40300 || _LIBCPP_VERSION))

I use clang 3.7.1, the __TBB_GCC_VERSION will give 40201, and __LIBCPP_VERSION is not defined, because I'm not using libc++. So this define is not valid, then cause compile failed.

0 Kudos
3 Replies
RafSchietekat
Black Belt
93 Views

Did you see a compilation failure during "make all", and where, or only when you try to use rvalue references with TBB in your own code?

Does the problem go away if you change this to "#define __TBB_CPP11_RVALUE_REF_PRESENT 1"?

I don't know why __TBB_GCC_VERSION is being used here, because it always seems to be 40201 with Clang (well, I found one other mention of that somewhere). The macro to detect the version of libstdc++ seems to be __GLIBCXX__. I suggest you try to find some more information that might guide a revised configuration setting for TBB's use of rvalue references.

Harry_W_1
Beginner
93 Views

Raf Schietekat wrote:

Did you see a compilation failure during "make all", and where, or only when you try to use rvalue references with TBB in your own code?

Does the problem go away if you change this to "#define __TBB_CPP11_RVALUE_REF_PRESENT 1"?

I don't know why __TBB_GCC_VERSION is being used here, because it always seems to be 40201 with Clang (well, I found one other mention of that somewhere). The macro to detect the version of libstdc++ seems to be __GLIBCXX__. I suggest you try to find some more information that might guide a revised configuration setting for TBB's use of rvalue references.

Hi, I don't compile TBB directly, but use it in my client code. I've use cache_aligned_allocator, but compile failed when it comes to construct method. Then I find that macro is not suit well.

In the tbb_config.h file, in the #if __clang__ section, I see some macros is checking _LIBCPP_VERSION (like __TBB_EXCEPTION_PTR_PRESEND and __TBB_CPP11_STD_BEGIN_END_PRESENT), while only __TBB_CPP11_RVALUE_REF_PRESENT checks both __GLIBCXX__ and __LIBCPP_VERSION. It's weird. All the methods related to those macros may not behave well when it comes to clang with libstdc++. I think the developer don't take the situation when someone use clang with libstdc++ in to account. It should not only check the _LIBCPP_VERSION when comes to clang.

What I have done to resolve this is to define _LIBCPP_VERSION macro and then it comes to be compiled well.

RafSchietekat
Black Belt
93 Views

Thanks for providing that information. Now let's hope somebody acts on it.

Reply