-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[MacCatalyst] Failing to build MacCatalyst 'preadv' 'pwritev' only available on macCatalyst 14.0 or newer #54424
Comments
Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer Issue Details
|
cc @adamsitnik This needs the same guard as macOS. |
Tagging subscribers to this area: @dotnet/area-system-io Issue Details
|
How is it possible that we have a CMAKE check for that: runtime/src/libraries/Native/Unix/configure.cmake Lines 222 to 225 in f721cf4
and the call to runtime/src/libraries/Native/Unix/System.Native/pal_io.c Lines 1490 to 1492 in f891033
and we are still getting this error? cc @janvorli |
On macOS/iOS/tvOS/MacCatalyst you build on a quite recent SDK. This SDK does have
If you compile with default flags it will not give you an error since it assumes you target the same OS version as the SDK. However, if you compile for downlevel OS (eg. I have a suspicion that the target version flags are not passed for the configure checks. It's not exactly clear whether that's something you want to do but in this case it is. |
@adamsitnik I cannot build due to this problem even on my local Apple M1 device targetting macos arm64 without Catalyst option since your change that added those (I've mentioned that on your PR, but I guess you have missed it). We build with -mmacosx-version-min=11.0, but the API declaration is guarded in my SDK in the headers by the following check:
Looking at the compiler options for the pal_io.c, we set the _XOPEN_SOURCE, so that blocks the preadv / pwritev Adding the following to the
|
Ah, this seems to be a different issue. This is x64, we don't use -mmacosx-version-min=11.0 for x64, for that one we use -mmacosx-version-min=10.13. So either we need to move the minimum supported version to 11.0 for x64 too or, as @filipnavara mentioned, ensure that this option is used for the configure phase too (I think that he's right that it is likely the issue) |
There are also some specific hard-coded runtime/src/libraries/Native/Unix/configure.cmake Lines 512 to 535 in 64f5f0b
|
I have found the culprit. The option There are two possible fixes here. One is to modify diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake
index 99a8013d7cf..d47da771dd3 100644
--- a/eng/native/configurecompiler.cmake
+++ b/eng/native/configurecompiler.cmake
@@ -415,7 +415,8 @@ if (CLR_CMAKE_HOST_UNIX)
else()
clr_unknown_arch()
endif()
- add_compile_options(${MACOS_VERSION_MIN_FLAGS})
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MACOS_VERSION_MIN_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MACOS_VERSION_MIN_FLAGS}")
add_linker_flag(${MACOS_VERSION_MIN_FLAGS})
endif(CLR_CMAKE_TARGET_MACCATALYST)
endif(CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_MACCATALYST) The other is this: diff --git a/src/libraries/Native/Unix/configure.cmake b/src/libraries/Native/Unix/configure.cmake
index 9d40db9dbf2..a630777a0b8 100644
--- a/src/libraries/Native/Unix/configure.cmake
+++ b/src/libraries/Native/Unix/configure.cmake
@@ -21,6 +21,9 @@ elseif (CLR_CMAKE_TARGET_LINUX)
set(PAL_UNIX_NAME \"LINUX\")
elseif (CLR_CMAKE_TARGET_OSX)
set(PAL_UNIX_NAME \"OSX\")
+ if (CLR_CMAKE_HOST_ARCH_ARM64)
+ set(CMAKE_REQUIRED_FLAGS -mmacosx-version-min=11)
+ else()
+ set(CMAKE_REQUIRED_FLAGS -mmacosx-version-min=10.13)
+ endif () The former is preferable as it doesn't duplicate the option choice. |
@janvorli awesome, big thanks for doing that! Would you like me to send a PR or do you want to do it yourself? |
Let me send it out, I have made the change locally. |
My fix actually fixes just the issues I had. The catalyst problem remains. I am trying to figure out how to fix that one. |
@janvorli The Catalyst build is a mess because CMake doesn't support it natively, at least not properly. Thus the runtime/eng/native/configurecompiler.cmake Lines 398 to 404 in f70723d
runtime/src/libraries/Native/Unix/CMakeLists.txt Lines 82 to 94 in 64f5f0b
|
@filipnavara thank you, this was helpful! I have believed that we've already fix our build so that the configurecompiler.cmake applies to everything in coreclr, libraries and installer, but it is clearly not the case. |
./build.sh -s mono+libs+libs.pretest -os MacCatalyst -arch x64 -c Debug
The text was updated successfully, but these errors were encountered: