-
Notifications
You must be signed in to change notification settings - Fork 469
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
[macOS] CoreHaptics framework is not weakly linked, causing a hard dependency on CoreHaptics #1241
Comments
I can't even build a program with statically linked SDL since #1219 was merged, let alone run one, even on macOS 13 (Ventura):
Additionally, Core Haptics isn't even a native macOS API, it's a Catalyst API, and probably won't work outside of Catalyst apps. Is there some way we could make linking against it conditional to the platform (iOS, iPadOS, Catalyst)? |
Weak framework linker flags as in https://users.rust-lang.org/t/how-to-use-weak-linking-on-macos-link-with-weak-framework/50732 don't seem to be supported. Weak linking as a compiler feature is tracked in rust-lang/rust#29603 but probably won't happen any time soon given that it's now apparently marked "perma-unstable"; I'm not sure if it's relevant to this case anyway. There's a workaround described at https://internals.rust-lang.org/t/support-for-macos-weak-linking/13796/5 using [target.x86_64-apple-darwin]
rustflags = ["-C", "link-args=-weak_framework CoreHaptics"] |
This framework is used by the SDL_JOYSTICK module, but it is missing from Darwin builds. I have confirmed that this fixes my issues on my MacOS build. I have added the directive for the iOS builds, too, but that will need to be double-checked as I don't have a workflow for that.
On macOS <Catalina, CoreHaptics.framework is not present so running a rust-sdl2 program linked against CoreHaptics doesn't work. It looks like usually CoreHaptics.framework is weakly linked in the C build of SDL, but I don't know how to do this in Rust.
This only occurs with statically linked SDL, I think with dynamic linking it's probably fine.
The text was updated successfully, but these errors were encountered: