jschaeff

jschaeff

Release and NIF library

Hello !

Mix release with NIF in a containser crashes … I can’t find why.

If I run the project locally (mix phx.serve) it works.
When I build a release locally and run it, it works.
When I copy the locally generated release directory in a Docker container and spin it up, it works.

When I build everything in a Docker container (mix release), it fails with the following error:

=INFO REPORT==== 13-May-2026::10:16:55.060537 ===
    application: kernel
    exited: {{shutdown,
                 {failed_to_start_child,on_load,
                     {on_load_function_failed,'Elixir.MSeed.NIF',
                         {error,
                             {bad_lib,
                                 "Failed to find library init function: '/app/wsdataselect/lib/wsdataselect-1.1.18/priv/libexmseed.so: undefined symbol: _nif_init'"}}}}},
             {kernel,start,[normal,[]]}}
    type: permanent

Kernel pid terminated (application_controller) ("{application_start_failure,kernel,{{shutdown,{failed_to_start_child,on_load,{on_load_function_failed,'Elixir.MSeed.NIF',{error,{bad_lib,\"Failed to find library init function: '/app/wsdataselect/lib/wsdataselect-1.1.18/priv/libexmseed.so: undefined symbol: _nif_init'\"}}}}},{kernel,start,[normal,[]]}}}")

ldd on the /app/wsdataselect/lib/wsdataselect-1.1.18/priv/libexmseed.so says everything is statically linked.

Dockerfile Dockerfile · 65-libmseed-nif · OSUG / RESIF / wsdataselect · GitLab

Anybody has an idea what is missing in the container ?

Marked As Solved

jschaeff

jschaeff

By iterating over a naive Dockerfile until the release breaks, I identified the missing part in the docker context (I omitted to put the ./c directory). Weirdly, the compilation worked, but the release missed all the NIF part.

The fix: Add missing directory in build context (afa04fb3) · Commits · OSUG / RESIF / wsdataselect · GitLab

Thanks for the replies !

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
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
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
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
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
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
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
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

We're in Beta

About us Mission Statement