jaxon
jaxon copied to clipboard
Failed to load NIF
When deploying to k8s / docker, I'm getting a missing NIF error:
{:error, {:load_failed, 'Failed to load NIF library: \'/opt/app/_build/prod/lib/jaxon/priv/decoder.so: invalid ELF header\''}}
Any thoughts? Works in local / dev environment.
hi @bjunc, This could happen if you compile the Elixir app in OS X and then try to run it in a Docker Linux image.
Is it possible that you're compiling your app in a different machine than the Docker image?
Hmm. I am indeed on OSX, and I am running the app in a Docker image. However, in my Dockerfile, I'm running:
FROM elixir:1.8
# a bunch of other steps...
# last step
RUN mix deps.get --only prod && MIX_ENV=prod mix compile
Shouldn't that compile the app within the Elixir base image (not OSX)?
@boudra I'm not 100% certain, but I think I found the issue. I did not have a .dockerignore
for this project yet, which was allowing the _build
folder to be copied over. I think that was creating a conflict where the dev (OSX) Nif was being used instead of the Linux Nif for production. Does that seem logical?