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

Install headers in a suitesparse subdirectory? #558

Closed
mmuetzel opened this issue Nov 30, 2023 · 11 comments
Closed

Install headers in a suitesparse subdirectory? #558

mmuetzel opened this issue Nov 30, 2023 · 11 comments

Comments

@mmuetzel
Copy link
Contributor

Motivated by build failures on macOS if old versions of SuiteSparse from Homebrew are installed when building SuiteSparse.
Copying a comment from another thread to avoid loosing this:

@DrTimothyAldenDavis: We can't do anything about older versions. But could the headers of the SuiteSparse libraries be installed in a sub-directory (e.g., /usr/local/include/suitesparse)?
Currently, there is the risk of headers from older libraries being picked up when the include path (e.g., /usr/local/include) gets added for other dependencies installed on the build system (e.g., OpenMP). That risk would be lower if the headers were installed in their own directory. CMake targets and pkg-config files would help dependent projects to find the correct folder with the headers.

Probably not something that should be changed for the current beta (or ever). But maybe for a later release?

@DrTimothyAldenDavis
Copy link
Owner

That would just delay the problem.

The cmake build system knows where all the latest files are; if it's building AMD, let's say, then it knows that the correct SuiteSparse_config.h is in ../SuiteSparse_config/SuiteSparse_config.h.

Directories scanned with -I take precedence over system directories, right? So we just need to make sure -ISuiteSparse_config/Include (for example) appears in all packages that use SuiteSparse_config. Doesn't that always happen?

@mmuetzel
Copy link
Contributor Author

mmuetzel commented Nov 30, 2023

Directories scanned with -I take precedence over system directories, right? So we just need to make sure -ISuiteSparse_config/Include (for example) appears in all packages that use SuiteSparse_config. Doesn't that always happen?

Those flags should be added for all libraries that use SuiteSparse_config currently. But they might be appearing after the -I flag for the other folder if the dependency for OpenMP is added earlier...

If the SuiteSparse headers hadn't been present in a folder that is shared with other (system) libraries, the order of the -I flags wouldn't matter.

We can try and control the order of the -I flags when building SuiteSparse. But if multiple versions of the headers are installed in different directories (like for @Fabian188) other projects that depend on SuiteSparse libraries could still get the wrong order of -I flags.
If the headers are at a location that isn't shared with other libraries, we could make sure that the order doesn't matter. (That is at least when the SuiteSparse headers disappeared from directories that are shared with the headers of other libraries.)

@mmuetzel
Copy link
Contributor Author

mmuetzel commented Dec 3, 2023

See #568 for a potential change that would move the headers of (most of) the SuiteSparse headers to their dedicated directory where they can't be confused when headers from other libraries need that a common directory is added to the preprocessor search path.

@DrTimothyAldenDavis
Copy link
Owner

This is working well so I'll stick with this: all the headers get installed by default into /usr/local/include/suitesparse.

@mmuetzel
Copy link
Contributor Author

mmuetzel commented Dec 4, 2023

To clarify: Only the headers of projects that use SUITESPARSE_INCLUDEDIR are installed in a include/suitesparse subdirectory.
GraphBLAS and LAGraph don't use that CMake variable (for compatibility with the upstream projects?) and their headers are installed directly in the include directory.

Please, let me know if they should also use the SUITESPARSE_*DIR variables and I can take a look at it...

@mmuetzel
Copy link
Contributor Author

mmuetzel commented Dec 4, 2023

Oops. They do...

I wonder why they don't install in the correct location then. Maybe, the SuiteSparsePolicy files got out of sync?

Edit: They install in include/suitesparse with the root CMakeLists.txt. But they install in include with the root Makefile.
So, it's most likely caused by different SuiteSparsePolicy modules...

@DrTimothyAldenDavis
Copy link
Owner

I just saw that a few hours ago that and updated them so each of the 3 Policy .cmake files are now the same.

Just now I saw your note about that so we might have both seen it and crossed in the ether.

I think it should be fixed now.

@DrTimothyAldenDavis
Copy link
Owner

I know it's a bit odd to have LAGraph depend on SuitesparsePolicy.cmake, since LAGraph is meant to be a stand alone library that can use other GraphBLAS library implementations.

But if it's integrated into SuiteSparse then I think that's ok.

@Fabian188
Copy link

This is working well so I'll stick with this: all the headers get installed by default into /usr/local/include/suitesparse.

How is this controlled? CMAKE_INSTALL_PREFIX/include/suitesparse ?

@DrTimothyAldenDavis
Copy link
Owner

That's the default if you do nothing. But you can also set

SUITESPARSE_INCLUDEDIR_POSTFIX
which defaults to suitesparse

The folder is CMAKE_INSTALL_PREFIX/include/SUITESPARSE_INCLUDEDIR_POSTFIX

so if you want to install directly into /usr/local/include, just set the SUITESPARSE_INCLUDEDIR_POSTFIX to the empty string.

@DrTimothyAldenDavis
Copy link
Owner

This is now fixed in SuiteSparse 7.4.0.beta1.

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

No branches or pull requests

3 participants