Building OpenCV without SSE2 and Neon

asked 2020-10-09 19:45:27 -0600

Jeremy Intan gravatar image

Hi, is it possible to run OpenCV without SSE2 and NEON enabled? I tried adding the "-D<cv_sse2>=0 -D<cv_neon>=0" flag which should disable SSE2 and NEON, but it failed to build saying that some of the files can't find SSE2. I'm guessing some people should have been able to build OpenCV without either since there's architectures without SSE2 and NEON? Thanks

edit retag flag offensive close merge delete


There should be nothing to do.

It will automatically detect the CPU and add the supported flags.

Which CPU/architecture are you using? BTW, OpenCV already supports many ISA: x86/x86-64, ARM/ARM-64, PowerPC, etc.

Eduardo gravatar imageEduardo ( 2020-10-11 06:22:51 -0600 )edit

I'm building/compiling in X86. I'm trying to compile it to a generic architecture - is there no fallback (as in you have to "specify" the architecture you're building to)?

Jeremy Intan gravatar imageJeremy Intan ( 2020-10-11 17:59:53 -0600 )edit

Which CPU model are you targeting?

Are you sure your CPU does not support even SSE2? Have a look at this page: CPU optimizations build options. If your CPU supports SSE2, you can use something like CPU_BASELINE=SSE2 and higher level of SIMD instructions will be automatically dispatched. So they will be only executed if the CPU supports these instructions.

Eduardo gravatar imageEduardo ( 2020-10-12 04:47:47 -0600 )edit

In any case, the CPU optimizations build options page contains information about how to disable optimizations.

Eduardo gravatar imageEduardo ( 2020-10-12 11:29:58 -0600 )edit

Thanks for the info. I'm trying to look for a generic fallback since it will be used for different accelerators. I'm trying to compile it down to an IR and let the IR choose the optimizations instead of OpenCV.

Jeremy Intan gravatar imageJeremy Intan ( 2020-10-12 16:28:02 -0600 )edit