orbtk
orbtk copied to clipboard
Does not compile on Mac M1 Silicon / Arm64 architecture
Describe the bug Orbtk does not compile an a M1 Mac.
To Reproduce On a M1 Mac:
cargo run --example minimal
Compiling orbtk v0.3.1-alpha5 (/Users/stefanpfeiffer/playground/rust/orbtk-crate/orbtk)
...
= note: Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_CHHapticDynamicParameter", referenced from:
objc-class-ref in libsdl2_sys-5a9139bf0738ff00.rlib(SDL_mfijoystick.m.o)
"_OBJC_CLASS_$_CHHapticEventParameter", referenced from:
objc-class-ref in libsdl2_sys-5a9139bf0738ff00.rlib(SDL_mfijoystick.m.o)
"_CHHapticDynamicParameterIDHapticIntensityControl", referenced from:
-[SDL_RumbleMotor setIntensity:] in libsdl2_sys-5a9139bf0738ff00.rlib(SDL_mfijoystick.m.o)
"_CHHapticEventParameterIDHapticIntensity", referenced from:
-[SDL_RumbleMotor setIntensity:] in libsdl2_sys-5a9139bf0738ff00.rlib(SDL_mfijoystick.m.o)
"_OBJC_CLASS_$_CHHapticPattern", referenced from:
objc-class-ref in libsdl2_sys-5a9139bf0738ff00.rlib(SDL_mfijoystick.m.o)
"_OBJC_CLASS_$_CHHapticEvent", referenced from:
objc-class-ref in libsdl2_sys-5a9139bf0738ff00.rlib(SDL_mfijoystick.m.o)
"_CHHapticEventTypeHapticContinuous", referenced from:
-[SDL_RumbleMotor setIntensity:] in libsdl2_sys-5a9139bf0738ff00.rlib(SDL_mfijoystick.m.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: could not compile `orbtk` due to previous error
Expected behavior Orbtk should compile and the minimal example should run.
Is the readme missing something specific for M1 Macs? I also did brew install sdl2
- no change.
README says If you have trouble build the provided OrbTk examples or simply don't want to use a C compiler, please check the backend section. It contains alternatives.
- no idea what the backend section
is.
Hey dl1ely,
thanks for taking up OrbTk for a m1 based system. I'm sorry, but personally i don't have access to a mi/arm64 powered system. So I can't cross check. Towards the addressed README subsection: Since we/i have reworked the document lately, i must have killed a former link. I will cross check but dought, that this document would have a clue to the give issue. If i recall correctly, it was intended to describe the build process for web targets. But i might be completely wrong.
Anyway, the lock clearly reference the missing symbols in libsdl2_sys (rust wrapper), that will consult the system sdl2. Maybe the sdl2 version on your silicon has an older release version or the linke can't find the shared library?
Hi Ralf,
thanks for your kind reply. I am new to the apple platform. Unfortunately i am lacking the skills to debug such problems on my own. No idea what i am missing here and how to fix it.
Perhaps someone else with experience in these kind of issues can shed a light in the future, when M1 based systems become more widespread.
Thank you so far! Stefan
you can try to add a build.rs
at the root of project (same level as cargo.toml
). and add following code into it. This will try to link the binary against CoreHaptics framework.
fn main() {
println!("cargo:rustc-link-lib=framework=CoreHaptics");
}
This works and works on M2 Apple Silicon.
Thanks @tanzhenghao-james;
this is good to know. I'm not experienced enough to rule out, if that build.rs snippet should be added automatically if installation detects mac silicon? Anyone else?
The CoreHaptics framework seems to be an opt in for Apple devices ....
Sorry for delay.
Since we depends on rust-sdl2 and they depends on CoreHaptics, it would be better to let they address this issue.
On the other hand, I'm using intel Mac and also encountering this error so it's more related to OS rather cpu arch.