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
darwin.xnu: update and restructure #110840
base: staging
Are you sure you want to change the base?
Conversation
You can do that yourself. Also I don't think that ofborg currently has any darwin builder. |
Oh, I could only call on linux, no privilege on darwin. Last time I saw veprbl did it, thought you trusted_users could do the magic. |
@GrahamcOfBorg test darwin.xnu darwin.Libsystem |
This comment has been minimized.
This comment has been minimized.
stdenv build failure:
|
(Never mind, I think I was mistaken) Oh haha, the expand-response-params failure is a really easy fix, was just missing an include. diff --git a/pkgs/build-support/expand-response-params/expand-response-params.c b/pkgs/build-support/expand-response-params/expand-response-params.c
index 05b9c62b1e8..e569d539260 100644
--- a/pkgs/build-support/expand-response-params/expand-response-params.c
+++ b/pkgs/build-support/expand-response-params/expand-response-params.c
@@ -1,6 +1,7 @@
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h> |
Ok I was able to get stdenv to build using a highly sophisticated approach. Idk if any of this will actually be useful, but I guess I'll post it here anyway. I think this patch fixes the first issue I was running into: --- a/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix
@@ -5,9 +5,9 @@ let
# This could be found as /System/DriverKit/usr/local/libexec/availability.pl
# TODO: update below output when new macOS SDK released.
availability_pl = writeShellScript "availability.pl" ''
- if [ "\$1" == "--macosx" ]; then
+ if [ "$1" == "--macosx" ]; then
echo 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 10.10 10.10.2 10.10.3 10.11 10.11.2 10.11.3 10.11.4 10.12 10.12.1 10.12.2 10.12.4 10.13 10.13.1 10.13.2 10.13.4 10.14 10.14.1 10.14.4 10.14.5 10.14.6 10.15 10.15.1
- elif [ "\$1" == "--ios" ]; then
+ elif [ "$1" == "--ios" ]; then
echo 2.0 2.1 2.2 3.0 3.1 3.2 4.0 4.1 4.2 4.3 5.0 5.1 6.0 6.1 7.0 7.1 8.0 8.1 8.2 8.3 8.4 9.0 9.1 9.2 9.3 10.0 10.1 10.2 10.3 11.0 11.1 11.2 11.3 11.4 12.0 12.1 12.2 12.3 12.4 13.0 13.1 13.2 13.3 13.4 13.5 13.6
fi
'';
@@ -130,6 +130,13 @@ appleDerivation ({
)
'';
+ doInstallCheck = true;
+ # Sanity check. Make sure darwin availability macros work.
+ installCheckPhase = ''
+ echo 'checking darwin symbol aliases... '
+ grep __DARWIN_ALIAS_STARTING_MAC___MAC_10_6 $out/include/sys/_symbol_aliasing.h
+ ''; The extra backslashes broke the availability script, causing it to exit and output nothing. The return status was not checked so the build "succeeded" and produced an empty symbol aliasing header, causing seemingly unrelated failures later. So maybe a sanity check is warranted here. After that, I run into this error later on when building bash:
I don't know what --- a/include/sys/_types/_fd_def.h
+++ b/include/sys/_types/_fd_def.h
@@ -51,55 +51,29 @@ typedef struct fd_set {
__int32_t fds_bits[__DARWIN_howmany(__DARWIN_FD_SETSIZE, __DARWIN_NFDBITS)];
} fd_set;
-int __darwin_check_fd_set_overflow(int, const void *, int) __API_AVAILABLE(macosx(10.16), ios(14.0), tvos(14.0), watchos(7.0));
__END_DECLS
__header_always_inline int
__darwin_check_fd_set(int _a, const void *_b)
{
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunguarded-availability-new"
-#endif
- if ((uintptr_t)&__darwin_check_fd_set_overflow != (uintptr_t) 0) {
-#if defined(_DARWIN_UNLIMITED_SELECT) || defined(_DARWIN_C_SOURCE)
- return __darwin_check_fd_set_overflow(_a, _b, 1);
-#else
- return __darwin_check_fd_set_overflow(_a, _b, 0);
-#endif
- } else {
- return 1;
- }
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
+ return 1;
}
/* This inline avoids argument side-effect issues with FD_ISSET() */
__header_always_inline int
__darwin_fd_isset(int _fd, const struct fd_set *_p)
{
- if (__darwin_check_fd_set(_fd, (const void *) _p)) {
- return _p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] & ((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS)));
- }
-
return 0;
}
__header_always_inline void
__darwin_fd_set(int _fd, struct fd_set *const _p)
{
- if (__darwin_check_fd_set(_fd, (const void *) _p)) {
- (_p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] |= ((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS))));
- }
}
__header_always_inline void
__darwin_fd_clr(int _fd, struct fd_set *const _p)
{
- if (__darwin_check_fd_set(_fd, (const void *) _p)) {
- (_p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] &= ~((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS))));
- }
} Later on I ran into issues with --- a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
@@ -68,6 +69,11 @@ appleDerivation {
#define API_UNAVAILABLE(...)
#endif
+
+ #if !defined(__SPI_AVAILABLE)
+ #define __SPI_AVAILABLE(...)
+ #endif The next issue was --- a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
@@ -30,7 +31,6 @@ appleDerivation {
gethostuuid.h
libproc.h
spawn.h
- strings.h
")
) |
Removing functions behind the FD_* macros will break any code that uses the select() system call. |
@holymonson still interested? I posted some kludges I used to build stdenv - if you have more principled fixes for these, maybe we can move forward with this PR? |
All my work on updating darwin has paused because of #111988, we may extract headers directly from sdk itself instead of assembled from different libs. I'm not sure if core maintainers still want moving on this way. |
I marked this as stale due to inactivity. → More info |
Motivation for this change
Updating darwin.xnu, this should fix most header issues in #101229.
It contains part of #109368 and #110685 , only last commit is really related to this PR.
cc @matthewbauer @veprbl @siraben @SuperSandro2000 , could some one call ofborg test darwin.xnu darwin.Libsystem ?
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)