coin-or / qpOASES

Open-source C++ implementation of the recently proposed online active set strategy
GNU Lesser General Public License v2.1
385 stars 129 forks source link

Error on mex-compiling qpoases for Matlab; Fix provided #84

Open svigerske opened 4 years ago

svigerske commented 4 years ago

Issue created by migration from Trac.

Original creator: lkazaz

Original creation time: 2018-04-30 16:20:00

Assignee: ferreau

Version: 3.2.1

Keywords: lapack, missing, library, linker

Problem:

running make.m gives a linker error as follows:

Error using mex
/tmp/mex_3570552951384630_11260/qpOASES.o: In function
`qpOASES::QProblemB::computeCholesky()':
qpOASES.cpp:(.text+0xc289): undefined reference to `dpotrf_'
/tmp/mex_3570552951384630_11260/qpOASES.o: In function
`qpOASES::QProblem::computeProjectedCholesky()':
qpOASES.cpp:(.text+0x16cf6): undefined reference to `dpotrf_'
/tmp/mex_3570552951384630_11260/qpOASES.o: In function
`qpOASES::SQProblemSchur::updateSchurQR(long)':
qpOASES.cpp:(.text+0x3034e): undefined reference to `dtrcon_'
/tmp/mex_3570552951384630_11260/qpOASES.o: In function
`qpOASES::SQProblemSchur::backsolveSchurQR(long, double const*, long,
double*)':
qpOASES.cpp:(.text+0x304db): undefined reference to `dtrtrs_'
collect2: error: ld returned 1 exit status 

Solution: Add libmwlapack.so to the libs. The fix is changing make.m line 72 to

CPPFLAGS = [ CPPFLAGS, '-DLINUX -lmwblas -lmwlapack',' ' ];

See [https://projects.coin-or.org/qpOASES/browser/trunk/interfaces/matlab/make.m?annotate=blame#L72] for the make.m file.

svigerske commented 4 years ago

Comment by lkazaz created at 2018-04-30 16:39:05

Note, this likely solves Ticket #63 as well.

arjunsarin commented 4 years ago

I got the same problem and your hint solved it. Thank you for this post!

By the way: The same is true for the Simulink interface, however both libraries have to be added. Line 72 then reads: CPPFLAGS = [ CPPFLAGS, '-DLINUX -lmwblas -lmwlapack',' ' ];`