Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocol String.Chars not implemented #164

Open
zacky1972 opened this issue May 23, 2021 · 1 comment
Open

protocol String.Chars not implemented #164

zacky1972 opened this issue May 23, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@zacky1972
Copy link
Collaborator

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:

  1. Use Pelemay in PelemayFpBench
  2. Run in the command 'mix bench'
  3. 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.

@zacky1972 zacky1972 added the bug Something isn't working label May 23, 2021
@zacky1972 zacky1972 changed the title protocol String.Chars now implemented protocol String.Chars not implemented May 24, 2021
@zacky1972
Copy link
Collaborator Author

This error will occur when the architecture of the prebuilt NIF library does not match that of running CPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant