Simple-Robotics / proxsuite

The Advanced Proximal Optimization Toolbox
BSD 2-Clause "Simplified" License
408 stars 50 forks source link

cmake error when building on windows #148

Closed limymy closed 1 year ago

limymy commented 1 year ago

I am trying to use proxsuite via cmake 'FetchContent' command. But something wrong.

[cmake] fatal: not a git repository (or any of the parent directories): .git
[cmake] -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
[cmake] -- CMAKE_SYSTEM_PROCESSOR: AMD64
[cmake] CMake Error at build/_deps/proxsuite-src/cmake-module/logging.cmake:118 (file):
[cmake]   file failed to open for writing (Invalid argument):
[cmake] 
[cmake]     E:/mycode/proxqp/## ---------------- ##
[cmake] 
[cmake] Call Stack (most recent call first):
[cmake]   build/_deps/proxsuite-src/cmake-module/base.cmake:323 (logging_finalize)
[cmake]   build/_deps/proxsuite-src/cmake-module/base.cmake:207 (setup_project_finalize)
[cmake]   CMakeLists.txt:2147483647 (SETUP_PROJECT_FINALIZE_HOOK)
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!

This is my CMakeLists.txt

cmake_minimum_required(VERSION 3.14)

project(proxqp_test)

include(FetchContent)
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)

FetchContent_Declare(
    simde
    GIT_REPOSITORY https://github.com/simd-everywhere/simde.git
    GIT_TAG v0.7.2
    GIT_SHALLOW    TRUE
)
FetchContent_MakeAvailable(simde)
set(Simde_INCLUDE_DIR ${simde_SOURCE_DIR}/simde)

set(DISABLE_TESTS ON)
set(BUILD_TESTING OFF)
FetchContent_Declare(
    proxsuite
    GIT_REPOSITORY https://github.com/Simple-Robotics/proxsuite.git
    GIT_TAG v0.2.15
)
FetchContent_MakeAvailable(proxsuite)

Please help me figure it out. Thanks.

jcarpent commented 1 year ago

Hi @LiMYmy,

This is working on my side perfectly on OSX systems with cmake 3.24.2. Could you provide your cmake version? @fabinsch Could you try on a virtual windows system?

limymy commented 1 year ago

Could you provide your cmake version?

Mine is 3.22.1 . I upgrade cmake to version 3.25.1 just now, but it has the same error.

Now I am using it via conda install which performs well.

By the way, when will #47 be done, or how can I make a bound box in current version?

jcarpent commented 1 year ago

I've fixed an issue here https://github.com/jrl-umi3218/jrl-cmakemodules/pull/572

jcarpent commented 1 year ago

By the way, when will #47 be done, or how can I make a bound box in current version?

Just use C = Identity for adding the bounds on the optimization variables.

jcarpent commented 1 year ago

@LiMYmy Could you try your cmake fetch with:

limymy commented 1 year ago

It works! No error when running cmake. But when I try to build it has error occurred.

[build]   Checking Build System
[build]   Building Custom Rule E:/mycode/proxqp/build/_deps/proxsuite-src/CMakeLists.txt
[build]   Generating Doxygen documentation
[build] CUSTOMBUILD : error : configuration file Doxyfile not found! [E:\mycode\proxqp\build\_deps\proxsuite-build\doc.vcxproj]
[build]   Doxygen version 1.9.1
[build]   Copyright Dimitri van Heesch 1997-2021

I don't want to build the doc, so how can I disable doxygen?

limymy commented 1 year ago

Just use C = Identity for adding the bounds on the optimization variables.

Can u and l have different dimension? I already have an u, now I want to apply a bound box on x.

jcarpent commented 1 year ago

They should have the same dimension of course. This is written in the doc.

jcarpent commented 1 year ago

Please look at the examples ...

limymy commented 1 year ago

They should have the same dimension of course. This is written in the doc.

I am new to QP and I have read the doc. But I don't know how to make an upper bound without a lower bound in l C u.

fabinsch commented 1 year ago

