Nvcc Compilation Problem with OpenCV Code

We recently installed the master OpenCV branch on our TX2. When we try to compile the following “test.cu” file

#include <opencv2/core.hpp>
const int m = 32;

with the command

nvcc --std=c++11 -c -o test.d  test.cu

following errors occur:

/usr/lib/gcc/aarch64-linux-gnu/5/include/arm_neon.h(38): error: identifier "__Int8x8_t" is undefined

/usr/lib/gcc/aarch64-linux-gnu/5/include/arm_neon.h(39): error: identifier "__Int16x4_t" is undefined

/usr/lib/gcc/aarch64-linux-gnu/5/include/arm_neon.h(40): error: identifier "__Int32x2_t" is undefined

...

I encountered postings with the same errors for TX1, but they didn’t seem to have useful responses. We are not having this problem on TX1 platform. Another interesting thing is that same file compiles when it is renamed to “test.cpp” and compiled with the following command:

nvcc --std=c++11 -c -o test.o  test.cpp

Any help is appreciated.

One possible explanation, but I’m not sure of this, would be that gcc that is used for cpp files uses /usr/include as a default standard path, while nvcc that handles .cu files doesn’t. As opencv4tegra is installed in /usr, its include files are found by gcc but not by nvcc.
You also mentioned master branch (3.2?), but it is unclear…Have you installed it in /usr in place of opencv4tegra ?

Moreover, you may add some options for saying to nvcc which architecture you are targeting. For TX2, CUDA arch is 6.2.
Could you try to compile with:

nvcc --std=c++11 -m64 -gencode arch=compute_62,code=sm_62 -I/usr/include -c test.cu -o test.d

This works on my TX2 with R27.0 (with another path to opencv includes).

Re-reading it, it might also be a toolchain issue. Which L4T release are you using ?

head -1 /etc/nv_tegra_release

Are you native or cross-compiling ?

Which nvcc and gcc do you have ?

nvcc --version
gcc --version

Hi,

Please turn off Neon options when you compile opencv.
More details can be found in this topic:
https://devtalk.nvidia.com/default/topic/1005112/compiling-ssd-single-shot-detection-on-jetson-tx1/

Thanks.

Unfortunately, this didn’t work. Instead, I removed OpenCV dependencies completely from .cu files. This way, we were able to compile them, .cpp files with OpenCV was built anyway with gcc.