From 425810fabd7b958bd52380bdf2058fa81a29c21b Mon Sep 17 00:00:00 2001 From: Peter Peerdeman Date: Mon, 3 Aug 2026 09:08:31 +0200 Subject: [PATCH] Fixed: macOS build and startup crash with Homebrew sdl2-compat. Link against Homebrew SDL2 libs on macOS via .cargo/config.toml, and upgrade sdl2 crate to 0.38 so SDL3-numbered events leaked by sdl2-compat no longer abort the game on startup. Co-Authored-By: Claude Fable 5 --- .cargo/config.toml | 7 +++++++ Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..0c2723b --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,7 @@ +# On macOS, SDL2/SDL2_image/SDL2_ttf come from Homebrew (brew install sdl2 sdl2_image sdl2_ttf), +# which the linker doesn't search by default. +[target.aarch64-apple-darwin] +rustflags = ["-L", "/opt/homebrew/lib"] + +[target.x86_64-apple-darwin] +rustflags = ["-L", "/usr/local/lib"] diff --git a/Cargo.lock b/Cargo.lock index e403067..8c7481b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -317,9 +317,9 @@ dependencies = [ [[package]] name = "sdl2" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b498da7d14d1ad6c839729bd4ad6fc11d90a57583605f3b4df2cd709a9cd380" +checksum = "2d42407afc6a8ab67e36f92e80b8ba34cbdc55aaeed05249efe9a2e8d0e9feef" dependencies = [ "bitflags 1.3.2", "lazy_static", @@ -329,9 +329,9 @@ dependencies = [ [[package]] name = "sdl2-sys" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951deab27af08ed9c6068b7b0d05a93c91f0a8eb16b6b816a5e73452a43521d3" +checksum = "3ff61407fc75d4b0bbc93dc7e4d6c196439965fbef8e4a4f003a36095823eac0" dependencies = [ "cfg-if", "libc", diff --git a/Cargo.toml b/Cargo.toml index c092a74..80d21a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,6 @@ edition = "2021" [dependencies] rstest = "0.25.0" -sdl2 = { version = "0.37", features = ["image", "ttf"] } +sdl2 = { version = "0.38", features = ["image", "ttf"] } rand = "0.9" strum = { version = "0.27", features = ["derive"] }