Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load NIF #14

Open
bjunc opened this issue Jun 27, 2019 · 3 comments
Open

Failed to load NIF #14

bjunc opened this issue Jun 27, 2019 · 3 comments

Comments

@bjunc
Copy link

bjunc commented Jun 27, 2019

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.

@boudra
Copy link
Owner

boudra commented Jul 8, 2019

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?

@bjunc
Copy link
Author

bjunc commented Jul 8, 2019

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)?

@bjunc
Copy link
Author

bjunc commented Aug 11, 2019

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants