leandrocp / mdex

A fast 100% CommonMark-compatible GitHub Flavored Markdown parser and formatter for Elixir.
https://mdex-c31.pages.dev
MIT License
83 stars 6 forks source link

NIF not available: "x86_64-unknown-linux-gnux32" when using latest " mix phx.gen.release --docker" (1.7.12) #34

Open gregjohnsonsaltaire opened 3 months ago

gregjohnsonsaltaire commented 3 months ago

Hi, The Dockerfile generated from the latest " mix phx.gen.release --docker" (1.7.12) includes: ARG ELIXIR_VERSION=1.16.2 ARG OTP_VERSION=26.2.3 ARG DEBIAN_VERSION=bullseye-20240408-slim

Compiling :mdex with that Dockerfile gives:

== Compilation error in file lib/mdex/native.ex ==
** (RuntimeError) precompiled NIF is not available for this target: "x86_64-unknown-linux-gnux32".
The available targets are:
 - aarch64-apple-darwin
 - aarch64-unknown-linux-gnu
 - aarch64-unknown-linux-musl
 - arm-unknown-linux-gnueabihf
 - riscv64gc-unknown-linux-gnu
 - x86_64-apple-darwin
 - x86_64-pc-windows-gnu
 - x86_64-pc-windows-msvc
 - x86_64-unknown-linux-gnu
 - x86_64-unknown-linux-musl

What would the best approach be to resolving this? Thanks ...

leandrocp commented 3 months ago

Hey @gregjohnsonsaltaire I just published v0.1.15 adding legacy compilation targets, which I think should solve your issue but I'm not completely sure. Please give it a try and let me know. Thanks!

gregjohnsonsaltaire commented 3 months ago

Hi @leandrocp, I'm afraid v0.1.15 doesn't fix the problem. Compile fails:

#23 44.65 == Compilation error in file lib/mdex/native.ex ==
#23 44.65 ** (RuntimeError) precompiled NIF is not available for this target: "x86_64-unknown-linux-gnux32".
#23 44.65 The available targets are:
#23 44.65  - aarch64-apple-darwin
#23 44.65  - aarch64-unknown-linux-gnu
#23 44.65  - aarch64-unknown-linux-musl
#23 44.65  - x86_64-apple-darwin
#23 44.65  - x86_64-pc-windows-msvc
#23 44.65  - x86_64-pc-windows-gnu
#23 44.65  - x86_64-unknown-linux-gnu
#23 44.65  - x86_64-unknown-linux-musl
#23 44.65  - x86_64-unknown-freebsd
#23 44.65     lib/mdex/native.ex:30: (module)

Confirmed the dep being used is 0.1.15:

#18 4.237   live_monaco_editor 0.1.8
#18 4.237   mdex 0.1.15

I can build a Docker image that works fine with:

ARG ELIXIR_VERSION=1.16.2
ARG OTP_VERSION=26.2.3
ARG UBUNTU_VERSION=focal-20240216
ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-ubuntu-${UBUNTU_VERSION}"
ARG RUNNER_IMAGE="ubuntu:${UBUNTU_VERSION}"

Thank you!

leandrocp commented 3 months ago

@gregjohnsonsaltaire I see, thanks for the report. I'll try to replicate and find a fix if possible. The problem is that x86_64-unknown-linux-gnux32 is a Tier 2 target and not very straightforward to include in the release. I've checked many projects using rustler_precompiled and none include such target, but I'll investigate a bit more.

leandrocp commented 3 months ago

Keeping this issue open for now.

gregjohnsonsaltaire commented 3 months ago

Hi @leandrocp, given that it works in an Ubuntu container, which is a downstream of Debian anyway, I suspect it shouldn't be a priority for anyone. Many thanks again for taking your valuable time to look at it ...