Closed yurivict closed 4 years ago
Thanks for the report!
I am a bit confused, because invoking find_package(pagmo)
should invoke the FindNLOPT.cmake
script, which in turn defines the NLOPT::header
target. For instance, when we compile pygmo
(which invokes find_package(pagmo)
), we don't have any issues.
Could the problem be some naming collisions here:
Here find_package(pagmo)
will define some NLOPT-related targets/variables, but then DART's own machinery for detecting NLOPT is also invoked. Perhaps they are clashing?
I am a bit confused, because invoking find_package(pagmo) should invoke the FindNLOPT.cmake script
I think this might not happen when the dependent project has its own FindNLOPT.cmake? This is because they would both define variables with the same names.
I think this might not happen when the dependent project has its own FindNLOPT.cmake? This is because they would both define variables with the same names.
Ahh right, probably the FindNLOPT.cmake
from Dart takes the precedence over pagmo's own FindNLOPT.cmake
due to the way the CMake moduie path is set up.
In other projects I have renamed the FindFoo.cmake
files to FindBarFoo.cmake
, where Bar
is the name of the project. This way further namespacing is introduced which helps avoiding clashes if Bar
is a dependency in a project that also needs Foo
.
I'll make sure to implement the same approach for pagmo 2.16, which should solve this issue I think.
There is now a PR up at #451 in which:
pagmo::
(e.g., pagmo::IPOPT::header
), in order to prevent name clashing,@Bidski @jslee02 perhaps libdart/dartsim should also start using the CMake targets provided by the NLopt installation?
@yurivict I will go ahead and close this for the time being, please re-open or open a new report in case of issues with pagmo 2.16.
@bluescarni still having trouble with this issue with pagmo 2.16, here is my output when installing dartsim
:
-- Found Boost: /usr/lib64/cmake/Boost-1.72.0/BoostConfig.cmake (found suitable version "1.72.0", minimum required is "1.60.0") found components: serialization
-- Detected Boost version: 1.72.0
-- Boost include dirs: /usr/include
-- Requested IPOPT components: header
CMake Error at /usr/lib64/cmake/pagmo/Findpagmo_IPOPT.cmake:9 (message):
'header' is not a valid component for IPOPT.
Call Stack (most recent call first):
/usr/lib64/cmake/pagmo/pagmo-config.cmake:13 (find_package)
cmake/DARTFindpagmo.cmake:9 (find_package)
cmake/DARTMacros.cmake:81 (include)
dart/optimizer/pagmo/CMakeLists.txt:2 (dart_find_package)
-- Configuring incomplete, errors occurred!
See also "/home/acxz/.cache/yay/libdart/src/dart-6.9.4/build/CMakeFiles/CMakeOutput.log".
@acxz thanks for the report, this looks puzzling.
Can you please post the content of /usr/lib64/cmake/pagmo/Findpagmo_IPOPT.cmake
and /usr/lib64/cmake/pagmo/pagmo-config.cmake
?
@acxz
Can you try to change, in Findpagmo_IPOPT.cmake
,
foreach(_pagmo_IPOPT_CUR_COMPONENT ${pagmo_IPOPT_FIND_COMPONENTS})
if(NOT ${_pagmo_IPOPT_CUR_COMPONENT} IN_LIST _pagmo_IPOPT_ALLOWED_COMPONENTS)
message(FATAL_ERROR "'${_pagmo_IPOPT_CUR_COMPONENT}' is not a valid component for IPOPT.")
endif()
endforeach()
to
foreach(_pagmo_IPOPT_CUR_COMPONENT ${pagmo_IPOPT_FIND_COMPONENTS})
message(STATUS "DEBUG cur component: ${_pagmo_IPOPT_CUR_COMPONENT}")
message(STATUS "DEBUG component list: ${_pagmo_IPOPT_ALLOWED_COMPONENTS}")
if(NOT ${_pagmo_IPOPT_CUR_COMPONENT} IN_LIST _pagmo_IPOPT_ALLOWED_COMPONENTS)
message(FATAL_ERROR "'${_pagmo_IPOPT_CUR_COMPONENT}' is not a valid component for IPOPT.")
endif()
endforeach()
and report the output?
Sure:
-- Requested IPOPT components: header
-- DEBUG cur component: header
-- DEBUG component list: header;libipopt
CMake Error at /usr/lib64/cmake/pagmo/Findpagmo_IPOPT.cmake:11 (message):
'header' is not a valid component for IPOPT.
Call Stack (most recent call first):
/usr/lib64/cmake/pagmo/pagmo-config.cmake:13 (find_package)
cmake/DARTFindpagmo.cmake:9 (find_package)
cmake/DARTMacros.cmake:81 (include)
dart/optimizer/pagmo/CMakeLists.txt:2 (dart_find_package)
@bluescarni Changing
foreach(_pagmo_IPOPT_CUR_COMPONENT ${pagmo_IPOPT_FIND_COMPONENTS})
if(NOT ${_pagmo_IPOPT_CUR_COMPONENT} IN_LIST _pagmo_IPOPT_ALLOWED_COMPONENTS)
message(FATAL_ERROR "'${_pagmo_IPOPT_CUR_COMPONENT}' is not a valid component for IPOPT.")
endif()
endforeach()
to
foreach(_pagmo_IPOPT_CUR_COMPONENT ${pagmo_IPOPT_FIND_COMPONENTS})
if(NOT "${_pagmo_IPOPT_CUR_COMPONENT}" IN_LIST _pagmo_IPOPT_ALLOWED_COMPONENTS)
message(FATAL_ERROR "'${_pagmo_IPOPT_CUR_COMPONENT}' is not a valid component for IPOPT.")
endif()
endforeach()
seems to resolve this error
@Bidski nice find do you want to make a PR for this?
@Bidski thanks for the PR, I just merged it.
Installed cmake scripts:
only contain the definition of
NLOPT::header
in your privateFindNLOPT.cmake
that isn't called by dependent packages, yet you export this target to dependent packages throughpagmo_export.cmake
.Same with
IPOPT::header
.This breaks DART: https://github.com/dartsim/dart/issues/1473