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

use CMAKE_INSTALL_LIBDIR to allow for library installation in multiarch contexts #87

Open
drew-parsons opened this issue Oct 26, 2023 · 1 comment

Comments

@drew-parsons
Copy link
Contributor

drew-parsons commented Oct 26, 2023

The scalapack library gets installed in /usr/lib (or /usr/lib64, if LIB_SUFFIX=64), defined in the SCALAPACK_install_library macro at

LIBRARY DESTINATION lib${LIB_SUFFIX}

Some systems provide a multiarch library installation, for instance installing amd64 libraries into /usr/lib/x86_64-linux-gnu rather than /usr/lib. This allows the same filesystem to be shared with multiple systems. Debian and Ubuntu, for instance, provide multiarch installations.

Cmake provides flexibility to manage both types of installation via the CMAKE_INSTALL_LIBDIR variable. This can be easily done for scalapack by replacing

    LIBRARY DESTINATION lib${LIB_SUFFIX}

with

    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}

In the "default" case CMAKE_INSTALL_LIBDIR is set to lib, so nothing would change, see https://cmake.org/cmake/help/latest/command/install.html#directory

Systems that need the multiarch location can get it by adding GNUInstallDirs

include(GNUInstallDirs)

Scalapack could perhaps add a configuration variable to choose whether to include it or not.

CMAKE_INSTALL_LIBDIR could then also be used instead of lib for the pkg-config and cmake file installations at ll.124,330,334 (perhaps the libdir variable at l.124 is redundant). It would also want to be applied to ARCHIVE at l.82.

If the multiarch (GNUInstallDirs) destination is activated then probably LIB_SUFFIX should be left empty. But that's a matter for the build configuration, LIB_SUFFIX handling in CMakeLists.txt would not need to be specifically changed.

An example of this kind of patch has been applied to the debian builds (2.2.1-3), build logs at https://buildd.debian.org/status/package.php?p=scalapack

@drew-parsons
Copy link
Contributor Author

I'd be interested also to hear from Redhat maintainers and Windows users what the impact would be of simply always having include(GNUInstallDirs). I suspect cmake is smart enough for it not to actually be a problem if it's always used.

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

1 participant