Closed fvillml closed 2 years ago
Using
cmake -DG2O_USE_CSPARSE=OFF ..
works, what are the drawbacs of not using CSPARSE?
Using
cmake -DG2O_USE_CSPARSE=OFF ..
works, what are the drawbacs of not using CSPARSE?
Actually I need CSPARSE. I'm trying to compile teb_local_planner from source and it spawns an error if g2o compiled without CSPARSE
Are you trying to compile master?
Do you have /usr/include/suitesparse/cs.h as your include for csparse? Or some other cs.h in your include path?
Can you please execute
make VERBOSE=1 solver_csparse
The CI (https://github.com/RainerKuemmerle/g2o/blob/master/.github/workflows/ci.yml) runs on focal and I also have one laptop on focal without any issue.
Yes I'm trying to compile master.
I do have the header
$ ls /usr/include/suitesparse/cs.h
/usr/include/suitesparse/cs.h
Here the result with verbose
[ 28%] Building CXX object g2o/solvers/csparse/CMakeFiles/csparse_extension.dir/csparse_helper.cpp.o
cd /home/user/g2o/build/g2o/solvers/csparse && /usr/bin/c++ -DUNIX -Dcsparse_extension_EXPORTS -I/home/user/g2o -I/home/user/g2o/build -I/home/user/g2o/g2o/solvers/csparse -isystem /usr/include/eigen3 -Wall -W -O3 -DNDEBUG -O3 -fPIC -msse2 -msse3 -msse4.1 -msse4.2 -std=gnu++14 -o CMakeFiles/csparse_extension.dir/csparse_helper.cpp.o -c /home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp
In file included from /home/user/g2o/g2o/solvers/csparse/csparse_helper.h:30,
from /home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:27:
/home/user/g2o/g2o/solvers/csparse/csparse_extension.h:41:27: error: 'csn' does not name a type; did you mean 'csc'?
41 | G2O_CSPARSE_EXTENSION_API csn* cs_chol_workspace(const cs* A, const css* S,
| ^~~
| csc
/home/user/g2o/g2o/solvers/csparse/csparse_extension.h:43:52: error: 'cs' does not name a type; did you mean 'csc'?
43 | G2O_CSPARSE_EXTENSION_API int cs_cholsolsymb(const cs* A, number_t* b,
| ^~
| csc
/home/user/g2o/g2o/solvers/csparse/csparse_extension.h:44:52: error: 'css' does not name a type; did you mean 'csc'?
44 | const css* S, number_t* workspace,
| ^~~
| csc
In file included from /home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:27:
/home/user/g2o/g2o/solvers/csparse/csparse_helper.h:40:75: error: 'cs' does not name a type; did you mean 'csc'?
40 | G2O_CSPARSE_EXTENSION_API bool writeCs2Octave(const char* filename, const cs* A,
| ^~
| csc
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:36:49: error: 'cs' does not name a type; did you mean 'csc'?
36 | bool writeCs2Octave(const char* filename, const cs* A, bool upperTriangular) {
| ^~
| csc
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp: In function 'bool g2o::csparse_extension::writeCs2Octave(const char*, const int*, bool)':
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:37:17: error: request for member 'n' in '* A', which is of non-class type 'const int'
37 | int cols = A->n;
| ^
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:38:17: error: request for member 'm' in '* A', which is of non-class type 'const int'
38 | int rows = A->m;
| ^
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:40:10: error: request for member 'nz' in '* A', which is of non-class type 'const int'
40 | if (A->nz == -1) { // CCS matrix
| ^~
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:41:24: error: request for member 'p' in '* A', which is of non-class type 'const int'
41 | const int* Ap = A->p;
| ^
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:42:24: error: request for member 'i' in '* A', which is of non-class type 'const int'
42 | const int* Ai = A->i;
| ^
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:43:29: error: request for member 'x' in '* A', which is of non-class type 'const int'
43 | const number_t* Ax = A->x;
| ^
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:46:24: error: request for member 'p' in '* A', which is of non-class type 'const int'
46 | const int* Aj = A->p;
| ^
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:47:24: error: request for member 'i' in '* A', which is of non-class type 'const int'
47 | const int* Ai = A->i;
| ^
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:48:29: error: request for member 'x' in '* A', which is of non-class type 'const int'
48 | const number_t* Ax = A->x;
| ^
/home/user/g2o/g2o/solvers/csparse/csparse_helper.cpp:49:44: error: request for member 'nz' in '* A', which is of non-class type 'const int'
49 | return writeTripletMatrix(filename, A->nz, rows, cols, Ai, Aj, Ax,
| ^~
make[3]: *** [g2o/solvers/csparse/CMakeFiles/csparse_extension.dir/build.make:63: g2o/solvers/csparse/CMakeFiles/csparse_extension.dir/csparse_helper.cpp.o] Error 1
make[3]: Leaving directory '/home/user/g2o/build'
make[2]: *** [CMakeFiles/Makefile2:2067: g2o/solvers/csparse/CMakeFiles/csparse_extension.dir/all] Error 2
make[2]: Leaving directory '/home/user/g2o/build'
make[1]: *** [CMakeFiles/Makefile2:2047: g2o/solvers/csparse/CMakeFiles/solver_csparse.dir/rule] Error 2
make[1]: Leaving directory '/home/user/g2o/build'
make: *** [Makefile:550: solver_csparse] Error 2
I realized that I have another header called cs.h in /usr/local/include/
from osqp library. Apparently from the cmake output it finds this one first so I get
Found CSparse: /usr/local/include
instead of
Found CSparse: /usr/include/suiteparse
Doing
cmake -DCSPARSE_INCLUDE_DIR=/usr/include/suitesparse/ ..
works well, thank you !
Hello, I cannot build g2o master branch on Ubuntu 20.04. I tried with g++ and gcc 10 and 9 and none work. Here is the result of my cmake:
Then I do make and this is the error:
Perhaps I'm missing something for compilation?