-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Restore computation of include directories #10623
Restore computation of include directories #10623
Conversation
f428656
to
7e6e43c
Compare
09de4a0
to
93b1e87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that both |
I think
That being said, if dependents are split on how to refer to headers in See: |
that's too bad. But I don't think such issues should hold this PR. I would be inclined to consider them anomalies that one can discuss how to handle or maybe convince downstream package authors to do "proper" includes (i.e. |
@scheibelp Despite not being a recommended best practice, are you aware of packages that are using #include "libxml2/foo.h" ? It seems that libxml2's web-page advises to use what
If that's the case we can allow setting the |
No - in fact I think that's the issue (i.e. the fact that If that's true,
Right now, I don't think this PR handles the second goal; that wouldn't be a deal breaker, but I also don't see a clear path forward for handling the second goal. I wanted to check: do you think dependents should be responsible for calling |
No, I don't think so. My idea for now would be that @property
def headers(self):
# Compute the HeaderList in some way
hl = ...
hl.directories = [self.spec.prefix.include.libxml2]
return hl I was asking the question above because having a few dependencies that use I also think that separating concerns might make sense, but that requires more extensive modifications - at least a refactoring of |
Updated description at the top |
So to be clear (not that we have documented it anywhere) |
@scheibelp With 7c2e5c9 and 74852c4 we now have: $ spack-python
Spack version 0.12.1
Python 2.7.15rc1, Linux x86_64
>>> import spack.spec
>>> s = spack.spec.Spec('hwloc')
>>> s.concretize()
>>> s['libxml2'].headers.directories
['/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-8.2.0/libxml2-2.9.8-imjssszfoiodyeesuf5xpm5da5cl25vs/include/libxml2']
>>> s['libxml2'].headers.cpp_flags
'-I/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-8.2.0/libxml2-2.9.8-imjssszfoiodyeesuf5xpm5da5cl25vs/include/libxml2' Would that be enough? |
@michaelkuhn I thought you might be interested too in the latest commits that involve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple requests regarding names, and a minor request about simplifying some logic.
Also I'd like to make it slightly easier for users to override Package.headers
(the comment in libxml2
).
@scheibelp The comments should have been addressed. Let me know if there are other things to be fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple updates to requests.
HeaderList now overrides the 'directories' property in a way that is conforming to common C and C++ best practices.
Added unit tests to check the default behavior for packages and custom search behavior when header files are not under <prefix>/include
This property can be set to a directory, a sequence of directories or to None to restore the default behavior.
Also using better names for a few functions
987f0e3
to
1926d9e
Compare
@scheibelp Done |
Thanks! |
Fixes #10769 This updates the .headers property to include header subdirectories for Python and Eigen (as is recommended by these packages). #10623 updated the default behavior of .headers.directories to exclude subdirectories (since this can cause clashes with system headers). This broke some packages which depended on the old behavior of .headers.directories: for example if you had <package-prefix>/include/subdir/ex1.h, .headers.directories would include <package-prefix>/include/subdir.
This is likely caused by spack#10623. An alternative approach for the netcdf-fortran problem would be to extend the list of suffixes considered in `find_headers`.
This PR restores the computation of the include directories that was remove as part of the hotfix in #10604 It also adds the following modifications:
Remove the separate addition of
<prefix>/include
to the list of include dirsAdd unit tests to stress the behavior of
HeaderList.directories
Implement a way for packages to customize the include dirs injected into compiler wrappers (refers to blindly adding prefix.include in compiler wrappers can break Spack #8324 or
libxml2
- thanks to @scheibelp for the reference)