Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix link errors on macOS Big Sur #3686

Merged
merged 2 commits into from
Dec 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .release-notes/3686.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Fix link errors on macOS Big Sur

With the change from Catalina to Big Sur, Apple moved the location of the System library, which broke the linking phase of the compiler. This change fixes the problem by specifying the absolute path of the System library.
5 changes: 3 additions & 2 deletions src/libponyc/codegen/genexe.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,15 @@ static bool link_exe(compile_t* c, ast_t* program,
"";
#endif

size_t ld_len = 128 + arch_len + strlen(linker) + strlen(file_exe) +
size_t ld_len = 256 + arch_len + strlen(linker) + strlen(file_exe) +
strlen(file_o) + strlen(lib_args) + strlen(sanitizer_arg);

char* ld_cmd = (char*)ponyint_pool_alloc_size(ld_len);

snprintf(ld_cmd, ld_len,
"%s -execute -no_pie -arch %.*s "
"-macosx_version_min 10.12 -o %s %s %s %s -lSystem %s",
"-macosx_version_min 10.12 -o %s %s %s %s "
"-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem %s",
linker, (int)arch_len, c->opt->triple, file_exe, file_o,
lib_args, ponyrt, sanitizer_arg
);
Expand Down