← All tasks
cppopenMVG/openMVG #2393Not a task: already works

Installed OpenMVG libraries expect OpenMP when not actually found

envgap__openMVG__openMVG-2393

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
4e78ed73a575beae88199fc440183a75e03068c5
Manifest
src/CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

openMVG/openMVG #2393 · read the original issue
I was trying to use the installed libraries in my own CMake project, but hit an issue where `find_package(OpenMVG REQUIRED)` was failing because OpenMP couldn't be found. I thought this was curious, because my OpenMVG install output explicitly stated it couldn't find OpenMP:

```
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) 
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) 
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND) 
```

Looking closer at the CMake output, though, I noticed it later reported that it was still expecting for OpenMP to be enabled:
```
** OpenMVG version: 2.1.0
** Build Shared libs: OFF
** Build OpenMVG tests: OFF
** Build OpenMVG softwares: ON
** Build OpenMVG GUI softwares: OFF
** Build OpenMVG documentation: OFF
** Build OpenMVG samples applications: OFF
** Build OpenMVG openGL examples: OFF
** Enable code coverage generation: OFF
** Enable OpenMP parallelization: ON
** Build OpenCV+OpenMVG samples programs: OFF
** Use OpenCV SIFT features: OFF
** Use LiGT for global translation estimation: ON
```

I suspect that the issue is that this block in OpenMVG's `CMakeLists.txt` isn't actually updating the `OpenMVG_USE_OPENMP` cache variable:
https://github.com/openMVG/openMVG/blob/4e78ed73a575beae88199fc440183a75e03068c5/src/CMakeLists.txt#L182-L187

And subsequently the exported CMake module is incorrectly still looking for OpenMP here:
https://github.com/openMVG/openMVG/blob/4e78ed73a575beae88199fc440183a75e03068c5/src/cmakeFindModules/OpenMVGConfig.cmake.in#L87-L93

I can hack around this by patching `OpenMVGConfig.cmake.in` to use the `OpenMP_FOUND` variable instead:
```cmake
set(OpenMVG_USE_OPENMP "@OpenMP_FOUND@")
```

The latter fix seems simpler, but I'm not sure if it's appropriate given the rest of the configuration system.

For posterity, I'm running on macOS 15.3 on an M3 Max MBP.
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]