joelpaulkoch

joelpaulkoch

Failed to load NIF library (libstdc++.so.6 needed by libexla.so) in Burrito release

Hi, I built a small cli application combining Bumblebee and Burrito you can find the repository here: GitHub - joelpaulkoch/bumbur: An example for an AI CLI application in Elixir · GitHub

You can build binaries using MIX_ENV=prod mix release, they will appear in the burrito_out directory.

You can cross compile but I’m building only the executable for the system I’m working on, so this is not a cross compilation issue.

The binary produced for macos works perfectly but I get this error for the linux executable:

19:17:06.520 [warning] The on_load function for module Elixir.EXLA.NIF returned:
{:error,
 {:load_failed,
  ~c"Failed to load NIF library: 'Error loading shared library libstdc++.so.6: No such file or directory (needed by /home/joel/.local/share/.burrito/bumbur_erts-15.0.1_0.1.0/lib/exla-0.7.3/priv/libexla.so)'"}}

Running ldd /home/joel/.local/share/.burrito/bumbur_erts-15.0.1_0.1.0/lib/exla-0.7.3/priv/libexla.so produces this output:

linux-vdso.so.1 (0x00007fd28a598000)
libxla_extension.so => /home/joel/.local/share/.burrito/bumbur_erts-15.0.1_0.1.0/lib/exla-0.7.3/priv/xla_extension/lib/libxla_extension.so (0x00007fd279e00000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fd279a00000)
libm.so.6 => /lib64/libm.so.6 (0x00007fd279d17000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fd279ce9000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd279600000)
librt.so.1 => /lib64/librt.so.1 (0x00007fd28a422000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd28a41d000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fd28a418000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd28a59a000)

libstdc++.so.6 is on my system at /lib64.
So I tried running LD_LIBRARY_PATH=/lib64 burrito_out/bumbur_linux, this results in another error:

19:21:20.264 [warning] The on_load function for module Elixir.EXLA.NIF returned:
{:error,
 {:load_failed,
  ~c"Failed to load NIF library: 'Error relocating /home/joel/.local/share/.burrito/bumbur_erts-15.0.1_0.1.0/lib/exla-0.7.3/priv/libexla.so: __libc_single_threaded: symbol not found'"}}	

I’m not sure what the underlying issue is.
I believe that _build/prod/lib/exla/priv/libexla.so is copied into the Burrito build and that somehow doesn’t play nicely.
I’m not even sure if this is actually an issue of Burrito or Exla, or if I’m simply missing a flag.

What I’ve tried:

  • run LD_LIBRARY_PATH=/lib64 burrito_out/bumbur_linux
  • set nifcxx_flags: "-L/lib64" for the Burrito target (same for nifc_flags)

Burrito uses musl, I don’t know if this plays a role here.

The situation looks similar to this post which unfortunately doesn’t include a solution: Using EXLA in mix release on MacOS/Darwin fails with `Failed to load NIF library: ... libxla_extension.so...`

Any help is welcome.

Most Liked

seanmor5

seanmor5

Author of Genetic Algorithms in Elixir

This is probably because Burrito uses musl. The libxla_extension.so that libexla.so uses precompiled on Linux is only precompiled against glibc. There was an Alpine/musl build a long time ago, but it was way too hard to maintain because it relied on patching TensorFlow/XLA and LLVM at the same time: Add alpine build by seanmor5 · Pull Request #31 · elixir-nx/xla · GitHub

joelpaulkoch

joelpaulkoch

I compile on a x86_64 linux machine for a x86_64 linux machine, so I don’t think it’s related to cross compiling.

Last Post!

pieterclaerhout

pieterclaerhout

It’s a known issue they are working on…

https://github.com/leandrocp/mdex/issues/149

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New

We're in Beta

About us Mission Statement