pelemay
pelemay copied to clipboard
protocol String.Chars not implemented
Describe the bug
PelemayFpBench on Elixir 1.12.0 / OTP 24.0.1 / maxOS Big Sur 11.3 / M1 emits the following error:
08:31:13.646 [error] Process #PID<0.193.0> raised an exception
** (Protocol.UndefinedError) protocol String.Chars not implemented for {:error, {:load_failed, 'Failed to load NIF library: \'dlopen(/Users/zacky/Dropbox/pelemay_fp_benchmark/_build/dev/lib/pelemay/priv/libnifelixirlogisticmap.so, 2): no suitable image found. Did find:\n\t/Users/zacky/Dropbox/pelemay_fp_benchmark/_build/dev/lib/pelemay/priv/libnifelixirlogisticmap.so: mach-o, but wrong architecture\n\t/Users/zacky/Dropbox/pelemay_fp_benchmark/_build/dev/lib/pelemay/priv/libnifelixirlogisticmap.so: stat() failed with errno=35\''}} of type Tuple. This protocol is implemented for the following type(s): Float, DateTime, Time, List, Version.Requirement, Atom, Integer, Version, Date, BitString, NaiveDateTime, URI
(elixir 1.12.0) lib/string/chars.ex:3: String.Chars.impl_for!/1
(elixir 1.12.0) lib/string/chars.ex:22: String.Chars.to_string/1
(pelemay_fp_benchmark 0.1.2) _build/dev/lib/pelemay/priv/pelemay_nif_elixir_logisticmap.ex:22: PelemayNifElixirLogisticMap.load_nifs/0
(pelemay_fp_benchmark 0.1.2) _build/dev/lib/pelemay/priv/pelemay_nif_elixir_logisticmap.ex:10: PelemayNifElixirLogisticMap.init/0
(kernel 8.0) code_server.erl:1317: anonymous fn/1 in :code_server.handle_on_load/5
To Reproduce Steps to reproduce the behavior:
- Use Pelemay in PelemayFpBench
- Run in the command 'mix bench'
- See the above-mentioned error
Expected behavior Benchmarks run successfully.
Screenshots None
Desktop (please complete the following information):
For later than Pelemay version 0.0.7,
Copy & paste the error log from Logger
tagged [Pelemay]
iex(1)> CpuInfo.all_profile
%{
compiler: %{
apple_clang: [
%{
bin: "/usr/bin/clang",
type: :apple_clang,
version: "12.0.5",
versions: "Apple clang version 12.0.5 (clang-1205.0.22.9)"
}
],
"apple_clang++": [
%{
bin: "/usr/bin/clang++",
type: :"apple_clang++",
version: "12.0.5",
versions: "Apple clang version 12.0.5 (clang-1205.0.22.9)"
}
],
cc_env: [],
cflags_env: "",
clang: [
%{
bin: "/usr/bin/clang",
type: :apple_clang,
version: "12.0.5",
versions: "Apple clang version 12.0.5 (clang-1205.0.22.9)"
}
],
"clang++": [
%{
bin: "/usr/bin/clang++",
type: :"apple_clang++",
version: "12.0.5",
versions: "Apple clang version 12.0.5 (clang-1205.0.22.9)"
}
],
cxx_env: [],
cxxflags_env: "",
"g++": [
%{
bin: "/usr/bin/g++",
type: :"apple_clang++",
version: "12.0.5",
versions: "Apple clang version 12.0.5 (clang-1205.0.22.9)"
}
],
gcc: [
%{
bin: "/usr/bin/gcc",
type: :apple_clang,
version: "12.0.5",
versions: "Apple clang version 12.0.5 (clang-1205.0.22.9)"
}
],
ldflags_env: ""
},
cpu: %{
cpu_model: "M1",
cpu_models: ["M1"],
cpu_type: "arm64",
hyper_threading: :disabled,
num_of_cores_of_a_processor: 8,
num_of_ecores: 4,
num_of_pcores: 4,
num_of_processors: 1,
num_of_threads_of_a_processor: 8,
os_type: :macos,
total_num_of_cores: 8,
total_num_of_threads: 8
},
cuda: %{cuda: false},
elixir: %{version: "1.12.0"},
erlang: %{otp_version: 24},
kernel: %{
kernel_release: "20.4.0",
kernel_version: "Darwin 20.4.0",
system_version: "macOS 11.3 (20E232)"
},
metal: %{metal: true}
}
Additional context None.
This error will occur when the architecture of the prebuilt NIF library does not match that of running CPU.