qpOASES
qpOASES copied to clipboard
Error on mex-compiling qpoases for Matlab; Fix provided
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.
Comment by lkazaz created at 2018-04-30 16:39:05
Note, this likely solves Ticket #63 as well.
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',' ' ];`