Opened 2 years ago

Last modified 2 years ago

#63 assigned installation issue

mex cmd error of make.m in matlab interface

Reported by: zhaoye8810 Owned by: ferreau
Priority: normal Milestone:
Component: Matlab interface Version: 3.2.1
Keywords: Cc:

Description

Hello, I try to run the matlab file runOCP.m from BLOCK-ALAIN-master repo. It calls the functionqpOASES_sequence in qpOASES-3.2.1/interfaces/matlab. When I run 'make.m' in that directory, I got the following error.

make


qpOASES -- An Implementation of the Online Active Set Strategy.
Copyright (C) 2007-2017 by Hans Joachim Ferreau, Andreas Potschka,
Christian Kirches et al. All rights reserved.

qpOASES is distributed under the terms of the
GNU Lesser General Public License 2.1 in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.


Building with 'Xcode Clang++'.
Error using mex
Undefined symbols for architecture x86_64:

"_dpotrf_", referenced from:

qpOASES::QProblemB::computeCholesky() in qpOASES.o
qpOASES::QProblem::computeProjectedCholesky() in qpOASES.o

"_dtrcon_", referenced from:

qpOASES::SQProblemSchur::updateSchurQR(long) in qpOASES.o

"_dtrtrs_", referenced from:

qpOASES::SQProblemSchur::backsolveSchurQR(long, double const*, long, double*) in
qpOASES.o

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Error in make (line 131)

eval( cmd );


131 eval( cmd );

The error is caused by the mex cmd. My cmd is defined as

mex -output qpOASES -I. -I../../include -I../../src -largeArrayDims -Dcpluplus -DMATLAB -DSINGLE_OBJECT -DLINUX -lmwblas -O -DNO_COPYRIGHT -largeArrayDims -DUSE_LONG_INTEGERS -DUSE_LONG_FINTS -DSOLVER_MA57 -lmwma57 qpOASES.cpp

It seems the 'dpotrf' and 'dtrcon' are MACRO defined in LapackBlasReplacement?. Does anyone know how to fix this issue? Thank you.

Change History (3)

comment:1 follow-up: Changed 2 years ago by zhaoye8810

As a side comment, I am using matlab R2015a in MacOS Sierra 10.12.1. I build qpOASES by using Cmake (it seems working well, and I can run the examples).

Last edited 2 years ago by zhaoye8810 (previous) (diff)

comment:2 Changed 2 years ago by ferreau

  • Priority changed from high to normal
  • Status changed from new to assigned
  • Type changed from user support to installation issue

comment:3 in reply to: ↑ 1 Changed 2 years ago by raulest50

Replying to zhaoye8810:

As a side comment, I am using matlab R2015a in MacOS Sierra 10.12.1. I build qpOASES by using Cmake (it seems working well, and I can run the examples).


I also want to share my experience to add more clues to this problem.

In a college computer the MinGW64 compiler was installed using the apps manager from matlab 2017.
after this make function compiled succesfully.

In my personal computer i tried to install the MinGW64 manually for matlab (no app manager). I was able to compile c code to test the compiler as suggested in example -> https://www.mathworks.com/help/matlab/matlab_external/install-mingw-support-package.html

but when running make from qpoases matlab interface the " Error in make (line 131)
eval( cmd ); " was prompted.

i tried to uncomment the "#define NO_SNPRINTF" but i did not work.

finally i installed microsoft visual studio 2017 and applied the bug fix shwon in -> https://www.mathworks.com/support/bugreports/1487958.

(see also -> https://www.mathworks.com/matlabcentral/answers/335092-can-i-use-microsoft-visual-studio-2017-with-matlab )

then i used

clear mex

mex -setup cpp

make clean

make

(I also had to comment the "#define NO_SNPRINTF" again in Types.hpp)

and finally i got it :

qpOASES -- An Implementation of the Online Active Set Strategy.
Copyright (C) 2007-2017 by Hans Joachim Ferreau, Andreas Potschka,
Christian Kirches et al. All rights reserved.

qpOASES is distributed under the terms of the
GNU Lesser General Public License 2.1 in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.


Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
INFO (make.m): qpOASES.mexw64 successfully created.
Building with 'Microsoft Visual C++ 2017'.
MEX completed successfully.
INFO (make.m): qpOASES_sequence.mexw64 successfully created.

load('ws1.mat')
[x] = qpOASES(H, g, [-5;-5], [5;5], opt)

x =

-0.5000
-0.5000

I think it has something to do with the MinGW64 installation, when doing manually there must be an additional step to do in order to compile qpoases interface.

Note: See TracTickets for help on using tickets.