Closed whatyouhide closed 2 years ago
I tried adding this to my native/<package>/.cargo/config
too, with no luck:
# See https://github.com/rust-lang/cargo/issues/7154
[target.aarch64-unknown-linux-musl]
rustflags = [
"-C", "target-feature=-crt-static"
]
I ran into the same issue when trying to compile aarch64-unknown-linux-musl
for mail_parser. Installing the latest unreleased version of cross
did the trick: https://github.com/kloeckner-i/mail_parser/blob/f4af5083aec73a47f0e41a202ba46a91f60602cf/.github/workflows/release.yml#L101-L105
@whatyouhide I'm glad to see that you are using and enjoying rustler_precompiled! :smiley:
But sorry, I don´t know exactly what can be :/
Probably updating cross
can help - btw, thanks @adriankumpf :purple_heart: ! -, but since you have issues with x86_64-unknown-linux-musl
, this may not be the case.
I did, however, encounter a similar problem while trying to use a compiled artifact on Linux using musl: the custom malloc lib didn't work there. So I had to disable it. Please check this PR: https://github.com/elixir-nx/explorer/pull/240 So maybe it's something in your dependencies that is causing the issue. I'm going to check that.
@whatyouhide I was able to compile and run the NIF on Linux with musl (x86_64-unknown-linux-musl
).
I don't know if I got correctly, but you did fix the issues for that target, right?
Btw, I'm using this Dockerfile to test at the root dir of nimble_lz4
- :
FROM hexpm/elixir:1.13.4-erlang-24.3.4-alpine-3.15.3
WORKDIR /app
RUN apk update && \
apk upgrade --no-cache && \
apk add --no-cache \
git \
curl \
build-base \
libgcc \
openssl-dev
RUN mix local.hex --force && mix local.rebar --force
COPY . .
After that I enter the container and install Rust before running the tests:
docker build -t lz4_first .
docker run -it --rm lz4_first /bin/sh
Once inside the container, I install Rust before running mix test
:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Hey folks! Thanks for all the responses.
@adriankumpf's suggestion to use the latest version of cross is what did the trick. I opened up https://github.com/philss/rustler_precompiled/pull/22 to mention that in the docs.
@philss I was already able to make x84_64-unknown-linux-musl
work, it worked out of the box 🤓 The one giving me trouble was aarch64-unknown-linux-musl
(basically, Alpine Docker containers running on M1 Mac for me).
Thanks everyone! 💟
Hey all! I've been having an awesome time trying Rustler and rustler_precompiled out 🙃 I'm using them for an LZ4 compression/decompression library for Elixir that uses Rust bindings (I tweeted about this just yesterday).
I’m having one small issue, and I suck at Rust so I figured maybe I’m just doing something dumb. I have an M1 Mac and I am doing some testing in an Alpine Docker container. This means that the target I’m looking for should be
aarch64-unknown-linux-musl
.If I try to add this target to the GitHub Actions example you folks provide in the documentation, it doesn't seem to build (see this build), spitting out this error:
Have you folks stumbled across this?
By the way, the reason I’m going through these tribulations is that I’m having issues with making the
x86_64-unknown-linux-musl
target working as you can see in this build from a package that uses the RustlerPrecompiled package as a dependency.Thanks in advance! 💟