-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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
yabai: refactor new sdk pattern; cleanup; switch to apple-sdk_15; build from source #352621
base: master
Are you sure you want to change the base?
Conversation
ddc04b0
to
b1aad92
Compare
Upstream uses __builtin._available checks for sdk features. We can leverage the newer sdk to make sure we keep up with new features as they are added since they are careful with version checks.
f49aa8e
to
1f42981
Compare
Had a hash merge conflict hiding a build issue from source I need to find out. It looks like it's trying to do 2 builds at once and second |
Arm64 builds, just need to see if x86 builds with llvm 19. |
# aarch64 code is compiled on all targets, which causes our Apple SDK headers to error out. | ||
# Since multilib doesn't work on darwin i dont know of a better way of handling this. | ||
substituteInPlace makefile \ | ||
--replace-fail "-arch arm64e" "" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about this one? Since ptrauth.h
is used I imagine it might be necessary for AArch64.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> ld: warning: ignoring file /private/tmp/nix-build-yabai-7.1.4.drv-0/payload-8bb724/payload-arm64e.o, building for macOS-arm64 but attempting to link with file built for unknown-arm64e
> ld: warning: ignoring file /private/tmp/nix-build-yabai-7.1.4.drv-0/payload-ce652e/payload-arm64e.o, building for macOS-arm64 but attempting to link with file built for unknown-arm64e
> fatal error: /nix/store/wli7d4k9sh4c6fwarw3afc5g5axwbjm8-cctools-binutils-darwin-1010.6/bin/lipo: /private/tmp/nix-build-yabai-7.1.4.drv-0/payload-e8e57e/payload-arm64.out and /private/tmp/nix-build-yabai-7.1.4.drv-0/payload-56e39e/payload-arm64e.out have the same architectures (arm64) and can't be in the same fat output file
> clang: error: lipo command failed with exit code 1 (use -v to see invocation)
> fatal error: /nix/store/wli7d4k9sh4c6fwarw3afc5g5axwbjm8-cctools-binutils-darwin-1010.6/bin/lipo: /private/tmp/nix-build-yabai-7.1.4.drv-0/payload-515dcf/payload-arm64.out and /private/tmp/nix-build-yabai-7.1.4.drv-0/payload-cdef29/payload-arm64e.out have the same architectures (arm64) and can't be in the same fat output file
> clang: error: lipo command failed with exit code 1 (use -v to see invocation)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My replaces in there are just to remove arm64e/x86 and replace it with arm64 basically. Is there a better way of doing this now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Urgh. I guess we might need proper arm64e
toolchain support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we only actually get pointer auth with arm64e and can't build this from source still?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scripting addition on aarch64-darwin need arm64e, here is my try azuwis@2725afe, it builds arm64e code, but scripting addition crashes when run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use macOS CommandLineTools to build:
$ file src/osax/loader
src/osax/loader: Mach-O 64-bit arm64e (caps: PAC00) executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>
$ file src/osax/payload
src/osax/payload: Mach-O 64-bit arm64e (caps: PAC00) dynamically linked shared library, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|NO_REEXPORTED_DYLIBS>
$ ./src/osax/loader
could not retrieve task port for pid: 47162
Use nix unwrapped clang to build:
$ file ./src/osax/loader
./src/osax/loader: Mach-O 64-bit arm64e 00) executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>
$ file ./src/osax/payload
./src/osax/payload: Mach-O 64-bit arm64e 00) dynamically linked shared library, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|NO_REEXPORTED_DYLIBS>
$ ./src/osax/loader
Segmentation fault: 11
$ lldb ./src/osax/loader
(lldb) target create "./src/osax/loader"
Current executable set to '/tmp/yabai/source/src/osax/loader' (arm64e).
(lldb) run
Process 52946 launched: '/tmp/yabai/source/src/osax/loader' (arm64e)
Process 52946 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x200001fe3d05c0)
frame #0: 0x0000000196189020 libobjc.A.dylib`objc_msgSend + 32
libobjc.A.dylib`objc_msgSend:
-> 0x196189020 <+32>: ldr x10, [x16, #0x10]
0x196189024 <+36>: lsr x11, x10, #48
0x196189028 <+40>: and x10, x10, #0xffffffffffff
0x19618902c <+44>: and w12, w1, w11
Target 0: (loader) stopped.
|
Things done
Using the new sdk pattern and cleaning up derivation. Also changing yabai on arm to build from source, finally, by using the llvm 19 stdenv.
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.