From 188491dd2b349d2dc7c0d40b9ee8d870228704f3 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 20 Jun 2025 18:48:09 +0100 Subject: [PATCH] suitesparse: Update after toolchain selection changes The toolchain selection changes mean CC is not set until after the recipe is parsed, breaking the manipulations made by this recipe. Replace it with code to inherit the cmake class, which correctly configures cmake to use the right compiler/compiler flags. We need to patch the makefiles to avoid those options being added incorrectly. Signed-off-by: Richard Purdie Signed-off-by: Khem Raj --- .../suitesparse/makefile-quoting.patch | 32 +++++++++++++++++++ .../suitesparse/suitesparse_5.10.1.bb | 17 +++------- 2 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch b/meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch new file mode 100644 index 0000000000..6bd2ffbb55 --- /dev/null +++ b/meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch @@ -0,0 +1,32 @@ +OE's CC and CXX contain spaces and extra options which is incompatible with +cmake way of handling them. Remove passing the compiler options this way in +favour of our normal cmake toolchain files added elsewhere. + +Upstream-Status: Pending + +Index: git/Makefile +=================================================================== +--- git.orig/Makefile ++++ git/Makefile +@@ -282,7 +282,7 @@ metis: include/metis.h + # hardcoded below. + include/metis.h: + ifeq (,$(MY_METIS_LIB)) +- - ( cd metis-5.1.0 && $(MAKE) config shared=1 prefix=$(SUITESPARSE) cc=$(CC) ) ++ - ( cd metis-5.1.0 && $(MAKE) config shared=1 prefix=$(SUITESPARSE) ) + - ( cd metis-5.1.0 && $(MAKE) ) + - ( cd metis-5.1.0 && $(MAKE) install ) + - $(SO_INSTALL_NAME) $(SUITESPARSE)/lib/libmetis.dylib \ +Index: git/SuiteSparse_config/SuiteSparse_config.mk +=================================================================== +--- git.orig/SuiteSparse_config/SuiteSparse_config.mk ++++ git/SuiteSparse_config/SuiteSparse_config.mk +@@ -146,7 +146,7 @@ SUITESPARSE_VERSION = 5.10.1 + endif + endif + +- CMAKE_OPTIONS += -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_C_COMPILER=$(CC) ++ #CMAKE_OPTIONS += -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_C_COMPILER=$(CC) + + #--------------------------------------------------------------------------- + # CFLAGS for the C/C++ compiler diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb index 13e6fd066c..29f114a9dc 100644 --- a/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb +++ b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb @@ -4,6 +4,7 @@ SRC_URI = "git://github.com/DrTimothyAldenDavis/SuiteSparse;protocol=https;branc file://0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch \ file://0002-Preserve-links-when-installing-libmetis.patch \ file://0003-Add-version-information-to-libmetis.patch \ + file://makefile-quoting.patch \ " SRCREV = "538273cfd53720a10e34a3d80d3779b607e1ac26" @@ -14,25 +15,17 @@ DEPENDS = "cmake-native lapack gmp mpfr chrpath-native" PROVIDES = "mongoose graphblas" RPROVIDES:${PN} = "mongoose graphblas" -# The values of $CC, $CXX, and $LD that Bitbake uses have spaces in them which -# causes problems when the SuiteSparse Makefiles try to pass these values on -# the command line. To get around this problem, set these variables to only the -# program name and prepend the rest of the value onto the corresponding FLAGS -# variable. -CFLAGS:prepend := "${@" ".join(d.getVar('CC').split()[1:])} " -export CC := "${@d.getVar('CC').split()[0]}" +inherit cmake -CXXFLAGS:prepend := "${@" ".join(d.getVar('CXX').split()[1:])} " -export CXX := "${@d.getVar('CXX').split()[0]}" - -LDFLAGS:prepend := "${@" ".join(d.getVar('LD').split()[1:])} " -export LD := "${@d.getVar('LD').split()[0]}" +B = "${S}" export CMAKE_OPTIONS = " \ -DCMAKE_INSTALL_PREFIX=${D}${prefix} \ -DCMAKE_INSTALL_LIBDIR=${baselib} \ " +OECMAKE_SOURCEPATH = "${S}/Mongoose ${S}/metis-5.1.0 ${S}/GraphBLAS" + do_compile () { oe_runmake library }