Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SuiteSparse 6.0.0 is not found #919

Closed
thierry-FreeBSD opened this issue Nov 13, 2022 · 7 comments
Closed

SuiteSparse 6.0.0 is not found #919

thierry-FreeBSD opened this issue Nov 13, 2022 · 7 comments
Assignees
Labels
cmake CMake build related issues

Comments

@thierry-FreeBSD
Copy link

Trying to build ceres-solver 2.1.0 against SuiteSparse 6.0.0 disables the support of suitesparse:

-- Disabling use of Eigen as a sparse linear algebra library.
   This does not affect the covariance estimation algorithm 
   which can still use the EIGEN_SPARSE_QR algorithm.
-- Did not find CUDA library, disabling CUDA support.
-- Found LAPACK library: /usr/local/lib/libopenblas.so;/usr/local/lib/libopenblas.so
-- Found CHOLMOD headers in: /usr/local/include/suitesparse
-- Found CHOLMOD library: /usr/local/lib/libcholmod.so
-- Found SPQR headers in: /usr/local/include/suitesparse
-- Found SPQR library: /usr/local/lib/libspqr.so
-- Found Config headers in: /usr/local/include/suitesparse
-- Found Config library: /usr/local/lib/libsuitesparseconfig.so
-- Found AMD headers in: /usr/local/include/suitesparse
-- Found AMD library: /usr/local/lib/libamd.so
-- Found CAMD headers in: /usr/local/include/suitesparse
-- Found CAMD library: /usr/local/lib/libcamd.so
-- Found CCOLAMD headers in: /usr/local/include/suitesparse
-- Found CCOLAMD library: /usr/local/lib/libccolamd.so
-- Found COLAMD headers in: /usr/local/include/suitesparse
-- Found COLAMD library: /usr/local/lib/libcolamd.so
-- Did not find Intel TBB library, assuming SuiteSparseQR was not compiled with TBB.
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Adding librt to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
-- Found METIS: /usr/local/include (found version "5.1.0") 
-- Failed to find some/all required components of SuiteSparse.: Found unsuitable version "..", but required is at least "4.0" (found /usr/local/include/suitesparse, found components: CHOLMOD SPQR Config AMD CAMD CCOLAMD COLAMD)
-- Did not find all SuiteSparse dependencies, disabling SuiteSparse support.
-- Found CXSparse: /usr/local/include/suitesparse (found version "4.0.0") 
-- Found CXSparse version: 4.0.0, building with CXSparse.

@sandwichmaker
Copy link
Contributor

Suitesparse 6.0.0 was released with a new build system a few days ago. I suspect it has to do with that. @alexsmac and @sergiud can you guys take a look please?

@sergiud
Copy link
Contributor

sergiud commented Nov 13, 2022

The problem is only with version identification: SuiteSparse 6.0 delimits the version component name from its value by multiple spaces now.

Can you try replacing the space after each macro name by [ \t]+ here?

string(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION [0-9]+"
SuiteSparse_VERSION_MAJOR "${Config_CONTENTS}")
string(REGEX REPLACE "#define SUITESPARSE_MAIN_VERSION ([0-9]+)" "\\1"
SuiteSparse_VERSION_MAJOR "${SuiteSparse_VERSION_MAJOR}")
string(REGEX MATCH "#define SUITESPARSE_SUB_VERSION [0-9]+"
SuiteSparse_VERSION_MINOR "${Config_CONTENTS}")
string(REGEX REPLACE "#define SUITESPARSE_SUB_VERSION ([0-9]+)" "\\1"
SuiteSparse_VERSION_MINOR "${SuiteSparse_VERSION_MINOR}")
string(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION [0-9]+"
SuiteSparse_VERSION_PATCH "${Config_CONTENTS}")
string(REGEX REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
SuiteSparse_VERSION_PATCH "${SuiteSparse_VERSION_PATCH}")

Specifically #define SUITESPARSE_MAIN_VERSION[ \t]+[0-9]+ and so on.

@sergiud sergiud self-assigned this Nov 13, 2022
@sergiud sergiud added the cmake CMake build related issues label Nov 13, 2022
@thierry-FreeBSD
Copy link
Author

