Skip to content

Add "compile to path" option #750

Description

@PJUllrich

Hey folks,

What

It'd be nice to have an option on Rustler that allows me to define the "output" path of the compilation, which is currently hard-coded to priv/native/{crate}.

Why

I frequently compile my NIFs inside a Linux devcontainer for development but run my tests from my host system (macOS), so I frequently need to delete the compiled output and recompile it for another OS. I have a small workaround which copies the output to priv/native/{arch}/{crate} and then updates the load_from path to load_from: {:my_app, "priv/#{MyApp.Native.lib_dir()}/some_crate"}.

I added this compiler step in mix.exs like this: compilers: [:phoenix_live_view] ++ Mix.compilers() ++ [:app_native], and a module in mix/tasks/compile/app_native.ex which copies the artifacts into the subdirs in priv/native but ideally, I could do this with a Rustler option like I already do with load_from

Much appreciated! ❤️

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions