Cannot compile OpenCV 2.4.9 + CUDA 6 with clang on Mac OSX 10.9, SSE2 errors (Bug #3831)


Added by Alexander Bock over 10 years ago. Updated over 9 years ago.


Status:Open Start date:2014-07-27
Priority:Normal Due date:
Assignee:Roman Donchenko % Done:

0%

Category:build/install
Target version:-
Affected version:2.4.9 (latest release) Operating System:Mac OSX
Difficulty: HW Platform:x64
Pull request:

Description

I am trying to compile OpenCV 2.4.9 and CUDA 6 with clang 5.1 on Mac OSX 10.9 64-bit, but I keep getting the following error:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/include/emmintrin.h(1225): error: identifier "__builtin_ia32_movnti64" is undefined

I've tracked the issue down to the files opencv2/core/internal.hpp and opencv2/core/types_c.h where SSE support is checked. I looked at the emmintrin.h file as well, and apparently __builtin_ia32_movnti64 is defined on 64-bit platforms (__x86_64__). I tried adding the -msse2 option to my CMakeLists.txt clang++ compiler flags, but without any luck. I managed to make it work by undefining __SSE2__ before it was used in opencv2/core/internal.hpp and opencv2/core/types_c.h, but that's a temporary hack at best. Just to be sure, I ran file libopencv_* on a couple of the OpenCV libraries (installed using Homebrew) to ensure they were compiled as 64-bit shared libraries. I can also resolve the issue by not adding STL headers in my Utils.cu file.

Additionally, and if relevant, I was previously getting tons of "identifier undefined" errors such as _Atomic, __c11_atomic_fetch_add and boost type_traits (see the attached file), but was able to resolve them by patching the opencv2/core/operations.hpp according to this resolved issue (cvdef.h is not found on my system).

Is this an issue related to OpenCV? I cannot really tell, but after some extensive internet research and searching this issue page, I concluded this issue did not exist, or at least nobody has posted a solution. I included my CMakeLists.txt as well.


CMakeLists.txt (1.5 kB) Alexander Bock, 2014-07-27 10:50 am

opencv_issue.txt (12.8 kB) Alexander Bock, 2014-07-27 10:50 am


Related issues

related to Bug #3911: Cannot use OpenCV 2.4.9 in a CUDA 6 project with nvcc com... Done 2014-07-27

Associated revisions

Revision a1f86d01
Added by Vadim Pisarevsky almost 10 years ago

Merge pull request #3831 from Dmitry-Me:reduceVariableScope7

History

Updated by Dmitry Retinskiy over 10 years ago

Roman, could you check this?
Thanks.

  • Status changed from New to Open
  • Category set to build/install
  • Assignee set to Roman Donchenko

Updated by Stefano Fabri over 10 years ago

We have got the same error here:

https://github.com/BVLC/caffe/pull/1068

Updated by Stefano Fabri over 10 years ago

__builtin_ia32_movnti64 is introduced in clang 3.4 what version are you using?

Updated by Stefano Fabri over 10 years ago

Anybody can try wtih clang, libsdtc++ 4.8 and cuda 6.5?

Updated by Adrian Haarbach over 10 years ago

this small fix

https://github.com/bhack/opencv/commit/32f6e1a554dea1849ee3a53fea171cbd5969ef41

(related to the link above and which got integrated into 2.4.10) about 10 days ago works for me with the following configuration:

clang --version
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix


clang -dumpversion
4.2.1

I have /usr/lib/libstdc++.6.0.9.dylib installed, so according to https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
  • GCC 4.2.0: libstdc++.so.6.0.9
  • GCC 4.2.1: libstdc++.so.6.0.9 (See Note 3)
  • GCC 4.2.2: libstdc++.so.6.0.9

version 4.2.1 of libstdc++is used in my case.


nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2014 NVIDIA Corporation
Built on Thu_Jul_17_19:13:24_CDT_2014
Cuda compilation tools, release 6.5, V6.5.12

Updated by Maksim Shabunin over 9 years ago

Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4797

Also available in: Atom PDF