-
-
Notifications
You must be signed in to change notification settings - Fork 416
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 compiling Pony programs on X86 MacOS when XCode 15 is the linker #4466
Conversation
73805cb
to
95164d1
Compare
@jemc is looking into testing this with XCode 15. |
I haven't been able to reproduce the Sonoma / XCode 15 problem in ticket #4454 - the However, I also tested with the change from this branch, and it produces a lot of warnings during linking of the Pony program:
|
same warnings as above, and |
@jemc can you help me try to figure out the proper flags to compile the runtime with so that it is for 13.0.0 and not for "whatever this version of the OS" is? That will get rid of the warnings. So that what we sent at pony program link time matches with what we set and compilation time. I think ideally we want this to be a define that gets set and we can easily keep that up to date with what we use when we link via a define. So the "13.0.0" that is in our linking code is set to whatever the define was at the time the compiler and runtime were built. For the cmake bits, I think we will probably lean on @chalcolith. I believe we want to use https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html at the time that we are building the runtime and then use the same version for linking. I suggest setting to 13.0.0 for now. For the sake of "libponyc-standalone" i think we should compile everything in src with the deployment option rather than just the libponyrt directory. |
As you suspected, adding this snippet to the
However, there is still a similar warning for the user program object (in this case it was the
I'm still trying to work out how we can set up the LLVM |
Ah so 3 places. We definitely want a define to keep those straight and not garbled. |
Here are the three (in total) places that we need to set the version (see the diff --git a/src/libponyc/codegen/codegen.c b/src/libponyc/codegen/codegen.c
index c79df120..9a903670 100644
--- a/src/libponyc/codegen/codegen.c
+++ b/src/libponyc/codegen/codegen.c
@@ -818,9 +818,10 @@ bool codegen_pass_init(pass_opt_t* opt)
{
triple = LLVMCreateMessage(opt->triple);
} else {
-#if defined(PLATFORM_IS_MACOSX) && !defined(PLATFORM_IS_ARM)
- // This is to prevent XCode 7+ from claiming OSX 14.5 is required.
- triple = LLVMCreateMessage("x86_64-apple-macosx");
+#if defined(PLATFORM_IS_MACOSX) && defined(PLATFORM_IS_ARM)
+ triple = LLVMCreateMessage("arm64-apple-macosx13.0.0");
+#elif defined(PLATFORM_IS_MACOSX) && !defined(PLATFORM_IS_ARM)
+ triple = LLVMCreateMessage("x86_64-apple-macosx13.0.0");
#else
triple = LLVMGetDefaultTargetTriple();
#endif
diff --git a/src/libponyc/codegen/genexe.c b/src/libponyc/codegen/genexe.c
index 8b3af780..4d6299e3 100644
--- a/src/libponyc/codegen/genexe.c
+++ b/src/libponyc/codegen/genexe.c
@@ -295,7 +295,7 @@ static bool link_exe(compile_t* c, ast_t* program,
snprintf(ld_cmd, ld_len,
"%s -execute -arch %.*s "
"-o %s %s %s %s "
- "-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem %s",
+ "-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem %s -platform_version macos '13.0.0' '0.0.0'",
linker, (int)arch_len, c->opt->triple, file_exe, file_o,
lib_args, ponyrt, sanitizer_arg
);
diff --git a/src/libponyrt/CMakeLists.txt b/src/libponyrt/CMakeLists.txt
index d9b6fb9b..f96a13ce 100644
--- a/src/libponyrt/CMakeLists.txt
+++ b/src/libponyrt/CMakeLists.txt
@@ -54,6 +54,8 @@ set(_c_src
set(_ll_except_src "${CMAKE_CURRENT_SOURCE_DIR}/lang/except_try_catch.ll")
set(_ll_except_obj "${CMAKE_BINARY_DIR}/except_try_catch.o")
+set(CMAKE_OSX_DEPLOYMENT_TARGET 13.0.0)
+
find_file(_llc_command
NAMES llc.exe llc
PATHS "${CMAKE_BINARY_DIR}/../../libs/bin" "${CMAKE_BINARY_DIR}/../libs/bin" @chalcolith - do you think you could help us get this |
I've added the changes that Joe and I figured out today to the PR + a change in the libponyc building as well. There's probably a better way to set across all our CMakelists but maybe not. @chalcolith can you review the changes in CMake plus make any updates needed to get the 13.0.0 into a define and not be hardcoded 5 places? |
I'll work on adding release notes to this. |
Hi @SeanTAllen, The changelog - fixed label was added to this pull request; all PRs with a changelog label need to have release notes included as part of the PR. If you haven't added release notes already, please do. Release notes are added by creating a uniquely named file in the The basic format of the release notes (using markdown) should be:
Thanks. |
I've added release notes to this and once CI passes, I will be merging this and doing a release. |
sorry for late reply - llvm rebuild took a day. Build & test are good on my machine. Only, perhaps I've missed this one before:
several of those warnings but probably unrelated |
yup unrelated. |
No description provided.