Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problems compiling this library #140

Closed
marvin-ad-martianum opened this issue Jul 19, 2023 · 4 comments
Closed

problems compiling this library #140

marvin-ad-martianum opened this issue Jul 19, 2023 · 4 comments

Comments

@marvin-ad-martianum
Copy link

osqp is a great library and i would love to use it. however, i canot build the osqp-eigen library. osqp is installed on an ubuntu 16. i get the follwoing output trying to build

any help would be appreciated.

marvin@X1-Y-4:/Code/osqp-eigen/build$ cmake .
osqp found: 1
osqp include directories:
osqp libraries:
-- osqp library path: /usr/local/lib/libosqp.so
-- osqp include path: /usr/local/include/osqp
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/marvin/Code/osqp-eigen/build
marvin@X1-Y-4:
/Code/osqp-eigen/build$ make
[ 20%] Building CXX object CMakeFiles/OsqpEigen.dir/src/Data.cpp.o
In file included from /home/marvin/Code/osqp-eigen/include/OsqpEigen/Data.hpp:18,
from /home/marvin/Code/osqp-eigen/src/Data.cpp:12:
/home/marvin/Code/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.hpp:43:37: error: ‘csc’ has not been declared
43 | csc*& osqpSparseMatrix);
| ^~~
/home/marvin/Code/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.hpp:52:56: error: ‘csc’ does not name a type
52 | bool osqpSparseMatrixToEigenSparseMatrix(const csc* const & osqpSparseMatrix,
| ^~~
/home/marvin/Code/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.hpp:62:47: error: ‘csc’ does not name a type
62 | bool osqpSparseMatrixToTriplets(const csc* const & osqpSparseMatrix,
| ^~~
In file included from /home/marvin/Code/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.hpp:77,
from /home/marvin/Code/osqp-eigen/include/OsqpEigen/Data.hpp:18,
from /home/marvin/Code/osqp-eigen/src/Data.cpp:12:
/home/marvin/Code/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.tpp:12:62: error: ‘csc’ has not been declared
12 | csc*& osqpSparseMatrix)
| ^~~
In file included from /home/marvin/Code/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.hpp:77,
from /home/marvin/Code/osqp-eigen/include/OsqpEigen/Data.hpp:18,
from /home/marvin/Code/osqp-eigen/src/Data.cpp:12:
/home/marvin/Code/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.tpp: In function ‘bool OsqpEigen::SparseMatrixHelper::createOsqpSparseMatrix(const Eigen::SparseCompressedBase&, int*&)’:
/home/marvin/Code/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.tpp:18:5: error: ‘c_int’ was not declared in this scope; did you mean ‘u_int’?
18 | c_int rows = colMajorCopy.rows();
| ^~~~~
| u_int
.....

@Yilgrimage
Copy link

Yilgrimage commented Jul 20, 2023

Hahaha,I had this problem too and then realized no one was answering you, but luckily I just solved it! it seems like you didn't set correct lib link when you compiling.
/usr/bin/g++ -fdiagnostics-color=always -g /home/yilgrimage/work/other/mpc.cpp -o /home/yilgrimage/work/other/mpc -L /usr/local/lib/ -lOsqpEigen -L /usr/lib/x86_64-linux-gnu/ -losqp
"-L" means the path to your lib file, and "-lxxx" means lib file name.btw you should notice that libOsqpEigen relies on libosqp so you should add libosqp's path too,

@marvin-ad-martianum
Copy link
Author

yea. thank you. it is quite ugly but i had to solve it this way. because osqp and osqp-eigen are not detected by automatic reading. no idea why.

target_link_libraries(controller_test_mpc
${catkin_LIBRARIES}
${eigen3}
${osqp}
/usr/local/lib/libOsqpEigen.so
/usr/local/lib/libosqp.so
)

@traversaro
Copy link
Member

Hello @marvin-ad-martianum and @Yilgrimage , see:

TL;DR: Now osqp default branch points to the unreleased 1.0.0 version, while osqp-eigen default branch is only compatible with osqp <= 0.6.3 at the moment. If you install osqp 0.6.3 (the latest stable release) everything should work.

@GiulioRomualdi
Copy link
Member

GiulioRomualdi commented Aug 1, 2023

Since #131 got merged, master is now compatible with osqp master.

Closing for the time being, in case of issue feel free to open it again 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants