coin-or / qpOASES

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

Unable to link to the static library #31

Closed svigerske closed 4 years ago

svigerske commented 4 years ago

Issue created by migration from Trac.

Original creator: grimmehesten

Original creation time: 2014-12-16 13:17:28

Assignee: ferreau

Version: 3.0.0

I am unable to link to the static library in the bin/ folder. Reproduce the error: In the examples/ folder when I run the command: 'g++ -static example1.cpp -I ../include/ -o staticallylinked -L ../bin/ -l qpOASES' I get the following error: ../bin//libqpOASES.a(QProblem.o): In function qpOASES::QProblem::computeProjectedCholesky()': QProblem.cpp:(.text+0x1cf8): undefined reference todpotrf' ../bin//libqpOASES.a(QProblemB.o): In function qpOASES::QProblemB::computeCholesky()': QProblemB.cpp:(.text+0x1e2d): undefined reference todpotrf' ../bin//libqpOASES.a(Matrices.o): In function qpOASES::DenseMatrix::transTimes(int, double, double const*, int, double, double*, int) const': Matrices.cpp:(.text+0x8989): undefined reference todgemm' ../bin//libqpOASES.a(Matrices.o): In function qpOASES::DenseMatrix::times(int, double, double const*, int, double, double*, int) const': Matrices.cpp:(.text+0x8a7d): undefined reference todgemm_' collect2: ld returned 1 exit status

I have not installed BLAS or LAPACK.

svigerske commented 4 years ago

Comment by ferreau created at 2014-12-17 09:51:32

Neither the static nor the dynamic qpOASES library include code of the BLAS/LAPACK routines. Thus, just linking qpOASES will lead to undefined references as above. If you do not use BLAS/LAPACK, you need to explicitly link the BLASReplacement.cpp/LAPACKReplacement.cpp files that come along with the qpOASES release. So, calling

g++ -static example1.cpp ../src/BLASReplacement.cpp ../src/LAPACKReplacement.cpp -I../include/ -o statically_linked -L../bin/ -lqpOASES

should do the trick.

svigerske commented 4 years ago

Comment by ferreau created at 2014-12-17 09:51:53

Resolution: fixed