wjakob / tbb

Intel TBB with CMake build system
Apache License 2.0
369 stars 161 forks source link

Build error on MacOS High Sierra #43

Closed MichaelVoelkel closed 7 years ago

MichaelVoelkel commented 7 years ago

Hello,

I have just downloaded the latest version of your repository as of this date.

I use MacOS High Sierra.

Trying to build via mkdir myBuild && cd myBuild && cmake .. && cmake --build . starting from the base directory of the clone results in the following errors:

...
[ 13%] Building CXX object CMakeFiles/tbb.dir/src/tbb/x86_rtm_rw_mutex.cpp.o
/var/folders/yj/hykmq2ld6mq1kdq65z_127980000gn/T//cc5PxoLP.s:13:no such instruction: `xend'
:124:no such instruction: `xbegin L38'
:68:no such instruction: `xabort $255'
:147:no such instruction: `xbegin L59'
:72:no such instruction: `xabort $255'
:192:no such instruction: `xend'
:204:no such instruction: `xbegin L147'
:82:no such instruction: `xabort $255'
:105:no such instruction: `xbegin L173'
:112:no such instruction: `xbegin L176'
:119:no such instruction: `xbegin L177'
:128:no such instruction: `xbegin L178'
:135:no such instruction: `xbegin L179'
:142:no such instruction: `xbegin L180'
:149:no such instruction: `xbegin L181'
:156:no such instruction: `xbegin L182'
:165:no such instruction: `xbegin L183'
:172:no such instruction: `xbegin L184'
:180:no such instruction: `xabort $255'
make[2]: *** [CMakeFiles/tbb.dir/src/tbb/x86_rtm_rw_mutex.cpp.o] Error 1
make[1]: *** [CMakeFiles/tbb.dir/all] Error 2
make: *** [all] Error 2

By the way, I get the message before that libc++ is used, which is also what I wish for. My standard compiler is G++7.2 the XCode-standard compiler clang (the MacOS-customized Apple clang, of course)...

Any idea?

Thank you!

MichaelVoelkel commented 7 years ago

Hi again,

I figured that G++ 7.2 installed via MacPorts has this issue... When I change the generator to XCode9 with MacOS' clang compiler, I get a working build. For me, this issue is fine, then. Might still be useful to know how to get G++ to work here for others.

wjakob commented 7 years ago

The issue here seems to be that your compiler generates instructions for the transactional memory extension. GCC then calls the system assembler (from Clang), which rejects those instructions. I had a similar issue with AVX512 a while ago, and it turned out that GCC does not forward the appropriate instruction set parameters to the assembler (i.e. -mrtm in your case). It's a GCC issue and unrelated to TBB, other than the fact that it uses an instruction set extension.