# eb-local.rpath ::::{zig:module} eb-local.rpath :file: src/rpath.zig :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/rpath.zig RPATH wrappers for compilers that have no build environment module. `eb-local dev` falls back to them when the loaded compiler family has no buildenv installed, so a program still records the library directory of every module it links against, as EasyBuild's own wrappers do, instead of linking without run paths and needing LD_LIBRARY_PATH. :::: ## Error sets ::::{zig:errorset} eb-local.rpath.Error :signature: pub const Error = error{ NoCacheDir, Unsafe } || sys.Error || Allocator.Error :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/rpath.zig#L208 `NoCacheDir` when the cache directory, `$XDG_CACHE_HOME`, else `$HOME/.cache`, is unset, empty or relative; `Unsafe` when the wrappers' directory is not one the caller owns, or a wrapper cannot be written. :::: ## Functions :::{zig:function} eb-local.rpath.cacheHome :signature: pub fn cacheHome(a: Allocator, env: *const std.process.Environ.Map) Error![]const u8 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/rpath.zig#L212 The effective user cache directory: absolute `$XDG_CACHE_HOME`, or absolute `$HOME/.cache` when XDG_CACHE_HOME is unset or empty. ::: :::{zig:function} eb-local.rpath.directory :signature: pub fn directory(a: Allocator, env: *const std.process.Environ.Map, found: []const []const u8) Error![]const u8 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/rpath.zig#L225 The directory for the wrappers of `found`: below the user's cache directory, named by the names it holds and the script it writes. ::: :::{zig:function} eb-local.rpath.present :signature: pub fn present(a: Allocator, path: []const u8) Allocator.Error![]const []const u8 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/rpath.zig#L238 The wrapped names on `path`, in `names` order. ::: :::{zig:function} eb-local.rpath.unwrapped :signature: pub fn unwrapped(a: Allocator, path: []const u8, among: []const []const u8) Allocator.Error![]const []const u8 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/rpath.zig#L256 The names among `among` that no wrapper covers on `path`: the first of each name is neither one of eb-local's wrappers nor one of EasyBuild's, which it writes as `rpath_wrappers/NAME_wrapper/NAME`. ::: :::{zig:function} eb-local.rpath.write :signature: pub fn write(a: Allocator, dir: []const u8, found: []const []const u8) Error!void :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/rpath.zig#L277 Write the wrappers for `found` into `dir`, a directory the caller owns and no one else can write; existing wrappers with the same bytes stay. ::: ## Constants :::{zig:constant} eb-local.rpath.names :signature: pub const names = ... :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/rpath.zig#L18 The commands wrapped when they are on PATH: compiler drivers, then linkers. MPI wrappers call these by name, so they are covered too. ::: :::{zig:constant} eb-local.rpath.self_linking :signature: pub const self_linking = ... :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/rpath.zig#L28 The compilers that find their linker themselves, so a wrapped `ld` on PATH never sees their links, and the linker of theirs that EasyBuild's GCC build environment does not wrap. A program they link has run paths only when they are wrapped themselves. ::: :::{zig:constant} eb-local.rpath.marker :signature: pub const marker = ".eb-local-rpath" :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/rpath.zig#L32 A directory holding this file is skipped when a wrapper looks for the command it stands in for, so wrappers never call each other. ::: :::{zig:constant} eb-local.rpath.script :signature: pub const script = ... :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/rpath.zig#L51 One script for every name: it runs the next command of its own name on PATH. An empty entry is the current directory, including the one a trailing colon names, as execvp searches. When that command links, it adds a run path for each absolute library directory named with -L or by the absolute path of an existing `lib*.so` file, and for a compiler driver for each LIBRARY_PATH entry, which EESSI's modules set and the driver passes to the linker; system and compatibility-layer directories are left out, as the loader finds those itself, and so are stub directories (`stubs/lib64` of a CUDA toolkit): a stub is for the link only, and one on the run path is loaded in place of the driver's library. Other `.so` names are commonly runtime-loaded plugins, not link inputs that create a DT_NEEDED entry, so they are not inferred here. The arguments of a response file, @FILE, count as arguments of the command: Meson and CMake put a long link line in one. --disable-new-dtags writes RPATH rather than RUNPATH, so LD_LIBRARY_PATH cannot override it, as in EasyBuild. :::