Cannot compile exla on Mac
Mix.install([
{:exla, "~> 0.9.0"}
])
==> exla
Unpacking /Users/json/Library/Caches/xla/0.8.0/download/xla_extension-0.8.0-aarch64-darwin-cpu.tar.gz into /Users/json/Library/Caches/mix/installs/elixir-1.18.1-erts-15.2/3e10f8b466ca6981e94700127c3c9d09/deps/exla/cache
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/exla.cc -o cache/0.9.2/objs/exla.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/exla_mlir.cc -o cache/0.9.2/objs/exla_mlir.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/exla_client.cc -o cache/0.9.2/objs/exla_client.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls.cc -o cache/0.9.2/objs/custom_calls.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/exla_nif_util.cc -o cache/0.9.2/objs/exla_nif_util.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/ipc.cc -o cache/0.9.2/objs/ipc.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/eigh_f32.cc -o cache/0.9.2/objs/custom_calls/eigh_f32.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/eigh_f64.cc -o cache/0.9.2/objs/custom_calls/eigh_f64.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/lu_bf16.cc -o cache/0.9.2/objs/custom_calls/lu_bf16.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/lu_f16.cc -o cache/0.9.2/objs/custom_calls/lu_f16.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/lu_f32.cc -o cache/0.9.2/objs/custom_calls/lu_f32.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/lu_f64.cc -o cache/0.9.2/objs/custom_calls/lu_f64.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/qr_bf16.cc -o cache/0.9.2/objs/custom_calls/qr_bf16.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/qr_f16.cc -o cache/0.9.2/objs/custom_calls/qr_f16.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/qr_f32.cc -o cache/0.9.2/objs/custom_calls/qr_f32.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/qr_f64.cc -o cache/0.9.2/objs/custom_calls/qr_f64.o
c++ -fPIC -I/Users/json/.local/share/mise/installs/erlang/27.2/erts-15.2/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/exla_cuda.cc -o cache/0.9.2/objs/exla_cuda.o
In file included from c_src/exla/exla_client.cc:1:
In file included from c_src/exla/exla_client.h:13:
In file included from cache/xla_extension/include/xla/pjrt/pjrt_client.h:47:
In file included from cache/xla_extension/include/xla/pjrt/pjrt_future.h:30:
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:177:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
177 | return AsPtr().template Map(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:182:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
182 | return AsPtr().template Map(executor, std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:197:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
197 | return AsPtr().template TryMap(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:202:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
202 | return AsPtr().template TryMap(executor, std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:207:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
207 | return AsPtr().template FlatMap(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:212:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
212 | return AsPtr().template FlatMap(executor, std::forward<F>(f));
| ^
In file included from c_src/exla/exla.cc:4:
In file included from c_src/exla/exla_client.h:13:
In file included from cache/xla_extension/include/xla/pjrt/pjrt_client.h:47:
In file included from cache/xla_extension/include/xla/pjrt/pjrt_future.h:30:
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:177:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
177 | return AsPtr().template Map(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:182:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
182 | return AsPtr().template Map(executor, std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:197:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
197 | return AsPtr().template TryMap(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:202:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
202 | return AsPtr().template TryMap(executor, std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:207:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
207 | return AsPtr().template FlatMap(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:212:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
212 | return AsPtr().template FlatMap(executor, std::forward<F>(f));
| ^
6 errors generated.
6 errors generated.
make: *** [cache/0.9.2/objs/exla_client.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [cache/0.9.2/objs/exla.o] Error 1
could not compile dependency :exla, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile exla --force", update it with "mix deps.update exla" or clean it with "mix deps.clean exla"
** (Mix.Error) Could not compile with "make" (exit status: 2).
You need to have gcc and make installed. Try running the
commands "gcc --version" and / or "make --version". If these programs
are not installed, you will be prompted to install them.
(mix 1.18.1) lib/mix.ex:613: Mix.raise/2
(elixir_make 0.9.0) lib/elixir_make/compiler.ex:53: ElixirMake.Compiler.compile/1
/Users/json/Library/Caches/mix/installs/elixir-1.18.1-erts-15.2/3e10f8b466ca6981e94700127c3c9d09/deps/exla/mix.exs:194: EXLA.MixProject.cached_make/1
(mix 1.18.1) lib/mix/task.ex:574: Mix.Task.run_alias/6
(mix 1.18.1) lib/mix/tasks/compile.all.ex:117: Mix.Tasks.Compile.All.run_compiler/2
(mix 1.18.1) lib/mix/tasks/compile.all.ex:97: Mix.Tasks.Compile.All.compile/4
(mix 1.18.1) lib/mix/tasks/compile.all.ex:71: Mix.Tasks.Compile.All.do_run/2
(mix 1.18.1) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
$ gcc --version
Apple clang version 17.0.0 (clang-1700.0.13.3)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
Possibly related:
https://github.com/llvm/llvm-project/pull/80801
I just ran into this on my own, it seemed related to this clang issue: https://github.com/llvm/llvm-project/issues/94194 and I was able to resolve it by cloning the exla repo and adding -Wno-missing-template-arg-list-after-template-kw to the CFLAGS in the exla Makefile.
Specifically I saw this with Apple Clang 17.0.0 on my laptop, while it worked fine with clang 16.0.0
It looks like this issue has been fixed in the latest version of the file. https://github.com/openxla/xla/blob/cf7150f5755f7c5d985038410bd5c62c5a0debc2/xla/tsl/concurrency/async_value_ref.h
Would updating the xla version used in elixir-nx/xla resolve this?
@nallwhy I believe it would but I'm not very familiar with the XLA project and although I took a look I couldn't figure out how to do so quickly. As far as I can tell this is a new type of warning which was added to Clang, and is now warning about existing issues in the XLA code.
Updating the version of XLA in the XLA project is probably the right thing to do but for me just modifying it to ignore the warning let me continue the project I was working on. I could probably install Clang 16 on my laptop instead but that seemed tricky.
I ran into this as well after upgrading macOS. @Joss-Steward's idea of vendoring to disable the warning makes sense. In case it helps others: in my case my mix.exs already pointed to Nx on Git. So I just made a (temporary) fork on GitHub and changed the repository from elixir-nx/nx:
defp deps do
[
# ...
{:exla, github: "your-username-here/nx", sparse: "exla", ref: "commit-with-patch-here"},
{:nx, github: "your-username-here/nx", sparse: "nx", ref: "fcommit-with-patch-here", override: true},
# ...
]
end
Vendoring is a good solution too but I didn't want to deal with Git submodules :) and only changing mix.exs should be very easy to revert.
Another quick solution until fix committed is to define environment variable CXX with llvm 16, as mentioned earlier. For brew'ed llvm define CXX to /opt/homebrew/opt/llvm@16/bin/clang++
With #1603 you'll be able to add the custom no-warn flag. This is not necessarily a fix for the underlying issue (I'll see about updating XLA), but it will unblock everyone and serve as a temporary solution for future similar problems.
Example:
$ CFLAGS=-Wnomissing-template-arg-list-after-template-kw mix compile
...
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC ... -c c_src/exla/custom_calls/qr_f64.cc -o cache/0.9.1/objs/custom_calls/qr_f64.o
...
In my case I am using latest version of Sequoia:
❯ system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: macOS 15.4.1 (24E263)
Kernel Version: Darwin 24.4.0
Boot Volume: Macintosh HD
Boot Mode: Normal
...
I had been trying to use the CFLAGS=-Wnomissing-template-arg-list-after-template-kw approach inside a livebook notebook, but I haven't been able to make it work as expected. I don't know why but with the latest CFLAGS fix is not properly adding the flag as expected. To make it work I had to add it as suffix into the CXX env var.
This is the current configuration which worked in my case. Just installing the old llvm 16 version and making sure I have the right configuration inside the livebook notebook setup configuration.
TL;DR;
I had to install the previous llvm 16 version with:
brew install llvm@16
In my livebook setup I have the following working configuration:
cflags = System.get_env("CFLAGS", "") # Not doing what I am expecting
System.put_env("CFLAGS", cflags <> " -Wnomissing-template-arg-list-after-template-kw") # Not doing what I am expecting
path = System.get_env("PATH")
System.put_env("PATH", path <> ":/opt/homebrew/opt/llvm@16/bin")
System.put_env("CC", "/opt/homebrew/opt/llvm@16/bin/clang")
System.put_env("CXX", "/opt/homebrew/opt/llvm@16/bin/clang++ -Wnomissing-template-arg-list-after-template-kw")
ldflags = System.get_env("LDFLAGS", "")
System.put_env("LDFLAGS", ldflags <> " -L/opt/homebrew/opt/llvm@16/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@16/lib/c++")
cppflags = System.get_env("CPPFLAGS", "")
System.put_env("CPPFLAGS", cppflags <> " -I/opt/homebrew/opt/llvm@16/include")
Mix.install(
[
{:axon, "~> 0.7.0"},
{:nx, "~> 0.9.0"},
{:scidata, "~> 0.1"},
{:kino, "~> 0.15.0"},
{:table_rex, "~> 3.0"},
{:exla, "0.9.1"}
],
config: [
nx: [
default_backend: EXLA.Backend,
default_defn_options: [compiler: EXLA]
]
]
)
I add here as well the hex dep log from the livebook notebook mix.install as an example: Hex dependencies.log
Mix.install has a system_env option that might help with avoiding the put_env calls.
And EXLA mais should also help with passing the CFLAGS down
edit: I noticed afterwards that you said the fix didn't work, but the example code is using EXLA 0.9.1
If you could share what you tried with EXLA main, maybe we need to fix something else still
I don't have any success compiling Exla even in simple installations like this:
Mix.install(
[
{:exla, github: "elixir-nx/nx", sparse: "exla"},
{:nx, github: "elixir-nx/nx", override: true, sparse: "nx"}
],
config: [
nx: [default_backend: EXLA]
],
system_env: [
CFLAGS: "-Wnomissing-template-arg-list-after-template-kw"
]
)
** (Mix.Error) Could not compile with "make" (exit status: 2).
You need to have gcc and make installed. Try running the
commands "gcc --version" and / or "make --version". If these programs
are not installed, you will be prompted to install them.
(mix 1.18.2) lib/mix.ex:618: Mix.raise/2
(elixir_make 0.9.0) lib/elixir_make/compiler.ex:53: ElixirMake.Compiler.compile/1
/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/exla/exla/mix.exs:196: EXLA.MixProject.cached_make/1
(mix 1.18.2) lib/mix/task.ex:574: Mix.Task.run_alias/6
(mix 1.18.2) lib/mix/tasks/compile.all.ex:117: Mix.Tasks.Compile.All.run_compiler/2
(mix 1.18.2) lib/mix/tasks/compile.all.ex:97: Mix.Tasks.Compile.All.compile/4
(mix 1.18.2) lib/mix/tasks/compile.all.ex:71: Mix.Tasks.Compile.All.do_run/2
I can see the cflags being used during compilation but it fails after that for the same reasons.
I am on a Mac, latest version, with make and gcc:
system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: macOS 15.4.1 (24E263)
Kernel Version: Darwin 24.4.0
...
gcc --version
Apple clang version 17.0.0 (clang-1700.0.13.5)
Target: arm64-apple-darwin24.4.0
Thread model: posix
make --version
GNU Make 3.81
Can you share the complete error log? The one you shared doesn't give any useful information on the actual compilation error.
@polvalente sorry, I didn't add that because it is the same/similar than the OP but here it goes:
* Getting exla (https://github.com/elixir-nx/nx.git)
remote: Enumerating objects: 23722, done.
remote: Counting objects: 100% (4352/4352), done.
remote: Compressing objects: 100% (648/648), done.
remote: Total 23722 (delta 4099), reused 3717 (delta 3701), pack-reused 19370 (from 3)
origin/HEAD set to main
* Getting nx (https://github.com/elixir-nx/nx.git)
remote: Enumerating objects: 23722, done.
remote: Counting objects: 100% (4352/4352), done.
remote: Compressing objects: 100% (648/648), done.
remote: Total 23722 (delta 4099), reused 3717 (delta 3701), pack-reused 19370 (from 3)
origin/HEAD set to main
Resolving Hex dependencies...
Resolution completed in 0.009s
New:
complex 0.6.0
elixir_make 0.9.0
fine 0.1.0
nimble_pool 1.1.0
telemetry 1.3.0
xla 0.8.0
* Getting complex (Hex package)
* Getting telemetry (Hex package)
* Getting xla (Hex package)
* Getting fine (Hex package)
* Getting elixir_make (Hex package)
* Getting nimble_pool (Hex package)
==> fine
Compiling 1 file (.ex)
Generated fine app
==> mix_install
===> Analyzing applications...
===> Compiling telemetry
==> complex
Compiling 2 files (.ex)
Generated complex app
==> nx
Compiling 38 files (.ex)
Generated nx app
==> nimble_pool
Compiling 2 files (.ex)
Generated nimble_pool app
==> elixir_make
Compiling 8 files (.ex)
Generated elixir_make app
==> xla
Compiling 5 files (.ex)
Generated xla app
==> exla
Unpacking /Users/pedro/Library/Caches/xla/0.8.0/download/xla_extension-0.8.0-aarch64-darwin-cpu.tar.gz into /Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/exla/exla/cache
EXLA_CPU_ONLY is not set, checking for nvcc availability
CUDA is not available.
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/exla_client.cc -o cache/0.9.1/objs/exla_client.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/exla_mlir.cc -o cache/0.9.1/objs/exla_mlir.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls.cc -o cache/0.9.1/objs/custom_calls.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/exla.cc -o cache/0.9.1/objs/exla.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/ipc.cc -o cache/0.9.1/objs/ipc.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/eigh_f32.cc -o cache/0.9.1/objs/custom_calls/eigh_f32.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/eigh_f64.cc -o cache/0.9.1/objs/custom_calls/eigh_f64.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/lu_bf16.cc -o cache/0.9.1/objs/custom_calls/lu_bf16.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/lu_f32.cc -o cache/0.9.1/objs/custom_calls/lu_f32.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/lu_f16.cc -o cache/0.9.1/objs/custom_calls/lu_f16.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/qr_bf16.cc -o cache/0.9.1/objs/custom_calls/qr_bf16.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/lu_f64.cc -o cache/0.9.1/objs/custom_calls/lu_f64.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/qr_f16.cc -o cache/0.9.1/objs/custom_calls/qr_f16.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/qr_f32.cc -o cache/0.9.1/objs/custom_calls/qr_f32.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/custom_calls/qr_f64.cc -o cache/0.9.1/objs/custom_calls/qr_f64.o
c++ -Wnomissing-template-arg-list-after-template-kw -fPIC -I/Applications/Livebook.app/Contents/Resources/rel/vendor/livebook-0.15.5/otp/erts-15.2.2/include -I/Users/pedro/Library/Caches/mix/installs/elixir-1.18.2-erts-15.2.2/bb4705cda44abdf11d45f7da653bb342/deps/fine/include -Icache/xla_extension/include -Wall -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-comment -std=c++17 -w -DLLVM_VERSION_STRING= -O3 -c c_src/exla/exla_cuda.cc -o cache/0.9.1/objs/exla_cuda.o
In file included from c_src/exla/exla_client.cc:1:
In file included from c_src/exla/exla_client.h:14:
In file included from cache/xla_extension/include/xla/pjrt/pjrt_client.h:47:
In file included from cache/xla_extension/include/xla/pjrt/pjrt_future.h:30:
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:177:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
177 | return AsPtr().template Map(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:182:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
182 | return AsPtr().template Map(executor, std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:197:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
197 | return AsPtr().template TryMap(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:202:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
202 | return AsPtr().template TryMap(executor, std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:207:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
207 | return AsPtr().template FlatMap(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:212:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
212 | return AsPtr().template FlatMap(executor, std::forward<F>(f));
| ^
In file included from c_src/exla/exla.cc:6:
In file included from c_src/exla/exla_client.h:14:
In file included from cache/xla_extension/include/xla/pjrt/pjrt_client.h:47:
In file included from cache/xla_extension/include/xla/pjrt/pjrt_future.h:30:
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:177:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
177 | return AsPtr().template Map(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:182:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
182 | return AsPtr().template Map(executor, std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:197:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
197 | return AsPtr().template TryMap(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:202:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
202 | return AsPtr().template TryMap(executor, std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:207:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
207 | return AsPtr().template FlatMap(std::forward<F>(f));
| ^
cache/xla_extension/include/xla/tsl/concurrency/async_value_ref.h:212:29: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
212 | return AsPtr().template FlatMap(executor, std::forward<F>(f));
| ^
6 errors generated.
make: *** [cache/0.9.1/objs/exla.o] Error 1
make: *** Waiting for unfinished jobs....
6 errors generated.
make: *** [cache/0.9.1/objs/exla_client.o] Error 1
could not compile dependency :exla, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile exla --force", update it with "mix deps.update exla" or clean it with "mix deps.clean exla"
Thanks! There's something I just noticed in both error logs. They're using c++ as the compiler. It's probably worth setting CC and CXX to the proper gcc/g++ or clang/clang++ paths that you get outside of livebook.
The livebook desktop app runs with a pretty minimal PATH that can be getting in the way here. Let me know if anything changes!
Me and @jonatanklosko have started working on updating XLA, but it's not currently working on CUDA. We're both a bit swamped at the moment with conferences and whatnot, but hopefully we'll be able to get back to it soon.
Thanks @polvalente, after brew install llvm@16 and setting the env vars I was able to compile (from Hex or from GitHub):
Mix.install(
[
{:exla, github: "elixir-nx/nx", sparse: "exla"},
{:nx, github: "elixir-nx/nx", override: true, sparse: "nx"}
],
config: [
nx: [default_backend: EXLA.Backend]
],
system_env: [
CC: "/opt/homebrew/opt/llvm@16/bin/clang",
CXX: "/opt/homebrew/opt/llvm@16/bin/clang++"
]
)
I have a really dumb question probably. But I am getting the same error.
I have installed llvm via brew. But I am unsure where to set the system_env that is proposed here? AFAIK I can only set it per dependency but setting it for exla does not help?
This is my current mix.exs:
defmodule MyApp.MixProject do
use Mix.Project
def project do
[
app: :my_app,
version: "0.1.0",
elixir: "~> 1.18",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:exgboost, path: "/Users/marbury/Projects/Cloned/exgboost", override: true},
{:kino, "~> 0.15"},
{:kino_explorer, "~> 0.1"},
{:scidata, "~> 0.1"},
{:scholar, "~> 0.4"},
{:tokenizers, "~> 0.5"},
{:explorer, "~> 0.10"},
{:mighty, git: "https://github.com/acalejos/mighty.git"},
{:mockingjay,
git: "https://github.com/acalejos/mockingjay.git", branch: "make_tree_travs_jit_compilable"},
{:exla,
github: "elixir-nx/nx",
sparse: "exla",
system_env: [
CC: "/opt/homebrew/opt/llvm/bin/clang",
CXX: "/opt/homebrew/opt/llvm/bin/clang++",
CFLAGS: "-Wnomissing-template-arg-list-after-template-kw"
]},
{:nx, github: "elixir-nx/nx", override: true, sparse: "nx"}
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
]
end
end
exporting them prior to mix compile also does nothing.
In plain mix you just have to ensure it's present in your environment when starting the app. system_env is a Mix.install flag
If it doesn't help exporting beforehand (ensure you tried EXLA_FORCE_REBUILD=true mix compile --force), make sure you're using the correct version of llvm