loco-3d / crocoddyl

Crocoddyl is an optimal control library for robot control under contact sequence. Its solver is based on various efficient Differential Dynamic Programming (DDP)-like algorithms
BSD 3-Clause "New" or "Revised" License
859 stars 174 forks source link

CMake couldn't find OpenMp #1231

Closed JianghanZHang closed 2 months ago

JianghanZHang commented 8 months ago

Bug description

Hello,

I encountered the following error when trying to build and install crocoddyl with multi-threading from source in a Conda environment.

After running cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_MULTITHREADS=ON I got: CMake Error at cmake/find-external/OpenMP/FindOpenMP.cmake:222 (try_compile): Failed to configure test project build system. Call Stack (most recent call first): cmake/find-external/OpenMP/FindOpenMP.cmake:549 (_openmp_get_flags) CMakeLists.txt:165 (find_package)

Reproduction steps

Upon creating a new Conda environment and activate

conda install python==3.10

conda install cmake==3.23 pkg-config colcon-common-extensions -c conda-forge

conda install catkin_pkg empy lark -c conda-forge

conda install ncurses -c conda-forge

conda install websockets

conda install matplotlib

conda install -c conda-forge robot_descriptions

pip install pybullet

conda install pinocchio

conda install conda-forge::libgomp

conda install conda-forge::example-robot-data

conda install conda-forge::gcc

conda install conda-forge::gxx

System

It appears to me that CMake somehow couldn't find the installed OpenMp, but I have no clue how to fix it - even if I manually set CMAKE_MODULE_PATH, CMAKE_C_COMPILER, CMAKE_CPP_COMPILER, cmake still unable to find the OpenMp.

I appreciate your help. Thanks!

cmastalli commented 8 months ago

Hi @JianghanZHang

The issue appears when installing cmake v3.23. Please do:

conda remove cmake==3.23
conda install cmake

@nim65s is this expected to have a broken compilation with cmake v3.23?

nim65s commented 8 months ago

In my tests, this works for CMake 3.14 to 3.18, is broken from 3.20 to 3.25, and works again since 3.26. It is not expected, but I don't think it is worth fixing.

cmastalli commented 8 months ago

Should this issue moved to https://github.com/jrl-umi3218/jrl-cmakemodules/tree/59a8466a1143e2719b598b55d92a09d653628959?