Coder Social home page Coder Social logo

Comments (8)

S-Dafarra avatar S-Dafarra commented on June 12, 2024 3

Indeed, the reason is exactly this one:

/home/ugv/software/osqp-eigen-master/src/Solver.cpp:19:18: error: ‘make_unique’ is not a member of ‘std’

The make_unique has been implemented in gcc starting from version 4.9.0: https://isocpp.org/blog/2014/04/gcc-4.9.0. I am afraid your compiler is not supported.

By commenting out the lines https://github.com/robotology/osqp-eigen/blob/master/src/Solver.cpp#L23-L24 you are not allocating the Settings and Data object, causing the segfault.

from osqp-eigen.

NUDTUGVexplorer avatar NUDTUGVexplorer commented on June 12, 2024 3

Thanks for your help. After I update the gcc and g++ version to be 4.9.4. Now it woks. I appreciate your kind help.

from osqp-eigen.

S-Dafarra avatar S-Dafarra commented on June 12, 2024 2

Hi @NUDTUGVexplorer,
can you give us some more information about your system? For example:

  • OS you are currently using
  • osqp-eigen version
  • osqp version
  • Did you change some of the default cmake configurations?

from osqp-eigen.

NUDTUGVexplorer avatar NUDTUGVexplorer commented on June 12, 2024

1.OS: ubuntu 14.04 LTS gcc version 4.8.4
2.osqp-eigen: I just git from your repo on March 1st, 2020.
3.osqp: OSQP v0.5.0 - Operator Splitting QP Solver
4. I didn't change the cmake configurations.
But when I compile osqp-eigen, there is an issue as follows:
/osqp-eigen-master/build$ make
Scanning dependencies of target OsqpEigen
[ 25%] Building CXX object CMakeFiles/OsqpEigen.dir/src/Data.cpp.o
[ 50%] Building CXX object CMakeFiles/OsqpEigen.dir/src/Settings.cpp.o
[ 75%] Building CXX object CMakeFiles/OsqpEigen.dir/src/Solver.cpp.o
/home/ugv/software/osqp-eigen-master/src/Solver.cpp: In constructor ‘OsqpEigen::Solver::Solver()’:
/home/ugv/software/osqp-eigen-master/src/Solver.cpp:19:18: error: ‘make_unique’ is not a member of ‘std’
m_settings = std::make_uniqueOsqpEigen::Settings();
^
/home/ugv/software/osqp-eigen-master/src/Solver.cpp:19:54: error: expected primary-expression before ‘>’ token
m_settings = std::make_uniqueOsqpEigen::Settings();
^
/home/ugv/software/osqp-eigen-master/src/Solver.cpp:19:56: error: expected primary-expression before ‘)’ token
m_settings = std::make_uniqueOsqpEigen::Settings();
^
/home/ugv/software/osqp-eigen-master/src/Solver.cpp:20:14: error: ‘make_unique’ is not a member of ‘std’
m_data = std::make_uniqueOsqpEigen::Data();
^
/home/ugv/software/osqp-eigen-master/src/Solver.cpp:20:46: error: expected primary-expression before ‘>’ token
m_data = std::make_uniqueOsqpEigen::Data();
^
/home/ugv/software/osqp-eigen-master/src/Solver.cpp:20:48: error: expected primary-expression before ‘)’ token
m_data = std::make_uniqueOsqpEigen::Data();
^
make[2]: *** [CMakeFiles/OsqpEigen.dir/src/Solver.cpp.o] Error 1
make[1]: *** [CMakeFiles/OsqpEigen.dir/all] Error 2
make: *** [all] Error 2

In order to fix the issue, I found some advise from the others.
So I change the code in Solver.cpp,
//m_settings = std::unique_ptrOsqpEigen::Settings();
//m_data = std::unique_ptrOsqpEigen::Data();

m_settings = std::make_unique<OsqpEigen::Settings>();
m_data = std::make_unique<OsqpEigen::Data>();

Then it could be successfully compiled now.
/osqp-eigen-master/build$ make
Scanning dependencies of target OsqpEigen
[ 25%] Building CXX object CMakeFiles/OsqpEigen.dir/src/Solver.cpp.o
[ 50%] Linking CXX shared library lib/libOsqpEigen.so
[100%] Built target OsqpEigen

Thanks!

from osqp-eigen.

NUDTUGVexplorer avatar NUDTUGVexplorer commented on June 12, 2024

make test, the results are as follows:
Running tests...
Test project /home/lxh/software/osqp-eigen-master/build
Start 1: SparseMatrixTest
1/5 Test #1: SparseMatrixTest ................. Passed 0.01 sec
Start 2: QPTest
2/5 Test #2: QPTest ...........................***Exception: SegFault 0.12 sec
Start 3: UpdateMatricesTest
3/5 Test #3: UpdateMatricesTest ...............***Exception: SegFault 0.10 sec
Start 4: MPCTest
4/5 Test #4: MPCTest ..........................***Exception: SegFault 0.10 sec
Start 5: MPCUpdateMatricesTest
5/5 Test #5: MPCUpdateMatricesTest ............***Exception: SegFault 0.10 sec

20% tests passed, 4 tests failed out of 5

Total Test time (real) = 0.42 sec

The following tests FAILED:
2 - QPTest (SEGFAULT)
3 - UpdateMatricesTest (SEGFAULT)
4 - MPCTest (SEGFAULT)
5 - MPCUpdateMatricesTest (SEGFAULT)
Errors while running CTest

from osqp-eigen.

mzahana avatar mzahana commented on June 12, 2024

@S-Dafarra I am facing the same issue Segmentation fault (core dumped). I am using Ubuntu 18 with g++ and gcc version 7.5.0 . I am compiled osqp from source as described here.

The following lines execute with no errors:

//solver.settings()->setVerbosity(false);
   qpSolver_.settings()->setWarmStart(true);
   // set the initial data of the QP solver
   qpSolver_.data()->setNumberOfVariables((num_of_states_+num_of_inputs_)*mpcWindow);
   qpSolver_.data()->setNumberOfConstraints((2*num_of_states_+num_of_inputs_)*mpcWindow);
   Eigen::SparseMatrix<double> hessian = hessian_.sparseView();
   Eigen::SparseMatrix<double> Ac = Ac_.sparseView();
   if(!qpSolver_.data()->setHessianMatrix(hessian)) return false;
   if(!qpSolver_.data()->setGradient(gradient_)) return false;
   if(!qpSolver_.data()->setLinearConstraintsMatrix(Ac)) return false;
   if(!qpSolver_.data()->setLowerBound(lowerBounds_)) return false;
   if(!qpSolver_.data()->setUpperBound(upperBounds_)) return false;

However, I get the segmentation fault error when the following is executed

qpSolver_.updateBounds(lowerBounds_, upperBounds_);

I made sure that dimensions of the matrices are correct.

What could be the issue?

Thanks in advance.

from osqp-eigen.

mzahana avatar mzahana commented on June 12, 2024

Can the OsqpEigen::Solver obj; be a class member? It seems to ave an issue when I use it inside a class as a class member.

from osqp-eigen.

mzahana avatar mzahana commented on June 12, 2024

Problem is solved. It was a silly mistake that I didn't initSolver() !

from osqp-eigen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.