casadi / casadi

CasADi is a symbolic framework for numeric optimization implementing automatic differentiation in forward and reverse modes on sparse matrix-valued computational graphs. It supports self-contained C-code generation and interfaces state-of-the-art codes such as SUNDIALS, IPOPT etc. It can be used from C++, Python or Matlab/Octave.
http://casadi.org
GNU Lesser General Public License v3.0
1.63k stars 365 forks source link

Problem linking IPOPT to casadi #3496

Open jcrismer opened 7 months ago

jcrismer commented 7 months ago

Hello,

When doing :

cmake -DWITH_PYTHON=ON -DWITH_PYTHON3=ON -DWITH_IPOPT=ON -DWITH_HSL=ON -DWITH_HSL:BOOL=ON -DWITH_THREAD=ON -DCMAKE_INSTALL_PREFIX:PATH=/gpfs/home/acad/ucl-tfl/jcrismer/.local/ -DWITH_OPENMP=ON -DIPOPT_LIBRARIES=/gpfs/home/acad/ucl-tfl/jcrismer/.local/lib/ -DIPOPT_INCLUDEDIR=/gpfs/home/acad/ucl-tfl/jcrismer/.local/include/coin-or ..

I also tried

cmake -DWITH_PYTHON=ON -DWITH_PYTHON3=ON -DWITH_IPOPT=ON -DWITH_HSL=ON -DWITH_HSL:BOOL=ON -DWITH_THREAD=ON -DCMAKE_INSTALL_PREFIX:PATH=/gpfs/home/acad/ucl-tfl/jcrismer/.local/ -DWITH_OPENMP=ON -DIPOPT_LIBRARIES=/gpfs/home/acad/ucl-tfl/jcrismer/.local/lib/ -DIPOPT_INCLUDEDIR=/gpfs/home/acad/ucl-tfl/jcrismer/.local/include ..

It displays:

-- The following features have been enabled:

-- The following OPTIONAL packages have been found:

-- The following REQUIRED packages have been found:

-- The following features have been disabled:

-- The following OPTIONAL packages have not been found:

I do not understand why it says it find "IPOPT" and not "Ipopt" ... The machine is running on Red Hat Enterprise Linux 8.6 (Ootpa). My casadi version is 3.5.5. My Ipopt version is 3.14 . I compiled ipopt from source, with the HSL third party dependencies in order to use the ma57 solver. Then when doing "make" it fails shortly before the end, due to IPOPT related stuff:

[100%] Linking CXX executable ../../../bin/rocket_single_shooting cd /gpfs/home/acad/ucl-tfl/jcrismer/.local/casadi/build/docs/examples/cplusplus && /gpfs/softs/easybuild/software/CMake/3.23.1/bin/cmake -E cmake_link_script CMakeFiles/rocket_single_shooting.dir/link.txt --verbose=1 /gpfs/softs/easybuild/software/GCCcore/11.3.0/bin/c++ -fopenmp -DWITH_OPENMP -pthread -fPIC -O3 -DNDEBUG -rdynamic CMakeFiles/rocket_single_shooting.dir/rocket_single_shooting.cpp.o -o ../../../bin/rocket_single_shooting -Wl,-rpath,/gpfs/home/acad/ucl-tfl/jcrismer/.local/casadi/build/lib ../../../lib/libcasadi_integrator_cvodes.so.3.6 ../../../lib/libcasadi_integrator_idas.so.3.6 ../../../lib/libcasadi_nlpsol_ipopt.so.3.6 ../../../lib/libcasadi_integrator_rk.so.3.6 ../../../lib/libcasadi_nlpsol_scpgen.so.3.6 ../../../lib/libcasadi_sundials_common.so.3.6 ../../../lib/libcasadi_sundials.a ../../../lib/libcasadi.so.3.6 -ldl /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference to Ipopt::TNLPAdapter::ResortBounds(Ipopt::Vector const&, double*, Ipopt::Vector const&, double*)' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference toIpopt::IpoptCalculatedQuantities::curr_d()' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference to vtable for Ipopt::RegisteredOptions' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference tovtable for Ipopt::RegisteredOption' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference to Ipopt::Journal::~Journal()' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference tovtable for Ipopt::StreamJournal' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference to Ipopt::TNLPAdapter::ResortX(Ipopt::Vector const&, double*, bool)' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference toIpopt::IpoptCalculatedQuantities::curr_c()' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference to Ipopt::IpoptApplication::IpoptApplication(bool, bool)' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference toIpopt::StreamJournal::SetOutputStream(std::ostream)' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference to Ipopt::StreamJournal::StreamJournal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ipopt::EJournalLevel)' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference toIpopt::TNLPAdapter::ResortG(Ipopt::Vector const&, Ipopt::Vector const&, double, bool)' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference to typeinfo for Ipopt::TNLPAdapter' /gpfs/softs/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: ../../../lib/libcasadi_nlpsol_ipopt.so.3.6: undefined reference totypeinfo for Ipopt::OrigIpoptNLP' collect2: error: ld returned 1 exit status make[2]: [docs/examples/cplusplus/CMakeFiles/rocket_single_shooting.dir/build.make:105: bin/rocket_single_shooting] Error 1 make[2]: Leaving directory '/gpfs/home/acad/ucl-tfl/jcrismer/.local/casadi/build' make[1]: [CMakeFiles/Makefile2:1763: docs/examples/cplusplus/CMakeFiles/rocket_single_shooting.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....

Thanks for your help !

jcrismer commented 7 months ago

Do you have any idea on how to solve this issue @jgillis ? Could it be a the Ipopt version ? I tried the last version of Ipopt I tried 3.14 as well as 3.13.0 .

PinyaColada commented 7 months ago

I have a similar problem and I used IPOPT 3.11