Skip to content

OpenMP not supported on macOS and Windows

Description

When compiling with OpenMP, there are various compilation errors on macOS, Windows and even on Linux

On macOS, the FindOpenMP.cmake module doesn't find any valid compile flag. When I set -fopenmp, I got messages like:

clang: warning: argument unused during compilation: '-fopenmp'
/Users/otbval/Dashboard/nightly/OTB-Release/src/Modules/Remote/DiapOTBModule/include/otbSARInterferogramImageFilter.txx:36:10: fatal error: 'omp.h' file not found

On Windows, there is a problem with SampleAugmentation filters (more information here )

modules\learning\sampling\include\otbSampleAugmentation.h(57): error C3016: 'j': index variable in OpenMP 'for' statement must have signed integral type

On Linux, I had a linking error with module DiapOTBModule, not finding the symbols omp_get_thread_num and omp_set_num_threads. After a quick check, the OpenMP_EXE_LINKER_FLAGS is never filled by FindOpenMP.

Steps to reproduce

Configure CMake with OTB_USE_OPENMP=ON then build.

Configuration information

OTB 6.6 and later OS: macOS, Win, Linux