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

NIF compiled as Mach format on Linux #15

Closed
pallix opened this issue Nov 23, 2017 · 4 comments
Closed

NIF compiled as Mach format on Linux #15

pallix opened this issue Nov 23, 2017 · 4 comments

Comments

@pallix
Copy link

pallix commented Nov 23, 2017

Hello,

Using crc on Linux causes the following problem:

iex(1)> CRC.crc_16("hello")
2017-11-23 12:37:09.102 pid=<0.1289.0> [warn] : The on_load function for module crc_nif returned:
{:error,
 {:load_failed,
  'Failed to load NIF library: \'/home/user/projects/xyz/_build/dev/lib/crc/priv/crc_nif.so: invalid ELF header\''}}

** (UndefinedFunctionError) function :crc_nif.crc_16/1 is undefined (module :crc_nif is not available)
    (crc) :crc_nif.crc_16("hello")

The error is due to crc-0.7.0 package, containing the files c_src/env.mk and priv/crc_nif.so. Since these files are built and environment dependent, they must not be included in the package. priv/crc_nif.so is a MACH format compiled binary, causing the error.

@TattdCodeMonkey
Copy link
Owner

There were changes to the make file in v0.7 which is the likely cause here.

All the previous versions also had nifs and .so files too.

I’ll see about reproducing and working on a solution to this sometime this week. Thanks for logging the issue.

Cc: @potatosalad

@potatosalad
Copy link
Collaborator

@TattdCodeMonkey (initial guess) It sounds like c_src/env.mk and the compiled shared library was included in the package published to hex.

@TattdCodeMonkey
Copy link
Owner

@pallix I just published v0.7.1 That should not include c_src/env.mk, *.o or *.so files.

@TattdCodeMonkey
Copy link
Owner

Tested v0.7.1 in vagrant with ubuntu and latest elixir & erlang and everything compiled and tested 👍 closing this issue. Thanks again for reporting.

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

3 participants