Bahareh
Bahareh

Reputation: 1

Trouble Building osqp-eigen Library

I'm encountering challenges while building and installing the osqp-eigen library in my C++ environment. My objective is to implement a quadratic programming function similar to MATLAB's quadprog() function. However, I'm facing difficulties defining addresses for Eigen, OSQP (compiled with 64-bit integers) during the build process.

After cloning the library, I added a build folder and ran cmake .. in the command line, which resulted in a successful build:

C:\osqp\osqp-Eigen\build>cmake ..

-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.37.32822.0
-- The CXX compiler identification is MSVC 19.37.32822.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (9.9s)
-- Generating done (0.1s)
-- Build files have been written to: C:/osqp/osqp-Eigen/build

However, when I opened OSqp-eigen.sln in Visual Studio and attempted to build it, I encountered the following errors:

Build started...
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>1>Checking Build System
2>------ Build started: Project: OsqpEigen, Configuration: Debug x64 ------
2>Building Custom Rule C:/osqp/osqp-Eigen/CMakeLists.txt
2>Data.cpp
2>Settings.cpp
2>Solver.cpp
2>Debug.cpp
2>Generating Code...
2>Auto build dll exports
2>   Creating library C:/osqp/osqp-Eigen/build/Debug/OsqpEigend.lib and object C:/osqp/osqp-Eigen/build/Debug/OsqpEigend.exp
2>Data.obj : error LNK2019: unresolved external symbol csc_spfree referenced in function "public: void __cdecl OsqpEigen::Data::clearHessianMatrix(void)" (?clearHessianMatrix@Data@OsqpEigen@@QEAAXXZ)
2>Solver.obj : error LNK2019: unresolved external symbol csc_spalloc referenced in function "bool __cdecl OsqpEigen::SparseMatrixHelper::createOsqpSparseMatrix<class Eigen::SparseMatrix<double,0,int> >(class Eigen::SparseCompressedBase<class Eigen::SparseMatrix<double,0,int> > const &,struct OSQPCscMatrix * &)" (??$createOsqpSparseMatrix@V?$SparseMatrix@N$0A@H@Eigen@@@SparseMatrixHelper@OsqpEigen@@YA_NAEBV?$SparseCompressedBase@V?$SparseMatrix@N$0A@H@Eigen@@@Eigen@@AEAPEAUOSQPCscMatrix@@@Z)
2>C:\osqp\osqp-Eigen\build\Debug\OsqpEigend.dll : fatal error LNK1120: 2 unresolved externals
2>Done building project "OsqpEigen.vcxproj" -- FAILED.
3>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------
3>Building Custom Rule C:/osqp/osqp-Eigen/CMakeLists.txt
========== Build: 2 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 10:49 ق.ظ and took 08.958 seconds ========== 

There is an open issue in the OSQP GitHub library that I have read, but I was unable to find the answer. Do you have any suggestions for resolving these errors

Edited: I found the answer here I should use another version of OSQP(the latest release of osqp (0.6.3))

Upvotes: 0

Views: 450

Answers (0)

Related Questions