You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/using_eessi/building_on_eessi.md
+44-4
Original file line number
Diff line number
Diff line change
@@ -108,10 +108,50 @@ $ module av netcdf4-python/1.6.5-foss-2023b
108
108
netcdf4-python/1.6.5-foss-2023b
109
109
```
110
110
111
-
112
111
This means you'll _always_ need to load the `EESSI-extend` module if you want to use these modules (also, and particularly when you want to use them in a job script).
113
112
114
-
## Manually building software op top of EESSI
115
-
Building software on top of EESSI would require your linker to use the same system-dependencies as the software in EESSI does. In other words: it requires you to link against libraries from the compatibility layer, instead of from your host OS.
113
+
## Manually building software op top of EESSI (without EasyBuild)
114
+
115
+
!!! warning
116
+
117
+
We are working on a module file that should make building on top of EESSI (without using EasyBuild)
118
+
more straightforward, particularly when using `Autotools` or `CMake`. Right now, it is a little convoluted
119
+
and requires you to have a decent grasp of
120
+
* What a runtime dynamic linker (`ld-linux*.so`) is and does
121
+
* How to influence the behaviour of the runtime linker with `LD_LIBRARY_PATH`
122
+
* The difference between `LIBRARY_PATH` and `LD_LIBRARY_PATH`
123
+
124
+
As such, this documentation is intended for "experts" in the runtime linker and it's behaviour,
125
+
and most cases are untested. Any feedback on this topic is highly appreciated.
126
+
127
+
Building and running software on top of EESSI without EasyBuild is not straightforward and requires some considerations to take care of.
128
+
129
+
It is expected that you will have loaded all of your required dependencies as modules from the EESSI environment. Since EESSI sets
130
+
`LIBRARY_PATH` for all of the modules and the `GCC` compiler is configured to use the compat layer, there should be no additional configuration
131
+
required to execute a standard build process. On the other hand, EESSI does not set `LD_LIBRARY_PATH` so, _at runtime_, the executable will need help
132
+
finding the libraries that it needs to actually execute. The easiest way to circumvent this requirement is by setting the environment variable `LD_RUN_PATH`
133
+
during compile time as well. With `LD_RUN_PATH` set, the program will be able to tell the dynamic linker to search in those paths when the program is being
134
+
executed.
135
+
136
+
EESSI uses a [compatibility layer](../compatibility_layer.md) to ensure that it takes as few libraries from the host as possible. The safest way to make sure
137
+
all libraries will point to the required locations in the compatibility layer (and do not leak in from the host operating system) is starting an EESSI prefix
138
+
shell before building. To do this:
139
+
140
+
* First of all, load the environment by starting an EESSI shell as described [here](https://www.eessi.io/docs/using_eessi/setting_up_environment).
141
+
* Load all dependencies you need to build your software. You must use at least a toolchain from EESSI to compile it (`foss` is a good option as it will also
142
+
include MPI with OpenMPI and math libraries via FlexiBLAS/FFTW).
143
+
* Set manually `LD_RUN_PATH` to resolve libraries at runtime. `LIBRARY_PATH` should contain all the paths we need, and we also need to include the path to
144
+
`libstdc++` from our GCC installation to avoid picking up the one from the host:
* Compile and make sure the library resolution points to the EESSI stack. For this, `ldd` from compatibility layer and **not**`/usr/bin/ldd` should be used
149
+
when checking the binary.
150
+
151
+
* Run!
152
+
153
+
154
+
!!! Note RPATH should never point to a compatibility layer directory, only to software layer ones, as all resolving is done via the runtime linker (`ld-linux*.so`) that is shipped with EESSI, which automatically searches these locations.
155
+
156
+
The biggest downside of this approach is that your executable becomes bound to the architecture you linked your libraries for, i.e., if you add to your executable RPATH a `libhdf5.so`compiled for `intel_avx512`, you will not be able to run that binary on a machine with a different architecture. If this is an issue for you, you should look into how EESSI itself organises the location of binaries and perhaps leverage the relevant environment variables (e.g., `EESSI_SOFTWARE_SUBDIR`).
116
157
117
-
While we plan to support this in the future, manually building on top of EESSI is currently not supported yet in a trivial way.
0 commit comments