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

Fix paths for Ubuntu 16.04+ and Debian 9 #18

Merged
merged 1 commit into from
Apr 21, 2018
Merged

Conversation

mdave
Copy link
Contributor

@mdave mdave commented Jan 31, 2017

This is another approach that I've adopted to fix issue #16, but different in style to pull request #17 so might serve as an alternative choice. Gotta say these packages are a bit of a pain to use from a CMake perspective, but this is the least intrusive solution I could come up with.

The issue is that newer Ubuntu and Debian packages construct libraries that install into locations of the form: /usr/lib/petscdir/VERSION/ARCH/lib/libpetsc_ARCH.so. Following the usual Debian guidelines, these (and header includes) are then symlinked into places such as /usr/lib/libpetsc.so and friends, depending on the real/complex architecture choice selected in update-alternatives. This means that defining PETSC_DIR and PETSC_ARCH no longer works on these distributions, since the CMake configuration cannot find the libpetsc_ARCH.so library.

The solution I have used here is to instead direct CMake to look inside /usr/lib/petsc first, which in these newer distributions is a symlink to the petscdir/VERSION/ARCH that has been selected by the user in update-alternatives. This has the advantage of no longer needing to look in hard-coded version-specific locations or hack around with PETSC_ARCH, and from the command line the library is detected automatically without manually specifying paths. However, the disadvantage is that we now need to additionally look for libpetsc_real.so and libpetsc_complex.so. Right now no other distributions use these alternative names, as far as I know, but I guess this could potentially be a cause for concern longer-term.

@mdave
Copy link
Contributor Author

mdave commented Jan 31, 2017

And just to clarify: when I say the packages are a pain, I mean the Debian distribution and not your CMake configuration 😄

@jedbrown jedbrown merged commit 18c0329 into jedbrown:master Apr 21, 2018
jedbrown added a commit that referenced this pull request Apr 21, 2018
* 'master' of github:mdave/cmake-modules:
  Fix paths for Ubuntu 16.04+ and Debian 9
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