Skip to content

GraphBLAS: escape double quotes in GB_C_LINK_FLAGS - #1076

Open
elvisdukaj wants to merge 1 commit into
DrTimothyAldenDavis:dev2from
elvisdukaj:graphblas-escape-jit-link-flags
Open

elvisdukaj wants to merge 1 commit into
DrTimothyAldenDavis:dev2from
elvisdukaj:graphblas-escape-jit-link-flags

Conversation

@elvisdukaj

@elvisdukaj elvisdukaj commented Nov 25, 2026 •

Copy link
Copy Markdown

Problem

SuiteSparse:GraphBLAS fails to build when CMAKE_SHARED_LINKER_FLAGS contains double quotes, which happens with Conan environments, e.g. -Wl,-rpath-link="/path/to/conan/lib". The flags are substituted into a C string literal in the generated Config/GB_config.h:

#define GB_C_LINK_FLAGS "@GB_C_LINK_FLAGS@"

so unescaped quotes terminate the string literal and the build fails:

GB_config.h:29:49: error: 'tmp' undeclared (first use in this function)
   29 | #define GB_C_LINK_FLAGS "-m64 -Wl,-rpath-link="/tmp/.../lib" -shared "

Full failing build log (conan-center-index): https://build-logs.conan.io/cci/prod/PR-31385/4/0cd9a6530dcb540c//build_log_suitesparse_7_14_1_f17cf177a6b480c128be2bc4448ae6ca_402caf650e8a701de50d3a8cea803ac4ab20f7f3.txt

Root cause

GraphBLAS/cmake_modules/GraphBLAS_JIT_configure.cmake already escapes double quotes in GB_C_FLAGS:

string ( REPLACE "\"" "\\\"" GB_C_FLAGS ${GB_C_FLAGS} )

but the same escaping is missing for GB_C_LINK_FLAGS, which is substituted into GB_config.h the same way.

Fix

Apply the identical escaping to GB_C_LINK_FLAGS:

string ( REPLACE "\"" "\\\"" GB_C_LINK_FLAGS "${GB_C_LINK_FLAGS}" )

Testing

Verified that with a linker flag containing quotes (-Wl,-rpath-link="/tmp/conan/p/openmp/lib"), the generated #define GB_C_LINK_FLAGS "..." line is now a valid C string literal (compiles cleanly).

I am trying to create the conan package for this library but it fails to
build on the conan center index.

The issue is the following:

/tmp/workspace/cci_prod_PR-31385/conan-home/p/b/suite69965dfdc1a7b/b/GraphBLAS/Source/jitifyer/GB_jitifyer.c:
In function 'GB_jitifyer_init':
/tmp/workspace/cci_prod_PR-31385/conan-home/p/b/suite69965dfdc1a7b/b/GraphBLAS/Config/GB_config.h:29:49:
error: 'tmp' undeclared (first use in this function)
   29 | #define GB_C_LINK_FLAGS "-m64
-Wl,-rpath-link="/tmp/workspace/cci_prod_PR-31385/conan-home/p/openbb37405d51ba66/p/lib"
-Wl,-rpath-link="/tmp/workspace/cci_prod_PR-31385/conan-home/p/mpfrea3a4336e4ebc/p/lib"
-Wl,-rpath-link="/tmp/workspace/cci_prod_PR-31385/conan-home/p/gmpe3bcaf50ea0b5/p/lib"
-shared "
      |                                                 ^~~
/tmp/workspace/cci_prod_PR-31385/conan-home/p/b/suite69965dfdc1a7b/b/GraphBLAS/Source/jitifyer/GB_jitifyer.c:197:32:
note: in definition of macro 'GB_COPY_STUFF'
  197 |     uint64_t memsize = strlen (src) ;                   \
      |                                ^~~
/tmp/workspace/cci_prod_PR-31385/conan-home/p/b/suite69965dfdc1a7b/b/GraphBLAS/Source/jitifyer/GB_jitifyer.c:364:41:
note: in expansion of macro 'GB_C_LINK_FLAGS'
  364 |     GB_COPY_STUFF (GB_jit_C_link_flags, GB_C_LINK_FLAGS) ;

Full logs:
https://build-logs.conan.io/cci/prod/PR-31385/4/0cd9a6530dcb540c//build_log_suitesparse_7_14_1_f17cf177a6b480c128be2bc4448ae6ca_402caf650e8a701de50d3a8cea803ac4ab20f7f3.txt
@DrTimothyAldenDavis

Copy link
Copy Markdown
Owner

Thanks for the update. Can you email me a signed contributor agreement, to me at davis@tamu.edu?

@elvisdukaj

Copy link
Copy Markdown
Author

Thanks for the update. Can you email me a signed contributor agreement, to me at davis@tamu.edu?

Done, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants