Opened 4 years ago

Closed 4 years ago

#31 closed user support (fixed)

Unable to link to the static library

Reported by: grimmehesten Owned by: ferreau
Priority: normal Milestone:
Component: C++ core Version: 3.0.0
Keywords: Cc:

Description

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 statically_linked -L ../bin/ -l qpOASES' I get the following error:
../binlibqpOASES.a(QProblem.o): In function `qpOASES::QProblem::computeProjectedCholesky()':
QProblem.cpp:(.text+0x1cf8): undefined reference to `dpotrf_'
../bin
libqpOASES.a(QProblemB.o): In function `qpOASES::QProblemB::computeCholesky()':
QProblemB.cpp:(.text+0x1e2d): undefined reference to `dpotrf_'
../binlibqpOASES.a(Matrices.o): In function `qpOASES::DenseMatrix::transTimes(int, double, double const*, int, double, double*, int) const':
Matrices.cpp:(.text+0x8989): undefined reference to `dgemm_'
../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 to `dgemm_'
collect2: ld returned 1 exit status

I have not installed BLAS or LAPACK.

Change History (2)

comment:1 Changed 4 years ago by ferreau

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.

comment:2 Changed 4 years ago by ferreau

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.