From 26cb5f89f4d4bc601d831c3a9286cf76d0b850f3 Mon Sep 17 00:00:00 2001 From: JGZYES Date: Sun, 6 Sep 2026 15:59:29 +0800 Subject: [PATCH] feat: auto-add ~/.pmm/root/lib to LD_LIBRARY_PATH on install pmm now writes 'export LD_LIBRARY_PATH=$HOME/.pmm/root/lib:...:$LD_LIBRARY_PATH' to ~/.bashrc (like it already does for PATH), so a shared library installed by pmm (via a .pdm's lib/ dir) is found at runtime without manually exporting it. Takes effect in new shells (or after 'source ~/.bashrc'). --- src/pmm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pmm.c b/src/pmm.c index b2cc258..425a36b 100644 --- a/src/pmm.c +++ b/src/pmm.c @@ -435,6 +435,14 @@ void pmm_add_to_path(void) { if (f) { fprintf(f, "\n# PMM PATH\n"); for (int i = 0; i < n; i++) if (list[i][0]) fprintf(f, "export PATH=\"%s:$PATH\"\n", list[i]); + /* Shared libraries installed by PMM live under /root/lib; + * make them findable by dynamically-linked tools automatically. */ + fprintf(f, "\n# PMM shared library path\n"); + if (pmm_flat_mode()) + fprintf(f, "export LD_LIBRARY_PATH=\"%s/lib:%LD_LIBRARY_PATH\"\n", home); + else + fprintf(f, "export LD_LIBRARY_PATH=\"%s/root/lib:%s/root/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH\"\n", + home, home); fclose(f); } (void)she;