Skip to content

Toolchain incorrectly overwrites header search path variables set by modules #5039

@bedroge

Description

@bedroge

While building Clp-1.17.10-foss-2024a.eb in EESSI, we ran into an issue with finding the CoinUtils header files:
EESSI/software-layer#1294 (comment)

ClpDualRowDantzig.cpp:6:10: fatal error: CoinPragma.hpp: No such file or directory

This file is actually in EBROOTCOINUTILS/include/coin, and that directory should have been added to the relevant environment variable by the module file, see https://github.com/easybuilders/easybuild-easyconfigs/blob/develop/easybuild/easyconfigs/c/CoinUtils/CoinUtils-2.11.12-GCC-13.3.0.eb#L32.

In EESSI we use

module-search-path-headers               (E) = include_paths
search-path-cpp-headers                  (E) = include_paths

and when debugging it, I noticed that the module does indeed have:

prepend_path("CPLUS_INCLUDE_PATH", pathJoin(root, "include"))
prepend_path("CPLUS_INCLUDE_PATH", pathJoin(root, "include", "coin"))

But the interactive EB shell showed that the include/coin directory was not part of C[PLUS]_INCLUDE_PATH anymore during the configure/build step?!

I think the cause is very similar to what I wrote for a similar issue in EESSI/software-layer#1216, in particular this comment: EESSI/software-layer#1216 (comment).
In short, the module does provide the right information, but EB's toolchain.py overrides these environment variables (here: https://github.com/easybuilders/easybuild-framework/blob/easybuild-framework-v5.1.2/easybuild/tools/toolchain/toolchain.py#L1187). The values for C[PLUS]_INCLUDE_PATH are determined in https://github.com/easybuilders/easybuild-framework/blob/easybuild-framework-v5.1.2/easybuild/tools/toolchain/toolchain.py#L1159, and this seems to be hardcoded to include only for regular dependencies (toolchain components could have an extra_dirs), so it does not take any additional subdirs into account.

Previously, this probably wasn't an issue because of what I wrote in that aforementioned comment: older versions used CPATH from the module file, but CPPFLAGS in toolchain.py, so they wouldn't interfere with each other. Now they're both using C[PLUS]_INCLUDE_PATH, and they start overwriting each other's value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions