microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.06k stars 6.36k forks source link

[ceres] How do I build Ceres with EigenSparse from manifest? #15927

Open r-f-a opened 3 years ago

r-f-a commented 3 years ago

Edit: This seems related to https://github.com/microsoft/vcpkg/issues/3417

What I want to achieve is to use ceres with EigenSparse, namely solver options like:

solver_options.sparse_linear_algebra_library_type = ceres::EIGEN_SPARSE;
solver_options.linear_solver_type = ceres::SPARSE_NORMAL_CHOLESKY;

But this is what I get on program execution:

FAILURE (Can't use SPARSE_NORMAL_CHOLESKY with Solver::Options::sparse_linear_algebra_library_type = EIGEN_SPARSE, because support was not enabled when Ceres Solver was built.)

This is my json manifest:

{
  "name": "manifest",
  "version-string": "0.0.1",
  "dependencies": [
    "catch2",
    "eigen3",
    "boost-math",
    {
      "name": "ceres",
      "features": [ "eigensparse" ]
    }
  ]
}

This is part of my CMakeLists.txt:

find_package(Eigen3 3.3 CONFIG REQUIRED)
find_package(Ceres 2.0 REQUIRED)
set(CMAKE_CXX_STANDARD 17)

# ...

target_link_libraries(${my_lib_objs} PUBLIC Eigen3::Eigen)
target_link_libraries(${my_lib_objs} PUBLIC Ceres::ceres)

In VS CMake output I confirm it can't find the EigenSparse component but that contradicts the manifest build instructions from above:

1> [CMake] -- Running vcpkg install - done
1> [CMake] -- Using toolchain file: C:/Users/Me/vcpkg/scripts/buildsystems/vcpkg.cmake
1> [CMake] -- Found required Ceres dependency: Eigen version 3.3.9 in C:/src/proj/out/build/x64-windows_vs/vcpkg_installed/x64-windows/include/eigen3
1> [CMake] -- Found Ceres version: 2.0.0 installed in: C:/src/proj/out/build/x64-windows_vs/vcpkg_installed/x64-windows/share with components: [SchurSpecializations, Multithreading]

I'm having the same issue after deleting all VS build directories, vcpkg directory C:/Users/Me/vcpkg (and bootstraping it again then) and vcpkg cache directory (C:\Users\Me\AppData\Local\vcpkg).

I'm also having this from a command-line clean build (i.e. removing VS from the equation).

I'm bootstraping vcpkg from the latest master as of yesterday (Jan-27-2021).

JackBoosY commented 3 years ago

@strega-nil Can you please take a look?

Thanks.

strega-nil commented 3 years ago

@r-f-a this is an issue with manifests rn; it will be fixed as soon as #15474 is merged.

Since #15474 is merged, could you try and update the repo and see if it works?

r-f-a commented 3 years ago

Thanks for the response.

I git pulled the latest master and bootstrapped it.

After that I clean built my project using the json manifest from my first message but had the same outcome on both x64-Windows and x64-Linux.

strega-nil commented 3 years ago

@r-f-a could you run git rev-parse HEAD and vcpkg version, and give the output?

r-f-a commented 3 years ago

Sure.

> git rev-parse HEAD
5eea585548058540c3b73d087eb101c033b5fa85

> .\vcpkg.exe version
Vcpkg package management program version 2021-01-13-768d8f95c9e752603d2c5901c7a7c7fbdb08af35

See LICENSE.txt for license information.
strega-nil commented 3 years ago

Ohhh! I think I understand.

This is a serious bug in vcpkg, and @ras0219 is looking at it.

JonLiu1993 commented 2 years ago

@r-f-a, Could you test locally using the latest vcpkg to see if this has been fixed?