eb-local.rpath

module eb-local.rpath  src/rpath.zig[source][autodoc]

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

pub const Error = error{ NoCacheDir, Unsafe } || sys.Error || Allocator.Error[source][autodoc]

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

pub fn cacheHome(a: Allocator, env: *const std.process.Environ.Map) Error![]const u8[source][autodoc]

The effective user cache directory: absolute $XDG_CACHE_HOME, or absolute $HOME/.cache when XDG_CACHE_HOME is unset or empty.

pub fn directory(a: Allocator, env: *const std.process.Environ.Map, found: []const []const u8) Error![]const u8[source][autodoc]

The directory for the wrappers of found: below the user’s cache directory, named by the names it holds and the script it writes.

pub fn present(a: Allocator, path: []const u8) Allocator.Error![]const []const u8[source][autodoc]

The wrapped names on path, in names order.

pub fn unwrapped(a: Allocator, path: []const u8, among: []const []const u8) Allocator.Error![]const []const u8[source][autodoc]

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.

pub fn write(a: Allocator, dir: []const u8, found: []const []const u8) Error!void[source][autodoc]

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

pub const names = ...[source][autodoc]

The commands wrapped when they are on PATH: compiler drivers, then linkers. MPI wrappers call these by name, so they are covered too.

pub const self_linking = ...[source][autodoc]

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.

pub const marker = ".eb-local-rpath"[source][autodoc]

A directory holding this file is skipped when a wrapper looks for the command it stands in for, so wrappers never call each other.

pub const script = ...[source][autodoc]

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.