Indeed, with the attached patch, SuiteSparse 6.0.1
patch-cmake_FindSuiteSparse.cmake.txt
is well detected, and ceres-solver builds without error and with SuiteSparse enabled.

But note that with the latest versions, SuiteSparse installs its own cmake modules, and this file FindSuiteSparse.cmake is no more needed:

$ ls /usr/local/lib/cmake/SuiteSparse/*
/usr/local/lib/cmake/SuiteSparse/FindAMD.cmake                  /usr/local/lib/cmake/SuiteSparse/FindCHOLMOD.cmake              /usr/local/lib/cmake/SuiteSparse/FindKLU.cmake                  /usr/local/lib/cmake/SuiteSparse/FindSPQR_CUDA.cmake
/usr/local/lib/cmake/SuiteSparse/FindBTF.cmake                  /usr/local/lib/cmake/SuiteSparse/FindCOLAMD.cmake               /usr/local/lib/cmake/SuiteSparse/FindLDL.cmake                  /usr/local/lib/cmake/SuiteSparse/FindSPQR.cmake
/usr/local/lib/cmake/SuiteSparse/FindCAMD.cmake                 /usr/local/lib/cmake/SuiteSparse/FindCXSparse.cmake             /usr/local/lib/cmake/SuiteSparse/FindMongoose.cmake             /usr/local/lib/cmake/SuiteSparse/FindSuiteSparse_config.cmake
/usr/local/lib/cmake/SuiteSparse/FindCCOLAMD.cmake              /usr/local/lib/cmake/SuiteSparse/FindGraphBLAS.cmake            /usr/local/lib/cmake/SuiteSparse/FindRBio.cmake                 /usr/local/lib/cmake/SuiteSparse/FindUMFPACK.cmake
/usr/local/lib/cmake/SuiteSparse/FindCHOLMOD_CUDA.cmake         /usr/local/lib/cmake/SuiteSparse/FindKLU_CHOLMOD.cmake          /usr/local/lib/cmake/SuiteSparse/FindSPEX.cmake

@sergiud
Copy link
Contributor

sergiud commented Nov 14, 2022

Thanks for the feedback. FindSuiteSparse.cmake however is still very much needed for supporting older versions of SuiteSparse. Aside from that, I don't see any advantages of using those find modules over our implementation.

@thierry-FreeBSD
Copy link
Author

Follow-up: fixing ceres-solver is not sufficient, CeresConfig.cmake must also be fixed!

Trying to build openturns-1.19 fails with the following error:

-- Found CXSparse: /usr/local/include/suitesparse (found suitable version "4.0.0", minimum required is "4.0.0") 
CMake Error at /usr/local/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  find_package called with invalid argument "6."
Call Stack (most recent call first):
  /usr/local/lib/cmake/Ceres/CeresConfig.cmake:183 (find_dependency)
  CMakeLists.txt:362 (find_package)


-- Found required Ceres dependency: Eigen version 3.4.0 in /usr/local/share/eigen3/cmake
-- Found required Ceres dependency: glog
-- Found required Ceres dependency: gflags
-- Found Ceres version: 2.1.0 installed in: /usr/local with components: [LAPACK, SuiteSparse, SparseLinearAlgebraLibrary, CXSparse, SchurSpecializations, OpenMP, Multithreading]

@sergiud
Copy link
Contributor

sergiud commented Nov 16, 2022

Unfortunately, your patch is incorrect. Please see my CL which out for review.

@thierry-FreeBSD
Copy link
Author

Thanks, this patch is OK!

@keir keir closed this as completed in 352b320 Nov 18, 2022
netgate-git-updates pushed a commit to pfsense/FreeBSD-ports that referenced this issue Nov 27, 2022
Patch from upstream
<ceres-solver/ceres-solver#919>.

PR:		267746
Approved by:	yuri (maintainer)
Obtained from:	ceres-solver/ceres-solver#919
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake CMake build related issues
Projects
None yet
Development

No branches or pull requests

3 participants