Skip to content

take into account location of header files of dependencies in toolchain method that defines search path for header files in build environment#5041

Merged
bedroge merged 1 commit intoeasybuilders:developfrom
boegel:fix_toolchain_add_dependency_cpp_headers
Nov 13, 2025
Merged

take into account location of header files of dependencies in toolchain method that defines search path for header files in build environment#5041
bedroge merged 1 commit intoeasybuilders:developfrom
boegel:fix_toolchain_add_dependency_cpp_headers

Conversation

@boegel
Copy link
Member

@boegel boegel commented Nov 12, 2025

fixes #5039, follow-up for #5023 which was a step in the right direction but incomplete

The _add_dependency_cpp_headers method of Toolchain only consider include as subdirectory for dependencies, but in some cases additional subdirectories must be taken into account for finder header files.
We can determine the correct list of subdirectories based on the $CPATH, and $C_INCLUDE_PATH & friends environment variables that get set when the modules for the (build) dependencies get loaded.

This fix is only relevant when EasyBuild is configured with --search-path-cpp-headers to something else than (the default) flags, since then $CPPFLAGS is defined in toolchain build environment and the $CPATH or $C_INCLUDE_PATH set by dependency modules is not overwritten).

@boegel boegel added this to the next release (5.2.0?) milestone Nov 12, 2025
@boegel boegel requested a review from bedroge November 12, 2025 15:28
@boegel boegel added bug fix EESSI Related to EESSI project labels Nov 12, 2025
…d that defines search path for header files in build environment
@boegel boegel force-pushed the fix_toolchain_add_dependency_cpp_headers branch from 23d0d7a to 5b33aed Compare November 12, 2025 16:17
@boegel boegel changed the title take into location of header files of dependencies in toolchain method that defines search path for header files in build environment take into account location of header files of dependencies in toolchain method that defines search path for header files in build environment Nov 12, 2025
Copy link
Contributor

@bedroge bedroge left a comment

Choose a reason for hiding this comment

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

Lgtm!

Tested this with the examples from #5039 (comment) and various (module) search path configurations, and it works fine in all situations! 🎉

As an example, $CPPFLAGS is now correctly set to:

== 2025-11-12 20:05:56,552 environment.py:95 INFO Environment variable CPPFLAGS set to -I/data/apps/software/foo/1.0-GCC-13.3.0/include/foo -I/data/apps/software/foo/1.0-GCC-13.3.0/include (previously undefined)

And when using include_paths:

== 2025-11-13 11:06:38,118 environment.py:95 INFO Environment variable C_INCLUDE_PATH set to /data/apps/software/foo/1.0-GCC-13.3.0/include/foo:/data/apps/software/foo/1.0-GCC-13.3.0/i
nclude (previous value: '/data/apps/software/foo/1.0-GCC-13.3.0/include/foo:/data/apps/software/foo/1.0-GCC-13.3.0/include')

(it used to only include ..../include, and not ..../include/foo).

@bedroge bedroge merged commit f60db75 into easybuilders:develop Nov 13, 2025
50 of 51 checks passed
@boegel boegel deleted the fix_toolchain_add_dependency_cpp_headers branch November 13, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix EESSI Related to EESSI project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toolchain incorrectly overwrites header search path variables set by modules

2 participants