Bundlex - simplify NIF compilation, dependencies and multiplatform handling

When integrating Elixir with native code (e.g., written in C) one of the important aspects is adapting new tooling responsible for compiling that code into our workflow. Of course, a native compiler can be invoked manually, but this approach is far from perfect, mainly for the following reasons:

  • you have to take care of compiling the code each time it changes,
  • if someone uses your project as a dependency (no matter whether directly or indirectly), they still have to execute the native compiler manually,
  • if you wish to support different operating systems, you have to handle this yourself,
  • if you have several projects and dependencies in the native code between them, you need to resolve these dependencies somehow.

While creating Membrane Framework, we’ve encountered all of these issues.

Bundlex is supposed to ease the management of the NIF dependencies.

Read more:

11 Likes

NIFs may also be specified differently for different platforms:

Probably newbie question:

Would it work also for Multilib?

https://wiki.gentoo.org/wiki/Multilib

For example what about writing NIF for x86 (like i486 or i686) library and compile it for both x86 and x86_64 distributions?

Theoretically it can be extended for supporting Multilib although currently this is not the primary goal of the project. Our main issue was to have a easy way to handle cross-platform differences and NIF dependencies.

3 Likes