Does not work on Centos 7.x
spapas opened this issue · comments
Hello friends, I'm using this project on a Centos 7.x system and running {:ok, html} = Mjml.to_html(mjml)
gives me the following error:
** (UndefinedFunctionError) function Mjml.Native.to_html/2 is undefined (module Mjml.Native is not available)
(mjml 1.5.0) Mjml.Native.to_html("<mjml>...</mjml>", %Mjml.RenderOptions{keep_comments: true, social_icon_path: nil})
iex:2: (file)
11:52:56.622 [warning] The on_load function for module Elixir.Mjml.Native returned:
{:error,
{:load_failed,
'Failed to load NIF library: \'/lib64/libc.so.6: version `GLIBC_2.28\' not found (required by /home/serafeim/plausible/_build/prod/lib/mjml/priv/native/libmjml_nif-v1.5.0-nif-2.16-x86_64-unknown-linux-gnu.so)\''}}
Running ldd --version
gives me ldd (GNU libc) 2.17
.
Can you recommend any way to use this on my system without intalling rustc?
Thank you
I think that this article is related to the problem: https://kobzol.github.io/rust/ci/2021/05/07/building-rust-binaries-in-ci-that-work-with-older-glibc.html
Hey @spapas, thanks for opening the issue.
The same problem was mentioned here: philss/rustler_precompiled#59. So in essence the libraries for the different distributions were precompiled using GLIBC_2.28
in our GitHub workflows. If you don't have the possibility to install rustc and compile it on the target system yourself, then I'm afraid for now "[...]upgrading to a newer distribution is the easiest solution, if possible" 😬
Thanks @paulgoetze I'll probably bite the bullet and install rust...
@spapas we had a similar issue with RHEL 7. Since it has nearly reached EoL we accepted a rather hacky "solution", while we migrate to newer versions. I build on a centos 7: cloned https://github.com/adoptoposs/mjml_nif and did cargo build --release --target=x86_64-unknown-linux-gnu
(result: https://github.com/frederic-klein/mjmlnifrhel). Then I replaced the cached file (for my use case the path is /var/www/.cache/rustler_precompiled/precompiled_nifs/libmjml_nif-v1.5.0-nif-2.16-x86_64-unknown-linux-gnu.so.tar.gz
) and replaced the checksum in the elixir deps {root of your elixir project}/deps/mjml/checksum-Elixir.Mjml.Native.exs
(sha256sum: 1e24f533dc7bd4e6426906981a6232e7c3af3368d44f2c5eb59545467301f6330
), followed by mix clean --deps
and mix compile
. This should show something like Copying NIF from cache ...
. Again, rather hacky, breaks with updates, but works for now.
Thanks @frederic-klein that's a nice solution I'll consider it !