Error on 0.8 Nerves compile that worked on 0.7.3
I get this error:
==> xla
Compiling 5 files (.ex)
Generated xla app
19:44:48.362 [info] Downloading a precompiled XLA archive for target x86_64-linux-gnu-cpu
19:44:49.815 [info] Successfully downloaded the XLA archive
==> exla
Unpacking /root/.cache/xla/0.8.0/download/xla_extension-0.8.0-x86_64-linux-gnu-cpu.tar.gz into /root/project/deps/exla/cache
/root/.nerves/artifacts/nerves_toolchain_aarch64_nerves_linux_gnu-linux_x86_64-13.2.0/bin/aarch64-nerves-linux-gnu-g++ -fPIC -I/root/.nerves/artifacts/nerves_system_rpi4-portable-1.28.1/staging/usr/lib/erlang/erts-15.0.1/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/objs/exla.o
/root/.nerves/artifacts/nerves_toolchain_aarch64_nerves_linux_gnu-linux_x86_64-13.2.0/bin/aarch64-nerves-linux-gnu-g++ -fPIC -I/root/.nerves/artifacts/nerves_system_rpi4-portable-1.28.1/staging/usr/lib/erlang/erts-15.0.1/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/objs/exla_mlir.o
/root/.nerves/artifacts/nerves_toolchain_aarch64_nerves_linux_gnu-linux_x86_64-13.2.0/bin/aarch64-nerves-linux-gnu-g++ -fPIC -I/root/.nerves/artifacts/nerves_system_rpi4-portable-1.28.1/staging/usr/lib/erlang/erts-15.0.1/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/objs/custom_calls.o
/root/.nerves/artifacts/nerves_toolchain_aarch64_nerves_linux_gnu-linux_x86_64-13.2.0/bin/aarch64-nerves-linux-gnu-g++ -fPIC -I/root/.nerves/artifacts/nerves_system_rpi4-portable-1.28.1/staging/usr/lib/erlang/erts-15.0.1/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/objs/exla_client.o
/root/.nerves/artifacts/nerves_toolchain_aarch64_nerves_linux_gnu-linux_x86_64-13.2.0/bin/aarch64-nerves-linux-gnu-g++ -fPIC -I/root/.nerves/artifacts/nerves_system_rpi4-portable-1.28.1/staging/usr/lib/erlang/erts-15.0.1/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/objs/exla_nif_util.o
/root/.nerves/artifacts/nerves_toolchain_aarch64_nerves_linux_gnu-linux_x86_64-13.2.0/bin/aarch64-nerves-linux-gnu-g++ -fPIC -I/root/.nerves/artifacts/nerves_system_rpi4-portable-1.28.1/staging/usr/lib/erlang/erts-15.0.1/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/objs/exla_cuda.o
/root/.nerves/artifacts/nerves_toolchain_aarch64_nerves_linux_gnu-linux_x86_64-13.2.0/bin/aarch64-nerves-linux-gnu-g++ cache/objs/exla.o cache/objs/exla_mlir.o cache/objs/custom_calls.o cache/objs/exla_client.o cache/objs/exla_nif_util.o cache/objs/exla_cuda.o -o cache/libexla.so -Lcache/xla_extension/lib -lxla_extension -shared -Wl,-rpath,'$ORIGIN/xla_extension/lib'
/root/.nerves/artifacts/nerves_toolchain_aarch64_nerves_linux_gnu-linux_x86_64-13.2.0/bin/../lib/gcc/aarch64-nerves-linux-gnu/13.2.0/../../../../aarch64-nerves-linux-gnu/bin/ld: skipping incompatible cache/xla_extension/lib/libxla_extension.so when searching for -lxla_extension
/root/.nerves/artifacts/nerves_toolchain_aarch64_nerves_linux_gnu-linux_x86_64-13.2.0/bin/../lib/gcc/aarch64-nerves-linux-gnu/13.2.0/../../../../aarch64-nerves-linux-gnu/bin/ld: cannot find -lxla_extension: No such file or directory
/root/.nerves/artifacts/nerves_toolchain_aarch64_nerves_linux_gnu-linux_x86_64-13.2.0/bin/../lib/gcc/aarch64-nerves-linux-gnu/13.2.0/../../../../aarch64-nerves-linux-gnu/bin/ld: skipping incompatible cache/xla_extension/lib/libxla_extension.so when searching for -lxla_extension
collect2: error: ld returned 1 exit status
make: *** [Makefile:90: cache/libexla.so] 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"
==> nerves_livebook
** (Mix) Could not compile with "make" (exit status: 2).
You need to have gcc and make installed. If you are using
Ubuntu or any other Debian-based system, install the packages
"build-essential". Also install "erlang-dev" package if not
included in your Erlang/OTP version. If you're on Fedora, run
"dnf group install 'Development Tools'".
Repeats on CI and on my own Linux box. This happens if I set my dependency to 0.8 instead of 0.7.3.
Anything I've missed in terms of different requirements for 0.8?
Looks specific to cross compilation, though I can't think of any specific change, beyond XLA itself.
ld: skipping incompatible cache/xla_extension/lib/libxla_extension.so when searching for -lxla_extension
This is confusing because the downloaded binary is for the target architecture.
Can confirm the issue also exists on Mac (and maybe Windows) in the standalone Livebook application and while installing livebook with mix :/
It's "fixable" by going back to previous versions of exla
The error message totally mirrors https://github.com/livebook-dev/livebook/issues/1290 so I thought it was a livebook issue at first!
Hey @AdrianPaulCarrieres, what error do you get? Same as here or same as https://github.com/livebook-dev/livebook/issues/1290. It may be useful if you can paste it for the reference.
The issue in https://github.com/livebook-dev/livebook/issues/1290 was specific to missing entries in PATH, since PATH is minimal by default when running Livebook Desktop. However, you mentioned it is also the case with mix escript install, in which case the PATH should be as usual.
@lawik I did just notice your xla archive download logged "Downloading a precompiled XLA archive for target x86_64-linux-gnu-cpu".
You can force it to download the aarch64 archive with the XLA_TARGET_PLATFORM environment variable (as documented in the elixir-nx/xla README)
Ohh, I think I interpreted the logs the other way around, if aarch64 is the build target, then it makes sense and XLA_TARGET_PLATFORM is the way to go, good catch!
I assume aarch64 is the target because it's a nerves host compilation targeting rpi4
I think we handled it with that env var in the end. I see it in the PR at least :)