exweb3 / ex_keccak Goto Github PK
View Code? Open in Web Editor NEWElixir library for computing Keccak SHA3-256 hashes using a NIF built tiny-keccak Rust crate.
License: Apache License 2.0
Elixir library for computing Keccak SHA3-256 hashes using a NIF built tiny-keccak Rust crate.
License: Apache License 2.0
I tried installing ex_keccak on a new Mac m1 but got an error when trying to install.
Specifically got a message that
/_build/dev/lib/ex_keccak/priv/native/libexkeccak.so,' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
Anyone experience this before? Is there a way to get ExKeccak working on M1 Mac architectures?
Thanks!
I am trying to use ex_keccak on a nerve instance deployed on a rpi5.
I have used the option to force_build ex_keccak. Once I am getting to the step that creates the firmware I am getting an issue with the libexkeccak.so
the arch is incorrect.
Got:
file:Mach-O 64-bit dynamically linked shared library arm64
Expecting:
readelf:AArch64;0x0
How could I force it to compile for AArch64;0x0
?
Should we add?
#[rustler::nif(schedule = "DirtyCpu")]
Hello and thanks for delivering such useful update as precompiled NIFs!
It looks like 0.7.0 release on hex contains wrong checksums file.
You can see, that some dependent packages are failing to update to 0.7.0 , like in this PR
poanetwork/ex_abi#122
I have few suggestions:
release:
mix rustler_precompiled.download ExKeccak --all --print
mix hex.publish --yes
then just make release
.
In such way won't be needed to commit checksums on each release and won't forget to update it before publishing to hex.
[***@xxxx blockscout]# mix deps.compile ex_keccak
==> ex_keccak
Compiling 1 file (.ex)
== Compilation error in file lib/ex_keccak.ex ==
** (ErlangError) Erlang error: :enoent
(elixir 1.12.3) lib/system.ex:1041: System.cmd("cargo", ["metadata", "--format-version=1"], [cd: "native/exkeccak"])
(rustler 0.22.2) lib/rustler/compiler/config.ex:81: Rustler.Compiler.Config.external_resources/2
(rustler 0.22.2) lib/rustler/compiler/config.ex:69: Rustler.Compiler.Config.build/1
(rustler 0.22.2) lib/rustler/compiler.ex:9: Rustler.Compiler.compile_crate/2
lib/ex_keccak.ex:2: (module)
could not compile dependency :ex_keccak, "mix compile" failed. You can recompile this dependency with "mix deps.compile ex_keccak", update it with "mix deps.update ex_keccak" or clean it with "mix deps.clean ex_keccak"
I erlang version:
Erlang/OTP 23 [erts-11.1.7] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Eshell V11.1.7 (abort with ^G)
Elixir version:
Elixir 1.12.3 (compiled with Erlang/OTP 22)
Sorry for the use issues for this... Please close it as soon you answer me.
I'm just curious... Why did you use rust for this and not native erlang? Did you make some benchmarks or something to make this decision?
Hello friends, would you consider integrating this project with Rustler precompiled (https://hexdocs.pm/rustler_precompiled/RustlerPrecompiled.html) in order to avoid needing the rust dependency ?
I've already done this integration on my fork of ex_keccak and it is working great: https://github.com/spapas/ex_keccak
I don't want to provide a PR because I've used my own repo and tags there to download the pre-compiled NIFs and I think it would be too intrusive to this repo (i.e you'll see base_url: "https://github.com/spapas/ex_keccak/releases/download/0.3.3"). However you can take a peek at the diffs needed here:
The only thing missing is to change it with your repo and tags and create a new hex release :)
TIA
Hello!
I'm using a library that is using this library, and when I run the code I get this error:
[warning] The on_load function for module Elixir.ExKeccak returned:
{:error,
{:load_failed,
'Failed to load NIF library: \'dlopen(/Users/julesguesnon/Dev/Tinybones/tinybones-game-server/_build/dev/lib/ex_keccak/priv/native/libexkeccak.so, 0x0002): tried: \'/Users/julesguesnon/Dev/Tinybones/tinybones-game-server/_build/dev/lib/ex_keccak/priv/native/libexkeccak.so\' (mach-o file, but is an incompatible architecture (have \'x86_64\', need \'arm64e\')), \'/usr/local/lib/libexkeccak.so\' (no such file), \'/usr/lib/libexkeccak.so\' (no such file), \'/Users/julesguesnon/Dev/Tinybones/tinybones-game-server/deps/ex_keccak/priv/native/libexkeccak.so\' (mach-o file, but is an incompatible architecture (have \'x86_64\', need \'arm64e\')), \'/usr/local/lib/libexkeccak.so\' (no such file), \'/usr/lib/libexkeccak.so\' (no such file)\''}}
And IMO the most important part is this one: (mach-o file, but is an incompatible architecture (have \'x86_64\', need \'arm64e\'))
. It's probably happening because I'm running the code on the Mac M1.
Would it be possible to ship an arm compatible version as well?
Hi 👋
The new version 0.7.2
does not have the binaries uploaded in the realease and will not compile without forcing to build.
==> ex_keccak
Compiling 1 file (.ex)
17:21:03.197 [debug] Downloading NIF from https://github.com/tzumby/ex_keccak/releases/download/v0.7.2/libexkeccak-v0.7.2-nif-2.16-x86_64-unknown-linux-gnu.so.tar.gz
== Compilation error in file lib/ex_keccak.ex ==
** (RuntimeError) Error while downloading precompiled NIF: couldn't fetch NIF from https://github.com/tzumby/ex_keccak/releases/download/v0.7.2/libexkeccak-v0.7.2-nif-2.16-x86_[64](https://github.com/alisinabh/elixir_ethers/actions/runs/6149656486/job/16685974658?pr=19#step:11:65)-unknown-linux-gnu.so.tar.gz: {:ok, {{~c"HTTP/1.1", 404, ~c"Not Found"}, [{~c"cache-control", ~c"no-cache"}, {~c"date", ~c"Mon, 11 Sep 2023 17:21:03 GMT"}, {~c"server", ~c"GitHub.com"}, {~c"vary", ~c"X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With"}, {~c"content-length", ~c"9"}, {~c"content-type", ~c"text/plain; charset=utf-8"}, {~c"strict-transport-security", ~c"max-age=31536000; includeSubdomains; preload"}, {~c"x-frame-options", ~c"deny"}, {~c"x-content-type-options", ~c"nosniff"}, {~c"x-xss-protection", ~c"0"}, {~c"referrer-policy", ~c"no-referrer-when-downgrade"}, {~c"content-security-policy", ~c"default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self'; style-src 'unsafe-inline'"}, {~c"x-github-request-id", ~c"1080:1DCB:1D602B5:29F5[66](https://github.com/alisinabh/elixir_ethers/actions/runs/6149656486/job/16685974658?pr=19#step:11:67)4:64FF4C7F"}], "Not Found"}}.
You can force the project to build from scratch with:
config :rustler_precompiled, :force_build, ex_keccak: true
In order to force the build, you also need to add Rustler as a dependency in your `mix.exs`:
{:rustler, ">= 0.0.0", optional: true}
lib/ex_keccak.ex:10: (module)
it seems rustler doesn't support otp 24 yet
Hello.
I am having issues deploying a project on alpine. Is it possible to add x86_64-alpine-linux-musl to releases?
== Compilation error in file lib/ex_keccak.ex ==
** (RuntimeError) precompiled NIF is not available for this target: "x86_64-alpine-linux-musl".
The available targets are:
- aarch64-unknown-linux-musl
- aarch64-apple-darwin
- aarch64-unknown-linux-gnu
- 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
lib/ex_keccak.ex:10: (module)
could not compile dependency :ex_keccak, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile ex_keccak", update it with "mix deps.update ex_keccak" or clean it with "mix deps.clean ex_keccak"
Tried to build this on M1 / apple silicon and it fails. I don't know for certain if this is a Rustler issue or something here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.