robotology / osqp-eigen

Simple Eigen-C++ wrapper for OSQP library
https://robotology.github.io/osqp-eigen/
BSD 3-Clause "New" or "Revised" License
395 stars 118 forks source link

when i add osqpeigen to my project i can't make it #103

Closed Czworldy closed 3 years ago

Czworldy commented 3 years ago

i meet undefined reference to `OsqpEigen::Solver::lu_solve()' collect2: error: ld returned 1 exit status in my project.

but when i try to make the MPCexample, it succeed and can solve correctly

S-Dafarra commented 3 years ago

Hi @Czworldy could you please add some details on how to reproduce your problem? The error is also interesting since we have no method called lu_solve() in the Solver class. Did you edit the code?

Czworldy commented 3 years ago

Hi @Czworldy could you please add some details on how to reproduce your problem? The error is also interesting since we have no method called lu_solve() in the Solver class. Did you edit the code?

Hi, @S-Dafarra thanks, i find that lu_solve() is a method in another QP Sovler Quadprog++ , which i also used in my project,.Quadprog++ has this one in its codes: #define solve lu_solve so when i use OsqpEigen::Sovler.solve() the complier come to find OsqpEigen::Sovler.lu_solve() and it makes mistake.

Czworldy commented 3 years ago

But i still have a question: when i build my project, i meet: /usr/bin/ld: cannot find -lEigen3::Eigen collect2: error: ld returned 1 exit status but the eigen has been installed corrently. what does this mean? by the way, if i remove OsqpEigen from my project, it works well but as long as i add it, it gives me that information.

Czworldy commented 3 years ago

full message: [ 98%] Linking CXX executable /home/yjy/catkin_ws/devel/lib/jy_control_test/test_model /usr/bin/ld: cannot find -lEigen3::Eigen collect2: error: ld returned 1 exit status Jueying_description/jy_control_test/CMakeFiles/test_model.dir/build.make:143: recipe for target '/home/yjy/catkin_ws/devel/lib/jy_control_test/test_model' failed make[2]: [/home/yjy/catkin_ws/devel/lib/jy_control_test/test_model] Error 1 CMakeFiles/Makefile2:6620: recipe for target 'Jueying_description/jy_control_test/CMakeFiles/test_model.dir/all' failed make[1]: [Jueying_description/jy_control_test/CMakeFiles/test_model.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....

Czworldy commented 3 years ago

and i try eigen 3.3.8 and 3.3.9

S-Dafarra commented 3 years ago

Hi @Czworldy could you please add some details on how to reproduce your problem? The error is also interesting since we have no method called lu_solve() in the Solver class. Did you edit the code?

Hi, @S-Dafarra thanks, i find that lu_solve() is a method in another QP Sovler Quadprog++ , which i also used in my project,.Quadprog++ has this one in its codes: #define solve lu_solve so when i use OsqpEigen::Sovler.solve() the complier come to find OsqpEigen::Sovler.lu_solve() and it makes mistake.

That's definitely the problem, nice catch.

Regarding

But i still have a question: when i build my project, i meet: /usr/bin/ld: cannot find -lEigen3::Eigen collect2: error: ld returned 1 exit status but the eigen has been installed corrently. what does this mean? by the way, if i remove OsqpEigen from my project, it works well but as long as i add it, it gives me that information.

if you managed to compile correctly OsqpEigen, then it means that it was able to find it correctly (i.e. you have installed it correctly). When importing OsqpEigen in your project, it also tells CMake to look for the Eigen3::Eigen target. This target should be defined, see https://eigen.tuxfamily.org/dox/TopicCMakeGuide.html. If not, it probably means that you have a custom FindEigen3.cmake file in your project (or dependencies) that is setting the Eigen3_FOUND variable, but it is not properly defining the Eigen3 targets.

Czworldy commented 3 years ago

Hi @S-Dafarra thanks a lot https://stackoverflow.com/questions/53991812/cmake-find-package-not-working-for-eigen this is what i need.