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

Error when M1 Mac with Rosetta 2 mode #154

Open
zacky1972 opened this issue Dec 3, 2020 · 1 comment
Open

Error when M1 Mac with Rosetta 2 mode #154

zacky1972 opened this issue Dec 3, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@zacky1972
Copy link
Collaborator

Describe the bug
An error occurs when M1 Mac with Rosetta 2 mode.

To Reproduce
Steps to reproduce the behavior:

  1. Use Pelemay in pelemay_sample
  2. Run in the command mix compile
  3. See error:
% mix compile
Compiling 1 file (.ex)

14:56:16.601 [error] /usr/bin/clang -S /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/libnifelixirpelemaysample.c -o ../obj/libnifelixirpelemaysample.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -S /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_mult_2_kernel.c -o ../obj/map_elem1_mult_2_kernel.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -S /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel.c -o ../obj/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -S /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_mult_2_kernel_driver.c -o ../obj/map_elem1_mult_2_kernel_driver.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -S /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel_driver.c -o ../obj/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel_driver.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -S /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_mult_2_kernel_bench.c -o ../obj/map_elem1_mult_2_kernel_bench.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -S /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_mult_2_kernel_base.c -o ../obj/map_elem1_mult_2_kernel_base.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -S /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_mult_2_kernel_driver_base.c -o ../obj/map_elem1_mult_2_kernel_driver_base.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -c /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_mult_2_kernel_bench.c -o ../obj/map_elem1_mult_2_kernel_bench.o  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -c /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel_driver.c -o ../obj/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel_driver.o  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -c /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_mult_2_kernel_driver.c -o ../obj/map_elem1_mult_2_kernel_driver.o  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -c /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_mult_2_kernel_base.c -o ../obj/map_elem1_mult_2_kernel_base.o  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -c /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_mult_2_kernel_driver_base.c -o ../obj/map_elem1_mult_2_kernel_driver_base.o  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -c /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel.c -o ../obj/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel.o  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -c /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_mult_2_kernel.c -o ../obj/map_elem1_mult_2_kernel.o  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -c /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/libnifelixirpelemaysample.c -o ../obj/libnifelixirpelemaysample.o  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -S /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel_bench.c -o ../obj/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel_bench.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -S /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel_base.c -o ../obj/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel_base.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
/usr/bin/clang -S /Users/zacky/github/pelemay_sample/_build/dev/lib/pelemay/src/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel_driver_base.c -o ../obj/map_elem1_plus_1_mult_22_mult_elem1_mod_6700417_kernel_driver_base.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23. (truncated)

== Compilation error in file lib/pelemay_sample.ex ==
** (RuntimeError) Build failed.
    lib/pelemay/generator/builder.ex:369: Pelemay.Generator.Builder.generate/1
    expanding macro: Pelemay.defpelemay/1
    lib/pelemay_sample.ex:21: PelemaySample (module)

Expected behavior
No error occurs and benchmarks will start.

Screenshots
None.

Desktop (please complete the following information):

Running CpuInfo.all_profile:

iex(1)> CpuInfo.all_profile
%{
  compiler: %{
    apple_clang: [
      %{
        bin: "/usr/bin/clang",
        type: :apple_clang,
        version: "12.0.0",
        versions: "Apple clang version 12.0.0 (clang-1200.0.32.27)"
      }
    ],
    "apple_clang++": [
      %{
        bin: "/usr/bin/clang++",
        type: :"apple_clang++",
        version: "12.0.0",
        versions: "Apple clang version 12.0.0 (clang-1200.0.32.27)"
      }
    ],
    cc_env: [],
    cflags_env: "",
    clang: [
      %{
        bin: "/usr/bin/clang",
        type: :apple_clang,
        version: "12.0.0",
        versions: "Apple clang version 12.0.0 (clang-1200.0.32.27)"
      }
    ],
    "clang++": [
      %{
        bin: "/usr/bin/clang++",
        type: :"apple_clang++",
        version: "12.0.0",
        versions: "Apple clang version 12.0.0 (clang-1200.0.32.27)"
      }
    ],
    cxx_env: [],
    cxxflags_env: "",
    "g++": [
      %{ 
        bin: "/usr/bin/g++",
        type: :"apple_clang++",
        version: "12.0.0",
        versions: "Apple clang version 12.0.0 (clang-1200.0.32.27)"
      }
    ],
    gcc: [
      %{
        bin: "/usr/bin/gcc",
        type: :apple_clang, 
        version: "12.0.0",
        versions: "Apple clang version 12.0.0 (clang-1200.0.32.27)"
      }
    ],
    ldflags_env: ""
  },
  cpu: %{
    cpu_model: "Unknown",
    cpu_models: ["Unknown"],
    cpu_type: "x86_64",
    hyper_threading: :disabled,
    num_of_cores_of_a_processor: 8,
    num_of_ecores: 0,
    num_of_pcores: 0,
    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.11.2"},
  erlang: %{otp_version: 23},
  kernel: %{
    kernel_release: "20.1.0",
    kernel_version: "Darwin 20.1.0",
    system_version: "macOS 11.0.1 (20B29)"
  },
  metal: %{metal: true}
}

Additional context
Add any other context about the problem here.

@zacky1972 zacky1972 added the bug Something isn't working label Dec 3, 2020
@zacky1972
Copy link
Collaborator Author

make -f _build/dev/lib/pelemay/build/libnifelixirpelemaysample.mk:

% make -f _build/dev/lib/pelemay/build/libnifelixirpelemaysample.mk      
/usr/bin/clang -S  -o ../obj/libnifelixirpelemaysample.s  -Ofast -g -ansi -pedantic -I/Users/zacky/github/pelemay_sample/deps/pelemay/lib/pelemay/generator/native -I/usr/local/Cellar/erlang/23.1.4/lib/erlang/erts-11.1.3/include -std=c11 -Wno-unused-function -fPIC -I`xcrun --show-sdk-path 2>/dev/null`/usr/include
clang: error: no input files
make: *** [../obj/libnifelixirpelemaysample.o] Error 1

I guess it will be compiled correctly if call CC as xrun clang instead of /usr/bin/clang.

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