hallfjonas / LCQPow

LCQPow - A Solver for Quadratic Programs with Linear Complementarity Constraints
GNU Lesser General Public License v2.1
25 stars 6 forks source link

Failure to compile on MacBook Air M2: libosqp.so #5

Open hurak opened 1 year ago

hurak commented 1 year ago

Hi, I am failing to compile on MacBook Air M2. Below is the complete listing from the command line. The error message (displayed at the very end of the listing) is

Performing install step for 'osqp' cp: /Users/hurak/Documents/tmp/LCQPow/build/external/src/osqp-build/out/libosqp.so: No such file or directory

which suggests that compilation of OSQP failed. Any idea what to do next?

By the way, when compiling OSQP from sources following their instructions on https://osqp.org/docs/get_started/sources.html, I encounter no problems.

➜ tmp git clone https://github.com/hallfjonas/LCQPow.git
Cloning into 'LCQPow'...
remote: Enumerating objects: 3882, done.
remote: Counting objects: 100% (356/356), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 3882 (delta 305), reused 302 (delta 281), pack-reused 3526
Receiving objects: 100% (3882/3882), 2.77 MiB | 338.00 KiB/s, done.
Resolving deltas: 100% (2423/2423), done.
➜  tmp cd LCQPow 
➜  LCQPow git:(main) git submodule update --init --recursive
Submodule 'external/googletest' (https://github.com/google/googletest.git) registered for path 'external/googletest'
Submodule 'external/osqp' (https://github.com/osqp/osqp.git) registered for path 'external/osqp'
Submodule 'external/pybind11' (https://github.com/pybind/pybind11.git) registered for path 'external/pybind11'
Submodule 'external/qpOASES' (https://github.com/coin-or/qpOASES.git) registered for path 'external/qpOASES'
Cloning into '/Users/hurak/Documents/tmp/LCQPow/external/googletest'...
Cloning into '/Users/hurak/Documents/tmp/LCQPow/external/osqp'...
Cloning into '/Users/hurak/Documents/tmp/LCQPow/external/pybind11'...
Cloning into '/Users/hurak/Documents/tmp/LCQPow/external/qpOASES'...
Submodule path 'external/googletest': checked out 'e2239ee6043f73722e7aa812a459f54a28552929'
Submodule path 'external/osqp': checked out 'f9fc23d3436e4b17dd2cb95f70cfa1f37d122c24'
Submodule 'lin_sys/direct/qdldl/qdldl_sources' (https://github.com/oxfordcontrol/qdldl.git) registered for path 'external/osqp/lin_sys/direct/qdldl/qdldl_sources'
Cloning into '/Users/hurak/Documents/tmp/LCQPow/external/osqp/lin_sys/direct/qdldl/qdldl_sources'...
Submodule path 'external/osqp/lin_sys/direct/qdldl/qdldl_sources': checked out '7d16b70a10a152682204d745d814b6eb63dc5cd2'
Submodule path 'external/pybind11': checked out '70a58c577eaf067748c2ec31bfd0b0a614cffba6'
Submodule path 'external/qpOASES': checked out '268b2f2659604df27c82aa6e32aeddb8c1d5cc7f'
➜  LCQPow git:(main) mkdir build
➜  LCQPow git:(main) cd build
➜  build git:(main) cmake ..
-- The CXX compiler identification is AppleClang 15.0.0.15000040
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMAKE_BUILD_TYPE           Release
EXAMPLES                   ON
BUILD_MATLAB_INTERFACE     ON
BUILD_PYTHON_INTERFACE     ON
UNIT_TESTS                 ON
PROFILING                  OFF
QPOASES_SCHUR              OFF

-- Found Matlab: /Applications/MATLAB_R2023a.app/extern/include (found version "9.14")  
-- Performing Test HAS_MINUS_PTHREAD
-- Performing Test HAS_MINUS_PTHREAD - Success
CMake Deprecation Warning at external/pybind11/CMakeLists.txt:8 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- pybind11 v2.9.0 dev1
CMake Warning (dev) at external/pybind11/tools/FindPythonLibsNew.cmake:98 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  external/pybind11/tools/pybind11Tools.cmake:50 (find_package)
  external/pybind11/tools/pybind11Common.cmake:206 (include)
  external/pybind11/CMakeLists.txt:200 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PythonInterp: /opt/homebrew/bin/python3.11 (found version "3.11.5") 
-- Found PythonLibs: /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Performing Test HAS_FLTO_THIN
-- Performing Test HAS_FLTO_THIN - Success
-- Configuring done (13.2s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/hurak/Documents/tmp/LCQPow/build
➜  build git:(main) make
[  1%] Creating directories for 'qpoases'
[  2%] Performing download step for 'qpoases'
[  3%] No update step for 'qpoases'
[  5%] No patch step for 'qpoases'
[  6%] Performing configure step for 'qpoases'
[  7%] Performing build step for 'qpoases'
Creating /Users/hurak/Documents/tmp/LCQPow/build/external/src/qpoases/src/LAPACKReplacement.o
Creating /Users/hurak/Documents/tmp/LCQPow/build/external/src/qpoases/src/BLASReplacement.o
Creating SQProblem.o
Creating QProblem.o
Creating QProblemB.o
Creating SQProblemSchur.o
Creating Bounds.o
Creating Constraints.o
Creating SubjectTo.o
Creating Indexlist.o
Creating Flipper.o
Creating Utils.o
Creating Options.o
Creating Matrices.o
Creating MessageHandling.o
Creating SparseSolver.o
Creating SolutionAnalysis.o
Creating OQPinterface.o
Creating static lib /Users/hurak/Documents/tmp/LCQPow/build/external/src/qpoases/bin/libqpOASES.a
ar: creating archive /Users/hurak/Documents/tmp/LCQPow/build/external/src/qpoases/bin/libqpOASES.a
Creating shared lib /Users/hurak/Documents/tmp/LCQPow/build/external/src/qpoases/bin/libqpOASES.so
[  8%] Performing install step for 'qpoases'
[ 10%] Completed 'qpoases'
[ 10%] Built target qpoases
[ 11%] Creating directories for 'osqp'
[ 12%] Performing download step for 'osqp'
[ 13%] No update step for 'osqp'
[ 15%] No patch step for 'osqp'
[ 16%] Performing configure step for 'osqp'
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- The C compiler identification is AppleClang 15.0.0.15000040
-- The CXX compiler identification is AppleClang 15.0.0.15000040
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - 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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- We are on a Darwin system
-- Embedded is OFF
-- Printing is ON
-- Profiling is ON
-- User interrupt is ON
-- Floats are OFF
-- Long integers (64bit) are OFF
-- Code coverage is OFF
-- MKL Pardiso: ON
CMake Deprecation Warning at lin_sys/direct/qdldl/qdldl_sources/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Floats are OFF
-- Long integers (64bit) are OFF
-- Configuring done (0.8s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/hurak/Documents/tmp/LCQPow/build/external/src/osqp-build
[ 17%] Performing build step for 'osqp'
[  1%] Building C object lin_sys/direct/qdldl/qdldl_sources/CMakeFiles/qdldlobject.dir/src/qdldl.c.o
[  1%] Built target qdldlobject
[  3%] Building C object lin_sys/direct/CMakeFiles/linsys_pardiso.dir/pardiso/pardiso_interface.c.o
[  5%] Building C object lin_sys/direct/CMakeFiles/linsys_pardiso.dir/pardiso/pardiso_loader.c.o
[  5%] Built target linsys_pardiso
[  7%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/amd_1.c.o
[  9%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/amd_2.c.o
[ 11%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/amd_aat.c.o
[ 13%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/amd_control.c.o
[ 15%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/amd_defaults.c.o
[ 17%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/amd_info.c.o
[ 19%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/amd_order.c.o
[ 21%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/amd_post_tree.c.o
[ 23%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/amd_postorder.c.o
[ 25%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/amd_preprocess.c.o
[ 26%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/amd_valid.c.o
[ 28%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/amd/src/SuiteSparse_config.c.o
[ 30%] Building C object lin_sys/direct/qdldl/CMakeFiles/linsys_qdldl.dir/qdldl_interface.c.o
[ 30%] Built target linsys_qdldl
[ 32%] Building C object CMakeFiles/osqpstatic.dir/src/auxil.c.o
[ 34%] Building C object CMakeFiles/osqpstatic.dir/src/error.c.o
[ 36%] Building C object CMakeFiles/osqpstatic.dir/src/lin_alg.c.o
[ 38%] Building C object CMakeFiles/osqpstatic.dir/src/osqp.c.o
[ 40%] Building C object CMakeFiles/osqpstatic.dir/src/proj.c.o
[ 42%] Building C object CMakeFiles/osqpstatic.dir/src/scaling.c.o
[ 44%] Building C object CMakeFiles/osqpstatic.dir/src/util.c.o
[ 46%] Building C object CMakeFiles/osqpstatic.dir/src/kkt.c.o
[ 48%] Building C object CMakeFiles/osqpstatic.dir/src/cs.c.o
[ 50%] Building C object CMakeFiles/osqpstatic.dir/src/polish.c.o
[ 51%] Building C object CMakeFiles/osqpstatic.dir/src/lin_sys.c.o
[ 53%] Building C object CMakeFiles/osqpstatic.dir/src/ctrlc.c.o
[ 55%] Building C object CMakeFiles/osqpstatic.dir/lin_sys/lib_handler.c.o
[ 57%] Linking C static library out/libosqp.a
[ 57%] Built target osqpstatic
[ 59%] Building C object CMakeFiles/osqp.dir/src/auxil.c.o
[ 61%] Building C object CMakeFiles/osqp.dir/src/error.c.o
[ 63%] Building C object CMakeFiles/osqp.dir/src/lin_alg.c.o
[ 65%] Building C object CMakeFiles/osqp.dir/src/osqp.c.o
[ 67%] Building C object CMakeFiles/osqp.dir/src/proj.c.o
[ 69%] Building C object CMakeFiles/osqp.dir/src/scaling.c.o
[ 71%] Building C object CMakeFiles/osqp.dir/src/util.c.o
[ 73%] Building C object CMakeFiles/osqp.dir/src/kkt.c.o
[ 75%] Building C object CMakeFiles/osqp.dir/src/cs.c.o
[ 76%] Building C object CMakeFiles/osqp.dir/src/polish.c.o
[ 78%] Building C object CMakeFiles/osqp.dir/src/lin_sys.c.o
[ 80%] Building C object CMakeFiles/osqp.dir/src/ctrlc.c.o
[ 82%] Building C object CMakeFiles/osqp.dir/lin_sys/lib_handler.c.o
[ 84%] Linking C shared library out/libosqp.dylib
[ 84%] Built target osqp
[ 86%] Building C object CMakeFiles/osqp_demo.dir/examples/osqp_demo.c.o
[ 88%] Linking C executable out/osqp_demo
[ 88%] Built target osqp_demo
[ 90%] Building C object lin_sys/direct/qdldl/qdldl_sources/CMakeFiles/qdldlstatic.dir/src/qdldl.c.o
[ 92%] Linking C static library out/libqdldl.a
[ 92%] Built target qdldlstatic
[ 94%] Building C object lin_sys/direct/qdldl/qdldl_sources/CMakeFiles/qdldl.dir/src/qdldl.c.o
[ 96%] Linking C shared library out/libqdldl.dylib
[ 96%] Built target qdldl
[ 98%] Building C object lin_sys/direct/qdldl/qdldl_sources/CMakeFiles/qdldl_example.dir/examples/example.c.o
[100%] Linking C executable out/qdldl_example
[100%] Built target qdldl_example
[ 18%] Performing install step for 'osqp'
cp: /Users/hurak/Documents/tmp/LCQPow/build/external/src/osqp-build/out/libosqp.so: No such file or directory
make[2]: *** [external/src/osqp-stamp/osqp-install] Error 1
make[1]: *** [CMakeFiles/osqp.dir/all] Error 2
make: *** [all] Error 2
➜  build git:(main) 
hallfjonas commented 1 year ago

Debugging mac build is a bit tough for me, since I don't have one. As a first step I included a new GitHub action for mac-build (see f7c974160a8a0f14f6ecbf5cb105c0d3517bf9fb). Unfortunately it passed, so I am getting no new insights.

What I do see is that OSQP built a shared library

[ 84%] Linking C shared library out/libosqp.dylib

whereas we are looking for the .so extension

cp: /Users/hurak/Documents/tmp/LCQPow/build/external/src/osqp-build/out/libosqp.so: No such file or directory

I updated this part in the build process: now all libraries are copied. Please checkout the branch mac-build and try again.

hurak commented 1 year ago

Now with the mac-build branch it fails even earlier – with qpoasis:

➜  LCQPow git:(mac-build) mkdir build
➜  LCQPow git:(mac-build) cd build
➜  build git:(mac-build) cmake ..
-- The CXX compiler identification is AppleClang 15.0.0.15000040
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMAKE_BUILD_TYPE           Release
EXAMPLES                   ON
BUILD_MATLAB_INTERFACE     ON
BUILD_PYTHON_INTERFACE     ON
UNIT_TESTS                 ON
PROFILING                  OFF
QPOASES_SCHUR              OFF

-- Found Matlab: /Applications/MATLAB_R2023a.app/extern/include (found version "9.14")  
-- Performing Test HAS_MINUS_PTHREAD
-- Performing Test HAS_MINUS_PTHREAD - Success
CMake Deprecation Warning at external/pybind11/CMakeLists.txt:8 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- pybind11 v2.9.0 dev1
CMake Warning (dev) at external/pybind11/tools/FindPythonLibsNew.cmake:98 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  external/pybind11/tools/pybind11Tools.cmake:50 (find_package)
  external/pybind11/tools/pybind11Common.cmake:206 (include)
  external/pybind11/CMakeLists.txt:200 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PythonInterp: /opt/homebrew/bin/python3.11 (found version "3.11.5") 
-- Found PythonLibs: /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Performing Test HAS_FLTO_THIN
-- Performing Test HAS_FLTO_THIN - Success
-- Configuring done (2.3s)
-- Generating done (0.1s)
-- Build files have been written to: /Users/hurak/Documents/tmp/LCQPow/build
➜  build git:(mac-build) make
[  1%] Creating directories for 'qpoases'
[  2%] Performing download step for 'qpoases'
[  3%] No update step for 'qpoases'
[  5%] No patch step for 'qpoases'
[  6%] Performing configure step for 'qpoases'
[  7%] Performing build step for 'qpoases'
Creating /Users/hurak/Documents/tmp/LCQPow/build/external/src/qpoases/src/LAPACKReplacement.o
Creating /Users/hurak/Documents/tmp/LCQPow/build/external/src/qpoases/src/BLASReplacement.o
Creating SQProblem.o
Creating QProblem.o
Creating QProblemB.o
Creating SQProblemSchur.o
Creating Bounds.o
Creating Constraints.o
Creating SubjectTo.o
Creating Indexlist.o
Creating Flipper.o
Creating Utils.o
Creating Options.o
Creating Matrices.o
Creating MessageHandling.o
Creating SparseSolver.o
Creating SolutionAnalysis.o
Creating OQPinterface.o
Creating static lib /Users/hurak/Documents/tmp/LCQPow/build/external/src/qpoases/bin/libqpOASES.a
ar: creating archive /Users/hurak/Documents/tmp/LCQPow/build/external/src/qpoases/bin/libqpOASES.a
Creating shared lib /Users/hurak/Documents/tmp/LCQPow/build/external/src/qpoases/bin/libqpOASES.so
[  8%] Performing install step for 'qpoases'
cp: /Users/hurak/Documents/tmp/LCQPow/build/external/src/qpoases/bin/libqpOASES.*: No such file or directory
make[2]: *** [external/src/qpoases-stamp/qpoases-install] Error 1
make[1]: *** [CMakeFiles/qpoases.dir/all] Error 2
make: *** [all] Error 2