Skip to content

Ensure transitive dependencies for headers and libraries are always available#5143

Open
ocaisa wants to merge 9 commits intoeasybuilders:developfrom
ocaisa:search_paths_headers
Open

Ensure transitive dependencies for headers and libraries are always available#5143
ocaisa wants to merge 9 commits intoeasybuilders:developfrom
ocaisa:search_paths_headers

Conversation

@ocaisa
Copy link
Member

@ocaisa ocaisa commented Mar 9, 2026

This addresses #5124 but is quite a major change even if just a bugfix. I believe that this was probably the original intention when introducing the related options.

Requires additional tests (and probably debating) so leaving as a draft PR for now.

# and only use the configured option
# (our RPATH wrappers rely on LIBRARY_PATH so we need an exception for that)
if env_var != 'LIBRARY_PATH':
self.variables.append(env_var, '')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may seem quite aggressive, but it does seem to work in the cases I tried.

@ocaisa
Copy link
Member Author

ocaisa commented Mar 10, 2026

I think this is good enough for a review, it passes existing CI and also fixes #5143

@ocaisa ocaisa marked this pull request as ready for review March 10, 2026 11:46
if env_var != 'LIBRARY_PATH':
self.variables.setdefault(env_var, append_empty=True)
for var in SEARCH_PATH[search_path_var][self.search_path[search_path_var]]:
self.variables.append_subdirs(var, '', subdirs=paths_list)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks odd, but the methods available here are limited. My subdirs are full paths relative to ''

@akesandgren
Copy link
Contributor

Can't we just clear the relevant env variables at start of eb and then just load modules and "all will be fine"?

@ocaisa
Copy link
Member Author

ocaisa commented Mar 11, 2026

Sure, but that is not what we say we support with the option --search-path-cpp-headers. @lexming can correct me, but I thought the intention there was to exclusively use the indicated approach

@lexming
Copy link
Contributor

lexming commented Mar 12, 2026

When I worked on --search-path-cpp-headers I didn't change the behaviour of EB at build time in that regard. That option only introduces the possibility to set how those paths are injected in the build environment.

The default behaviour of EB (which has not changed in ages AFAIK):

  • manually inject search paths in direct dependencies with compiler/linker flags, so include folders are always passed with -I flags independently of what modules set
  • the build environment is not reset, any environment variables like CPATH and LIBRARY_PATH will be present in the build environment

Now, I have not yet looked in detail the code in this PR, but it is indeed probably the case that setting --search-path-cpp-headers to an environment variable (instead of flags) is resetting that variable instead of prepending to it.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants