From e4fa61ae07445aaa3ecde3e9cee9a83da1394fc8 Mon Sep 17 00:00:00 2001 From: Chili Palmer Date: Fri, 17 Jul 2026 12:04:07 +0200 Subject: [PATCH] fix: fix for building --- mix.exs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mix.exs b/mix.exs index 3031920..27e8ec7 100644 --- a/mix.exs +++ b/mix.exs @@ -2,6 +2,8 @@ defmodule BDS.MixProject do use Mix.Project def project do + ensure_xla_compiler_flags() + [ app: :bds, version: "0.1.0", @@ -15,6 +17,22 @@ defmodule BDS.MixProject do ] end + # XLA 0.9.x headers (pulled by exla) illegally specialize `std::is_signed`, + # which Apple clang 17+/libc++ rejects with a hard `-Winvalid-specialization` + # error, breaking the exla NIF build. Disable just that diagnostic on macOS so + # the C++ compile succeeds. Guarded to Darwin so the Linux/gcc build path is + # untouched. Appends rather than overwrites any CFLAGS the caller already set. + defp ensure_xla_compiler_flags do + if :os.type() == {:unix, :darwin} do + flag = "-Wno-invalid-specialization" + current = System.get_env("CFLAGS", "") + + unless String.contains?(current, flag) do + System.put_env("CFLAGS", String.trim(flag <> " " <> current)) + end + end + end + def application do [ extra_applications: [:logger, :wx, :ssl],