Skip to content

Commit d56ce93

Browse files
authored
Merge pull request #301 from lexming/cpath-opts
add documentation about new search path options in EasyBuild 5.0
2 parents 44b7408 + e24718d commit d56ce93

File tree

1 file changed

+107
-3
lines changed

1 file changed

+107
-3
lines changed

docs/easybuild-v5/enhancements.md

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,123 @@ See [separate dedicated section](../implementing-easyblocks.md#module_load_envir
117117

118118
## Provide control over how generated modules update search path for header files (via `--module-search-path-headers`) { : #module-search-path-headers }
119119

120-
*(more info soon)*
120+
EasyBuild 5.0 introduces a new option called `--module-search-path-headers`.
121+
This option can be used to select which environment variables will be injected
122+
in modules generated by EasyBuild to define search paths to C/C++ header files
123+
or Fortran MOD files, which are commonly found in `include` directories.
124+
125+
Available settings follow what is supported by current versions of C/C++ and
126+
Fortran compilers from GNU and Intel, which all support the
127+
[environment variables defined by GNU C Pre-Processor](https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html):
128+
129+
- `cpath` (default): This is the traditional mode of operation of EasyBuild.
130+
Module files generated by EasyBuild 5.0 continue to prepend search paths to
131+
headers to the `CPATH` environment variable by default. The `CPATH` environment
132+
variable has a high precedence, only surpassed by explicit `-I` options in the
133+
compilation command.
134+
135+
- `include_paths`: Module files generated by EasyBuild 5.0 will prepend search
136+
paths to headers to the environment variables `C_INCLUDE_PATH`,
137+
`CPLUS_INCLUDE_PATH` and `OBJC_INCLUDE_PATH`. These three environment variables
138+
have lower precedence than `CPATH` and the paths defined in the option
139+
`-isystem`. Therefore, this setting is useful for software providing include
140+
folders that could collide with those from other loaded modules.
141+
142+
This option is also available as easyconfig parameter
143+
`module_search_path_headers`. Which has precedence over the global
144+
`--module-search-path-headers` build option.
145+
146+
The Easyconfig parameter `modextrapaths` has a new special key called
147+
`MODULE_LOAD_ENV_HEADERS` that allows to add search paths in the generated
148+
module according to `--module-search-path-headers`.
149+
150+
```python
151+
modextrapaths = {
152+
MODULE_LOAD_ENV_HEADERS: 'include/extra_dir',
153+
}
154+
```
155+
156+
Adding search paths explicitly to `CPATH` or any other environment variable by
157+
name continues to work as usual in EasyBuild 5.0.
121158

122159
---
123160

124161
## Provide control over how EasyBuild specifies path to header files during installation (via `--search-path-cpp-headers`) { : #search-path-cpp-headers}
125162

126-
*(more info soon)*
163+
EasyBuild 5.0 introduces a new option called `--search-path-cpp-headers`
164+
that controls the method used at build time to pass search paths to `include`
165+
directories to the compiler.
166+
167+
Available settings follow what is supported by current versions of C/C++ and
168+
Fortran compilers from GNU and Intel, which all support the
169+
[environment variables defined by GNU C Pre-Processor](https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html):
170+
171+
- `flags` (default): EasyBuild sets the environment variable `CPPFLAGS` in the
172+
build environment with the list of paths to include directories as `-I`
173+
options. Passing search paths through `CPPFLAGS` has the highest precedence as
174+
[GNU Make](https://www.gnu.org/software/make/) will inject its contents
175+
directly in the preprocessor and compiler commands. Hence, this method
176+
minimizes the risk that the build process could be perturbed by the environment
177+
of the host system. This is the traditional mode of operation of EasyBuild.
178+
179+
- `cpath`: EasyBuild adds search paths to `include` directories to the
180+
environment variable `CPATH` in the build environment. This option has less
181+
precedence than the `-I` options injected by `flags`, but still has more
182+
precedence than any other option.
183+
184+
- `include_paths`: EasyBuild adds search paths to `include` directories to the
185+
environment variables `C_INCLUDE_PATH`, `CPLUS_INCLUDE_PATH` and
186+
`OBJC_INCLUDE_PATH` in the build environment. These three environment variables
187+
have lower precedence than the `-I` options or `CPATH`. Therefore, this setting
188+
is advisable for builds needing minor perturbations to their own build settings
189+
and those defined by the loaded modules.
190+
191+
Search paths added by EasyBuild at build time are independent to those that
192+
might be defined by the modules of loaded dependencies. EasyBuild will generate
193+
a new list of search paths from scratch to existing include directories in
194+
installations of loaded dependencies. This approach improves the resilience of
195+
the build by detaching the build process from modifications done by modules to
196+
the environment. Nonetheless, changes to the environment made by loaded modules
197+
still come into play, but with less precedence by default.
198+
199+
This option is also available as easyconfig parameter
200+
`search_path_cpp_headers`. Which has precedence over the global
201+
`--search-path-cpp-headers` build option.
127202

128203
---
129204

130205
## Provide control over how EasyBuild specifies path to libraries during installation (via `--search-path-linker`) { : #search-path-linker }
131206

132-
*(more info soon)*
207+
EasyBuild 5.0 introduces a new option called `--search-path-linker`
208+
that controls the method used at build time to pass search paths to libraries
209+
to the linker.
210+
211+
Available settings:
212+
213+
- `flags` (default): EasyBuild sets the environment variable `LDFLAGS` in the
214+
build environment with the list of search paths to libraries as `-L` options.
215+
Passing search paths through `LDFLAGS` has the highest precedence as
216+
[GNU Make](https://www.gnu.org/software/make/) will inject its contents
217+
directly in the linker and compiler commands. Hence, this method
218+
minimizes the risk that the build process could be perturbed by the environment
219+
of the host system. This is the traditional mode of operation of EasyBuild.
220+
221+
- `cpath`: EasyBuild adds search paths to libraries to the environment variable
222+
[LIBRARY_PATH](https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html#index-LIBRARY_005fPATH)
223+
in the build environment. This option has less precedence than the `-L` options
224+
injected by `flags`.
225+
226+
Search paths added by EasyBuild at build time are independent to those that
227+
might be defined by the modules of loaded dependencies. EasyBuild will generate
228+
a new list of search paths from scratch to existing library sub-directories in
229+
installations of loaded dependencies. This approach improves the resilience of
230+
the build by detaching the build process from modifications done by modules to
231+
the environment. Nonetheless, changes to the environment made by loaded modules
232+
still come into play, but with less precedence by default.
233+
234+
This option is also available as easyconfig parameter
235+
`search_path_linker`. Which has precedence over the global
236+
`--search-path-linker` build option.
133237

134238
---
135239

0 commit comments

Comments
 (0)