if you have no lower bound you can set the l value to something really low: l = -1.0e20 * np.ones(m) where m is the same size as u and the first dimension of C.

limymy commented 1 year ago

if you have no lower bound you can set the l value to something really low: l = -1.0e20 * np.ones(m) where m is the same size as u and the first dimension of C.

Get it! Thanks!

jcarpent commented 1 year ago

It works! No error when running cmake. But when I try to build it has error occurred.

[build]   Checking Build System
[build]   Building Custom Rule E:/mycode/proxqp/build/_deps/proxsuite-src/CMakeLists.txt
[build]   Generating Doxygen documentation
[build] CUSTOMBUILD : error : configuration file Doxyfile not found! [E:\mycode\proxqp\build\_deps\proxsuite-build\doc.vcxproj]
[build]   Doxygen version 1.9.1
[build]   Copyright Dimitri van Heesch 1997-2021

I don't want to build the doc, so how can I disable doxygen?

I've updated the current PR. Could you try with this commit id d3696cc32229beef906907a1c3e9e0d6779e498b?

jcarpent commented 1 year ago

If you can also share you current CMake project to try on my side?

limymy commented 1 year ago

I've updated the current PR. Could you try with this commit id d3696cc?

Error is the same.

If you can also share you current CMake project to try on my side?

I created a repo. There is a doxygen(version 1.9.1) in my pc. Will it be the problem?

jcarpent commented 1 year ago
cmake_minimum_required(VERSION 3.14)

project(proxqp_test)
set(CMAKE_CXX_STANDARD 17) 
set(CMAKE_VERBOSE_MAKEFILE ON)

include(FetchContent)
# set(FETCHCONTENT_UPDATES_DISCONNECTED ON)

FetchContent_Declare(
    simde
    GIT_REPOSITORY https://github.com/simd-everywhere/simde.git
    GIT_TAG v0.7.2
    GIT_SHALLOW    TRUE
)
FetchContent_MakeAvailable(simde)
set(Simde_INCLUDE_DIR ${simde_SOURCE_DIR})

set(BUILD_TESTING OFF CACHE INTERNAL "")
FetchContent_Declare(
    proxsuite
    GIT_REPOSITORY https://github.com/jcarpent/proxsuite
    GIT_TAG 1948699d
)
FetchContent_MakeAvailable(proxsuite)

add_executable(app main.cpp)
target_link_libraries(app PUBLIC
  proxsuite-vectorized
)
target_compile_features(app PUBLIC cxx_std_17)
target_compile_definitions(app PUBLIC NOMINMAX)
target_compile_options(app PUBLIC "-arch:AVX2")

works fine. Please erase your current build directory to clean up.

jcarpent commented 1 year ago

Provide the full log file otherwise.

limymy commented 1 year ago

Use the latest cmake file and this is the full log.

[main] Building folder: proxqp 
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" --build e:/mycode/proxqp/build --config Debug --target ALL_BUILD -j 10 --
[build] MSBuild version 17.4.1+9a89d02ff for .NET Framework
[build]   Checking Build System
[build]   Building Custom Rule E:/mycode/proxqp/build/_deps/proxsuite-src/CMakeLists.txt
[build]   Generating Doxygen documentation
[build] CUSTOMBUILD : error : configuration file E:/mycode/proxqp/build/_deps/proxsuite-build/doc/Doxyfile not found! [E:\mycode\proxqp\build\_deps\proxsuite-build\doc.vcxproj]
[build]   Doxygen version 1.9.1
[build]   Copyright Dimitri van Heesch 1997-2021
[build]   
[build]   You can use doxygen in a number of ways:
[build]   
[build]   1) Use doxygen to generate a template configuration file:
[build]       C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\doxygen.exe [-s] -g [configName]
[build]   
[build]   2) Use doxygen to update an old configuration file:
[build]       C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\doxygen.exe [-s] -u [configName]
[build]   
[build]   3) Use doxygen to generate documentation using an existing configuration file:
[build]       C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\doxygen.exe [configName]
[build]   
[build]   4) Use doxygen to generate a template file controlling the layout of the
[build]      generated documentation:
[build]       C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\doxygen.exe -l [layoutFileName]
[build]   
[build]       In case layoutFileName is omitted layoutFileName.xml will be used as filename.
[build]       If - is used for layoutFileName doxygen will write to standard output.
[build]   
[build]   5) Use doxygen to generate a template style sheet file for RTF, HTML or Latex.
[build]       RTF:        C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\doxygen.exe -w rtf styleSheetFile
[build]       HTML:       C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\doxygen.exe -w html headerFile footerFile styleSheetFile [configFile]
[build]       LaTeX:      C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\doxygen.exe -w latex headerFile footerFile styleSheetFile [configFile]
[build]   
[build]   6) Use doxygen to generate a rtf extensions file
[build]       RTF:   C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\doxygen.exe -e rtf extensionsFile
[build]   
[build]       If - is used for extensionsFile doxygen will write to standard output.
[build]   
[build]   7) Use doxygen to compare the used configuration file with the template configuration file
[build]       C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\doxygen.exe -x [configFile]
[build]   
[build]   8) Use doxygen to show a list of built-in emojis.
[build]       C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\doxygen.exe -f emoji outputFileName
[build]   
[build]       If - is used for outputFileName doxygen will write to standard output.
[build]   
[build]   If -s is specified the comments of the configuration items in the config file will be omitted.
[build]   If configName is omitted 'Doxyfile' will be used as a default.
[build]   If - is used for configFile doxygen will write / read the configuration to /from standard output / input.
[build]   
[build]   -v print version string
[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(247,5): error MSB8066: “E:\mycode\proxqp\build\CMakeFiles\2a74375eabb440a62362159be12e416b\doc.rule;E:\mycode\proxqp\build\_deps\proxsuite-src\CMakeLists.txt”的自定义生成已退出,代码为 1。 [E:\mycode\proxqp\build\_deps\proxsuite-build\doc.vcxproj]
[proc] The command: "C:\Program Files\CMake\bin\cmake.exe" --build e:/mycode/proxqp/build --config Debug --target ALL_BUILD -j 10 -- exited with code: 1 and signal: null
[build] Build finished with exit code 1

error : configuration file E:/mycode/proxqp/build/_deps/proxsuite-build/doc/Doxyfile not found! There really isn't a Doxyfile. Can I just disable this doxygen task since I don't need it? Add set(INSTALL_DOCUMENTATION OFF CACHE INTERNAL "") has no effect.

jcarpent commented 1 year ago

It should be working now with the new commit 5b423f6e67ea1dd63357f9a79787aa9cef9c4dc1

limymy commented 1 year ago

It should be working now with the new commit 5b423f6

Works well! Thanks a lot! I have noticed that you are also working with pinocchio library which use jrl-cmakemodules too. Could you help improving the build of proxsuite and pinocchio together with cmake FetchContent command? Or rather It's hard to do because jrl-cmakemodules is not designed for that?

jcarpent commented 1 year ago

As noticed by @nim65s in #149, the jrl-cmakemodules is not designed for that at the beginning. @nim65s Do you have any idea on how to change the module to allow fetching?

nim65s commented 1 year ago

The best solution would be to get that module only once. I'll work on an example later in the day.

nim65s commented 1 year ago

I can't get this work right now, there is way too much work, because different project will require different config headers, might have different project settings, etc.

Sorry @LiMYmy, but for now, if you want to use multiple projects of ours, you'll need to use multiple git clone / cmake / make / make install, or a package manager.

limymy commented 1 year ago

I can't get this work right now, there is way too much work, because different project will require different config headers, might have different project settings, etc.

Sorry @LiMYmy, but for now, if you want to use multiple projects of ours, you'll need to use multiple git clone / cmake / make / make install, or a package manager.

Don't be sorry, I realize that it is a large project. It is very kind of you to help me so much. I will use conda on windows because there are too many dependencies. Maybe you could make jrl-cmakemodules more flexible such as completely disabling doxygen which confuses me a lot.

jcarpent commented 1 year ago

@nim65s Thanks a lot for the deep investigation.