Repository navigation
Conversation
4 tasks done
predat
force-pushed
the
fix/suitesparse-lapack-build
branch
2 times, most recently
from
October 9, 2026 08:38
0dc805b to
9a2d293
Compare
A condition passed as a single quoted string, e.g. IF "NOT APPLE", reached if() as one element and was evaluated as the name of an undefined variable, so it was always false and the ELSE value was used. As a result AV_BUILD_LAPACK, AV_BUILD_SUITESPARSE and ALICEVISION_REQUIRE_CERES_WITH_SUITESPARSE, all declared with IF "NOT APPLE", were OFF on Linux, and Ceres was silently built without SuiteSparse nor LAPACK. Split single-element conditions into separate arguments. Conditions given as several arguments are left untouched, so quoted values inside them keep their spaces.
LAPACK_CMAKE_FLAGS was a single string holding both -D options, so CMake-based consumers (Ceres, AliceVision) received BLAS_LIBRARIES="<libblas> -DLAPACK_LIBRARIES=<liblapack>". Make it a proper list, and join it with spaces only for the CMAKE_OPTIONS variable of SuiteSparse's Makefile.
SuiteSparse 7.x enables CUDA by default (SUITESPARSE_USE_CUDA=ON) and compiles it for every architecture (SUITESPARSE_CUDA_ARCHITECTURES=all), which now that SuiteSparse is actually built greatly increases build time and binary size. The ENABLE_CUDA option passed so far is not a SuiteSparse 7.x option and had no effect. The CUDA code is never used: CHOLMOD only offloads to the GPU through its 64-bit integer interface (cholmod_l_*), while Ceres, the only consumer of SuiteSparse in AliceVision, uses the 32-bit one.
predat
force-pushed
the
fix/suitesparse-lapack-build
branch
from
October 9, 2026 08:44
9a2d293 to
9c976a5
Compare
gmplib.org throttles or rejects automated downloads; ftp.gnu.org serves the same archive (same MD5) and already hosts MPFR. GMP is only built with SuiteSparse, which this branch makes actually build on Linux.
When BLAS_LIBRARIES is given, SuiteSparse 7.x also requires BLA_VENDOR to know which BLAS it is; without it, SuiteSparse__blas_threading.cmake fails on an empty ${BLA_VENDOR}. Pass BLA_VENDOR=Generic, the value for the reference BLAS, along with the BLAS/LAPACK paths. When they are not given, SuiteSparse still detects the system BLAS and sets BLA_VENDOR itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When building the dependencies on Linux, LAPACK/BLAS and SuiteSparse were never built, so Ceres ended up configured with
CERES_NO_SUITESPARSEandCERES_NO_LAPACKand the sparse bundle adjustment silently fell back toEIGEN_SPARSE.Root cause:
av_conditional_option(... IF "NOT APPLE" ...)receives the quoted condition as a single list element, soif(${_co_IF})evaluates an undefined variable literally namedNOT APPLEand always takes theELSEbranch. This affectsAV_BUILD_LAPACK,AV_BUILD_SUITESPARSEandALICEVISION_REQUIRE_CERES_WITH_SUITESPARSE. That last one is why the AliceVision build did not fail when Ceres had no SuiteSparse support.Once these dependencies are actually built, two more issues show up. This PR fixes them too.
Features list
av_conditional_optionnow evaluates a condition given as a single quoted string (e.g.IF "NOT APPLE") by splitting it into separate arguments. Multi-element conditions are left untouched, so quoted values inside them (e.g.IF X STREQUAL "a b") keep their spaces. The call sites are unchanged.LAPACK_CMAKE_FLAGSis now a proper list. It used to be a single string, so Ceres/AliceVision receivedBLAS_LIBRARIES="<libblas> -DLAPACK_LIBRARIES=<liblapack>". It is joined with spaces only for theCMAKE_OPTIONSvariable of SuiteSparse's Makefile.SUITESPARSE_USE_CUDA=OFF. SuiteSparse 7.x enables CUDA by default for all architectures, which greatly increases build time and size. TheENABLE_CUDAoption passed so far does not exist in 7.x. The CUDA code is never reached anyway: CHOLMOD only offloads to the GPU through its 64-bit interface (cholmod_l_*), while Ceres, the only SuiteSparse consumer here, uses the 32-bit one.BLA_VENDOR=Genericto SuiteSparse along with the reference BLAS/LAPACK paths. Since SuiteSparse 7.x (7.14 in [deps] Update dependency versions and reduce CUDA architectures #2199), givingBLAS_LIBRARIESalso requiresBLA_VENDOR; without it,SuiteSparse__blas_threading.cmakefails on an empty${BLA_VENDOR}. SuiteSparse 7.3.0, the version ondevelop, does not need it but accepts it. When no BLAS/LAPACK paths are given, SuiteSparse still detects the system BLAS itself.ftp.gnu.orginstead ofgmplib.org, which throttles or rejects automated downloads. It is the same archive (same MD5), and MPFR is already downloaded from there.Implementation remarks
av_conditional_optionon Linux:IF "NOT APPLE"andIF "VAR AND NOT APPLE"now give ON (both gave OFF before);IF NOT APPLE,IF VAR,IF APPLEandIF X STREQUAL "a b"give the same result as before.av_conditional_optioncalls now evaluate as expected:AV_BUILD_LAPACK,AV_BUILD_SUITESPARSEandALICEVISION_REQUIRE_CERES_WITH_SUITESPARSEare ON,AV_BUILD_OPENMPstays OFF.ExternalProject, Ceres receivesBLAS_LIBRARIESandLAPACK_LIBRARIESas two separate variables.makereceives a singleCMAKE_OPTIONS=...argument.CERES_NO_SUITESPARSEandCERES_NO_LAPACKmust no longer be defined ininclude/ceres/internal/config.h.🤖 Generated with Claude Code