Skip to content

Commit

Permalink
Merge pull request #8056 from jandubois/ld-library-path
Browse files Browse the repository at this point in the history
Don't change LD_LIBRARY_PATH when running as an AppImage
  • Loading branch information
jandubois authored Jan 9, 2025
2 parents 844ec1f + 0c348d0 commit 2503b4b
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions pkg/rancher-desktop/backend/lima.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,13 +752,24 @@ export default class LimaBackend extends events.EventEmitter implements VMBacken
const VMNETDir = path.join(VMNET_DIR, 'bin');
const pathList = (process.env.PATH || '').split(path.delimiter);
const newPath = [binDir, VMNETDir].concat(...pathList).filter(x => x);
const env = structuredClone(process.env);

env.LIMA_HOME = paths.lima;
env.PATH = newPath.join(path.delimiter);

// Override LD_LIBRARY_PATH to pick up the QEMU libraries.
// - on macOS, this is not used. The macOS dynamic linker uses DYLD_ prefixed variables.
// - on packaged (rpm/deb) builds, we do not ship this directory, so it does nothing.
// - for AppImage this has no effect because the libs are moved to a dir that is already on LD_LIBRARY_PATH
// - this only has an effect on builds extracted from a Linux zip file (which includes a bundled
// QEMU) to make sure QEMU dependencies are loaded from the bundled lib directory.
if (env.LD_LIBRARY_PATH) {
env.LD_LIBRARY_PATH = libDir + path.delimiter + env.LD_LIBRARY_PATH;
} else {
env.LD_LIBRARY_PATH = libDir;
}

// LD_LIBRARY_PATH is set for running from an extracted Linux zip file, that includes QEMU,
// to make sure QEMU dependencies are loaded from the bundled lib directory,
// LD_LIBRARY_PATH is ignored on macOS.
return {
...process.env, LIMA_HOME: paths.lima, LD_LIBRARY_PATH: libDir, PATH: newPath.join(path.delimiter),
};
return env;
}

protected static get qemuImgEnv() {
Expand Down

0 comments on commit 2503b4b

Please sign in to comment.