We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
When trying to compile `mjml` it fails with this error (on mac): In future versions of mjml it may be fixed but for now people would have to create that config
```
==> mjml
Compiling NIF crate :mjml_nif (native/mjml_nif)...
Compiling on macOS requires special link args in order to compile
correctly.
Rustler is currently working around this issue in the compiler task.
This will be removed in v1.0.0 in favor of a user supplied .cargo/config
file.
To remove this warning, please create <my_proj>/deps/mjml/native/mjml_nif/.cargo/config
with the following content:
[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
See https://developer.apple.com...
for more details.
```
And unfortunately I can't get it to run at all on my mac - even after following those instructions
I just give the mjml_demo project a run on my Intel Macbook without any issues (also go the rust warning that you mentioned). I was able to run it without adding that cargo config and with that cargo config added. Are you on an M1 Macbook?
Hey Alex! Sorry, it was my fault - I didn't have Rust installed and it's required to compile (I just didn't think of it). Maybe put it in the requirements at the top? Thanks for the post!
One thing I'm concerned about using this method, since it requires Rust to compile - I don't know if this would work on Heroku or Gigalixir since the build -> compile step are done on a remote machine without you controlling deps (or langauges like Rust). Do you think there is way to do this if you don't "own" the box it deploys to?
It works on Heroku - took me a while to figure out how, though:
You need to add the Rust buildpack https://github.com/emk/hero... together with the elixir & static phoenix buildpack.
So I have following buildpacks added on Heroku:
- https://github.com/emk/hero...
- https://github.com/HashNuke...
- https://github.com/gjaldon/...
On top you need to add a "RustConfig" file in your phoenix app's root directory and set RUST_SKIP_BUILD=1 in it. (see https://github.com/emk/hero...
If you like you can have a look at the setup for https://github.com/adoptopo..., this phoenix app is hosted on Heroku and using the mjml_nif for emails.
I make a subtle note of that in step two...but I should probably highlight that a bit more. Unfortunately I am not familiar with Heroku or Gigalixir as I usually run on native hosts or in containers and can perform those operations during the Mix Release. I'll take a look and get back to you on that one.
I came across this post first and then discovered the author's more recent work here: https://github.com/akoutmos/mjml_eex . I feel like this post should be updated to mention the mjml_eex project near the beginning, as that's what people should be using.