Skip to content

rustler's load_from defaults to priv/native/#{crate}, but deps_nix installs into priv/native/lib#{crate} #36

Description

@ju1m

deps_nix installs the Rust dynamic library using the basename (eg. libmjml_nif.so):

deps_nix/lib/deps_nix.ex

Lines 275 to 281 in 1cdcda2

preConfigure = ''
mkdir -p priv/native
for lib in ${native}/lib/*
do
ln -s "$lib" "priv/native/$(basename "$lib")"
done
'';

but that lib prefix does not match the default used by rustler, which is #{crate} (AFAIU):

https://github.com/rusterlium/rustler/blob/85d0a90e02372b6dd5e84f4bb85828a830233992/rustler_mix/lib/rustler/compiler/config.ex#L34-L43

Workaround

Use load_from, as in:

config :mjml,
       Mjml.Native,
       skip_compilation?: true,
       load_from: {:mjml, "priv/native/libmjml_nif"}
config :mdex,
       MDEx.Native,
       skip_compilation?: true,
       load_from: {:mdex, "priv/native/libcomrak_nif"}
config :autumn,
       Autumn.Native,
       skip_compilation?: true,
       load_from: {:autumn, "priv/native/libautumnus_nif"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions