Skip to content

Bundled with static-link doesn't work on macOS #1187

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

Open
Cobrand opened this issue Dec 28, 2021 · 4 comments
Open

Bundled with static-link doesn't work on macOS #1187

Cobrand opened this issue Dec 28, 2021 · 4 comments
Labels
build-process Everything related to build.rs, or the build process in general H-OSX-Support-Needed

Comments

@Cobrand
Copy link
Member

Cobrand commented Dec 28, 2021

See the latest build status: https://github.com/Rust-SDL2/rust-sdl2/runs/4642055170?check_suite_focus=true

It's coming from #1186 , so probably a bug upstream, or a misconfig on our end

@Cobrand Cobrand added H-OSX-Support-Needed build-process Everything related to build.rs, or the build process in general labels Dec 28, 2021
@ivanmoreau
Copy link

ivanmoreau commented Dec 29, 2021

I tried to build it myself, but I also got this warning with the linker:

[...]
ld: warning: object file (/Users/ivanmolinarebolledo/rust-sdl2/target/debug/deps/libsdl2_sys-fd49f5dc146a33ad.rlib(SDL_blendfillrect.c.o)) was built for newer macOS version (11.1) than being linked (10.7)
[...]

This is the full log.

Maybe this is a related issue: widelands/widelands#4679

@RhapsodySiu
Copy link

I have similar issue and I'm using Mac M1. The compilation succeeds without "static-link" feature but fails when "static-link" (+"bundled") features are enabled.

extern crate sdl2;

fn main() {
    let _sdl = sdl2::init().unwrap();
}

Only include "static-link" feature

% cargo run
   Compiling sdl2 v0.35.2
   Compiling sdl2-sys v0.35.2
error: could not find native static library `SDL2main`, perhaps an -L flag is missing?

Include both "bundled" & "static-link" features

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-arch" "arm64" (...arguments)
  = note: Undefined symbols for architecture arm64:
            "_OBJC_CLASS_$_CHHapticDynamicParameter", referenced from:
                objc-class-ref in libsdl2_sys-16b3cb1f8781f8da.rlib(SDL_mfijoystick.m.o)
            "_OBJC_CLASS_$_CHHapticEventParameter", referenced from:
                objc-class-ref in libsdl2_sys-16b3cb1f8781f8da.rlib(SDL_mfijoystick.m.o)
            "_CHHapticDynamicParameterIDHapticIntensityControl", referenced from:
                -[SDL_RumbleMotor setIntensity:] in libsdl2_sys-16b3cb1f8781f8da.rlib(SDL_mfijoystick.m.o)
            "_CHHapticEventParameterIDHapticIntensity", referenced from:
                -[SDL_RumbleMotor setIntensity:] in libsdl2_sys-16b3cb1f8781f8da.rlib(SDL_mfijoystick.m.o)
            "_OBJC_CLASS_$_CHHapticPattern", referenced from:
                objc-class-ref in libsdl2_sys-16b3cb1f8781f8da.rlib(SDL_mfijoystick.m.o)
            "_OBJC_CLASS_$_CHHapticEvent", referenced from:
                objc-class-ref in libsdl2_sys-16b3cb1f8781f8da.rlib(SDL_mfijoystick.m.o)
            "_CHHapticEventTypeHapticContinuous", referenced from:
                -[SDL_RumbleMotor setIntensity:] in libsdl2_sys-16b3cb1f8781f8da.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)

jstasiak added a commit to jstasiak/openpol that referenced this issue Nov 30, 2022
Turns out it doesn't work on Mac OS at least in the latest rust-sdl2
version[1].

[1] Rust-SDL2/rust-sdl2#1187
@hikari-no-yume
Copy link
Contributor

I think this and #1241 are related. Not only is the crate not weakly linking CoreHaptics, it seems it's not linking it at all for static builds?

@hikari-no-yume
Copy link
Contributor

hikari-no-yume commented Mar 16, 2023

I decided to try to fix the CHHaptic issue, but discovered it is already fixed on the current master (0c4fb75)! Somewhere between version 0.35.2 (b36d048) and now, it starts working. I've compiled both versions locally to make sure of it.

I guess this might just be c80f7a4 and 278eda3 but I didn't check.

So all that's needed is a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-process Everything related to build.rs, or the build process in general H-OSX-Support-Needed
Projects
None yet
Development

No branches or pull requests

4 participants