andreyuhai

andreyuhai

Failed to load NIF library, symbol not found for libpostal

I am trying to install expostal in a new Elixir project in a container with alpine, and since libpostal exists as a package on alpine, I am just installing it.

❯ docker run --rm -it elixir:alpine sh
/ # apk add build-base libpostal-dev
/ # mix new foobar

# Add {:expostal, "~> 0.2.0"} to the deps.

/foobar # mix deps.get
/foobar # mix deps.compile

/foobar # iex -S mix
iex(1)> Expostal.par(TAB)
13:18:25.440 [warning] The on_load function for module Elixir.Expostal returned:
{{:badmatch,
  {:error,
   {:load_failed,
    'Failed to load NIF library: \'Error relocating /foobar/_build/dev/lib/expostal/priv/expostal.so: libpostal_setup_parser: symbol not found\''}}},
 [
   {Expostal, :init, 0, [file: 'lib/expostal.ex', line: 13]},
   {:code_server, :"-handle_on_load/5-fun-0-", 1,
    [file: 'code_server.erl', line: 1317]}
 ]}


13:18:25.439 [error] Process #PID<0.202.0> raised an exception
** (MatchError) no match of right hand side value: {:error, {:load_failed, 'Failed to load NIF library: \'Error relocating /foobar/_build/dev/lib/expostal/priv/expostal.so: libpostal_setup_parser: symbol not found\''}}
    (expostal 0.2.0) lib/expostal.ex:13: Expostal.init/0
    (kernel 8.5) code_server.erl:1317: anonymous fn/1 in :code_server.handle_on_load/5

I’ve asked this on Elixir Slack and @LostKobraKai had suggested that the NIF compilation is the problem and I should compile it properly. However I am not sure how I would compile it properly so that it’d work on alpine.


Compiling from source and installing on ubuntu:latest and alpine:latest just worked fine. So it means there’s something with the expostal I think.

First Post!

dimitarvp

dimitarvp

Not sure which version your Alpine is but maybe try upgrading MUSL?

apk upgrade musl

In any case please make sure you use a fairly modern Alpine version. It’s not a problem to use a non-Elixir based image and just add Erlang and Elixir to a normal Alpine Docker image.

If that doesn’t work maybe you need GNU libc compatibility:

apk add gcompat

But outside of that, not sure.

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31265 143
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36352 110
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 48342 226
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement