From 393d1617eb2dc95de6da5225df623ae42121d6b1 Mon Sep 17 00:00:00 2001 From: Ayoub Benaissa Date: Thu, 25 Aug 2022 13:39:10 +0100 Subject: [PATCH] fix: add linking options for MacOS Starting from Mac 11 (Big Sur), it appears we need to add -L /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem for the sharedlib to link properly.i --- compiler/lib/Support/CompilerEngine.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/lib/Support/CompilerEngine.cpp b/compiler/lib/Support/CompilerEngine.cpp index 05932255e..8da318f3d 100644 --- a/compiler/lib/Support/CompilerEngine.cpp +++ b/compiler/lib/Support/CompilerEngine.cpp @@ -521,9 +521,13 @@ const std::string CompilerEngine::Library::LINKER = "ld"; // We need to tell the linker that some symbols will be missing during linking, // this symbols should be available during runtime however. This is the case // when JIT compiling, the JIT should either link to the runtime library that -// has the missing symbols, or it would have been loaded even prior to that +// has the missing symbols, or it would have been loaded even prior to that. +// Starting from Mac 11 (Big Sur), it appears we need to add -L +// /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem for the +// sharedlib to link properly. const std::string CompilerEngine::Library::LINKER_SHARED_OPT = - " -dylib -undefined dynamic_lookup -o "; + " -dylib -undefined dynamic_lookup -L " + "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem -o "; const std::string CompilerEngine::Library::DOT_SHARED_LIB_EXT = ".dylib"; #else // Linux const std::string CompilerEngine::Library::LINKER_SHARED_OPT = " --shared -o ";