Skip to content
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

Does not compile on Mac M1 Silicon / Arm64 architecture #487

Open
dl1ely opened this issue May 27, 2022 · 6 comments
Open

Does not compile on Mac M1 Silicon / Arm64 architecture #487

dl1ely opened this issue May 27, 2022 · 6 comments
Labels
FAQ Common project related questions and answers

Comments

@dl1ely
Copy link

dl1ely commented May 27, 2022

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.

@dl1ely dl1ely added the bug label May 27, 2022
@rzerres
Copy link
Contributor

rzerres commented Jun 2, 2022

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?

@dl1ely
Copy link
Author

dl1ely commented Jun 8, 2022

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

@tanzhenghao-james
Copy link

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");
}

@heiwa9
Copy link

heiwa9 commented Sep 28, 2022

This works and works on M2 Apple Silicon.

@rzerres
Copy link
Contributor

rzerres commented Oct 2, 2022

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 ....

@rzerres rzerres added FAQ Common project related questions and answers and removed bug labels Oct 13, 2022
@tanzhenghao-james
Copy link

tanzhenghao-james commented Feb 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FAQ Common project related questions and answers
Projects
None yet
Development

No branches or pull requests

4 participants