ami-iit / ami-commons

In this repository we store tools and utilities shared between our repositories.
10 stars 1 forks source link

Optional package IPOPT not found problem on Casadi CMAKE #25

Closed Ginkbel closed 3 months ago

Ginkbel commented 3 months ago

Hello, I've followed every step along the way (including exporting the environment variables and adding them to .bashrc), but when invoking:

cmake -DWITH_IPOPT:BOOL=ON -DWITH_HSL:BOOL=ON -DINCLUDE_PREFIX:PATH=include -DCMAKE_PREFIX:PATH=lib/cmake/casadi -DLIB_PREFIX:PATH=lib -DBIN_PREFIX:PATH=bin ..

I've got Ipopt not found in the terminal output:

ginko@aero15:~/robot-code/casadi/build$ cmake -DWITH_IPOPT:BOOL=ON -DWITH_HSL:BOOL=ON -DINCLUDE_PREFIX:PATH=include -DCMAKE_PREFIX:PATH=lib/cmake/casadi -DLIB_PREFIX:PATH=lib -DBIN_PREFIX:PATH=bin .. -- The C compiler identification is GNU 11.4.0 -- The CXX compiler identification is GNU 11.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- The Fortran compiler identification is GNU 11.4.0 -- Detecting Fortran compiler ABI info -- Detecting Fortran compiler ABI info - done -- Check for working Fortran compiler: /usr/bin/gfortran - skipped -- No flag needed for enabling C++11 features. EXTERNAL_CMAKE_COMMAND: /usr/bin/cmake CXX /usr/bin/c++ FC /usr/bin/gfortran CC /usr/bin/cc -- x86_64 architecture detected - setting flag -fPIC HSL: find via CONFIG -- Could NOT find HSL (missing: HSL_DIR) HSL: 0 -- Found HSL: /home/ginko/robot-code/CoinIpopt/install/lib/libhsl.so -- Found HSL:
debug HSL_FOUND -- Could NOT find Ipopt (missing: Ipopt_DIR) -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") -- Checking for one of the modules 'ipopt' -- Found IPOPT: ipopt
CMAKE_C_COMPILER_ID: GNU -- CMAKE_SYSTEM_NAME: Linux WITH_SPRAL OFF WITH_BUILD_SPRAL OFF -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success -- Performing Test COMPILER_HAS_DEPRECATED_ATTR -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success -- The following features have been enabled:

  • dynamic-loading, Support for import of FMI 2.0 binaries
    • sundials-interface, Interface to the ODE/DAE integrator suite SUNDIALS.
    • csparse-interface, Interface to the sparse direct linear solver CSparse.
    • tinyxml-interface, Interface to the XML parser TinyXML.
    • ipopt-interface, Interface to the NLP solver Ipopt.

-- The following OPTIONAL packages have been found:

  • PkgConfig
  • IPOPT
  • HSL

-- The following features have been disabled:

  • opencl-support, Enable just-in-time compiliation to CPUs and GPUs with OpenCL.

  • superscs-interface, Interface to QP solver SUPERSCS.

  • osqp-interface, Interface to QP solver OSQP.

  • dsdp-interface, Interface to the interior point SDP solver DSDP.

  • clang-interface, Interface to the Clang JIT compiler.

  • qpoases-interface, Interface to the active-set QP solver qpOASES.

  • blocksqp-interface, Interface to the NLP solver blockSQP.

  • cplex-interface, Interface to the QP solver CPLEX.

  • gurobi-interface, Interface to the (mixed-integer) QP solver GUROBI

  • knitro-interface, Interface to the NLP solver KNITRO.

  • snopt-interface, Interface to the NLP solver KNITRO.

  • worhp-interface, Interface to the NLP solver Worhp (requires gfortran, gomp).

  • lapack-interface, Interface to LAPACK.

  • mumps-interface, Interface to MUMPS.

  • spral-interface, Interface to SPRAL.

  • clp-interface, Interface to the LP solver CLP.

  • cbc-interface, Interface to the LP solver CBC.

  • bonmin-interface, Interface to the MINLP framework Bonmin.

  • highs-interface, Interface to the MILP / QP solver HiGHS.

  • daqp-interface, Interface to the MILP / QP solver HiGHS.

  • sleqp-interface, Interface to the NLP solver SLEQP.

  • alpaqa-interface, Interface to the NLP solver Alpaqa.

  • proxqp-interface, Interface to QP solver PROXQP.

  • ooqp-interface, Interface to the QP solver OOQP (requires BLAS and HSL libraries).

  • sqic-interface, Interface to the QP solver SQIC.

  • ampl-interface, Interface to the AMPL solver library.

  • slicot-interface, Interface to the controls library SLICOT. -- The following OPTIONAL packages have not been found:

  • Ipopt

-- Configuring done -- Generating done -- Build files have been written to: /home/ginko/robot-code/casadi/build

What can I do so Ipopt is found by cmake?

traversaro commented 3 months ago

Hello @Ginkbel !

Hello, I've followed every step along the way (including exporting the environment variables and adding them to .bashrc), but when invoking:

Which step? I am afraid I am missing a bit of context regarding your issue. To what steps are you referring to?

Ginkbel commented 3 months ago

Oh, sorry, the steps I'm referencing are these: https://github.com/ami-iit/ami-commons/blob/master/doc/casadi-ipopt-hsl.md (for getting Casadi+Ipopt+HSL installed). So I've followed 0.-15. exactly as it is stated, and then on step 16 when invoking cmake I get the error above.

Ginkbel commented 3 months ago

Sorry for bothering you, although it says Ipopt wasn't found Casadi seems to differentiate between Ipopt and IPOPT.

I've tried building and running code that uses the Casadi library and it works. Thank you very much for the installation instructions. :)

traversaro commented 3 months ago

Glad you found that instructions useful. Anyhow, it is not strictly necessary to recompile ipopt and casadi to actually use HSL solvers, just ensuring that libcoinhsl.so can be found by ipopt's dlopen, for example adding the library that contains it to LD_LIBRARY_PATH is sufficient. Probably we should add a disclaimer on top of that document. fyi @GiulioRomualdi