Skip to content

Commit

Permalink
Fix DYLD_LIBRARY_PATH for ARM64 macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleMayes committed Apr 3, 2024
1 parent 50d3619 commit a964c17
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
10 changes: 7 additions & 3 deletions dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/main.js.map

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,20 @@ export async function run(options: Options): Promise<void> {

core.addPath(bin);

const ld = process.env.LD_LIBRARY_PATH ?? "";
const dyld = process.env.DYLD_LIBRARY_PATH ?? "";

core.exportVariable("LLVM_PATH", options.directory);

const ld = process.env.LD_LIBRARY_PATH ?? "";
core.exportVariable("LD_LIBRARY_PATH", `${lib}${path.delimiter}${ld}`);
core.exportVariable("DYLD_LIBRARY_PATH", `${lib}${path.delimiter}${dyld}`);

// Ensure system libraries are first on ARM64 macOS to avoid issues with Apple's libc++ being weird.
// https://discourse.llvm.org/t/apples-libc-now-provides-std-type-descriptor-t-functionality-not-found-in-upstream-libc/73881/5
const dyld = process.env.DYLD_LIBRARY_PATH;
let dyldPrefix = "";
if (process.platform === "darwin" && process.arch === "arm64") {
dyldPrefix = `/usr/lib${path.delimiter}`;
}

core.exportVariable("DYLD_LIBRARY_PATH", `${dyldPrefix}${lib}${path.delimiter}${dyld}`);

if (options.env) {
core.exportVariable("CC", path.join(options.directory, "bin", "clang"));
Expand Down

0 comments on commit a964c17

Please sign in to comment.