anoma / green

https://anoma.github.io/anoma/
MIT License
7 stars 0 forks source link

erlang-xxhash does not run on an M3 #468

Closed mariari closed 2 months ago

mariari commented 6 months ago

customer: @adrianbrink performer: deadline: null estimated: null started: null actual: null completed: null confirmed: null dependencies:


It seems that our dependency:

      {:xxhash,
       git: "https://github.com/htdat148/erlang-xxhash-otp-26",
       branch: "fix_erlang_get_path_otp26"},

https://github.com/htdat148/erlang-xxhash-otp-26"

Does not properly work on an M3 mac.

We get the following issue

➜  c_src git:(fix_erlang_get_path_otp26) make
cc -O3 -std=c99 -Wall -W -Wundef -Wmissing-prototypes -Wno-implicit-function-declaration -fPIC -I /Users/two/.asdf/installs/erlang/26.2.5/erts-14.2.5/include/ -I /Users/two/.asdf/installs/erlang/26.2.5/lib/erl_interface-5.5.1/include -I/opt/homebrew/opt/unixodbc/include -I/opt/homebrew/opt/unixodbc/include -c -o /Users/two/RED/code/experiments/erlang-xxhash-otp-26/c_src/xxhash.o /Users/two/RED/code/experiments/erlang-xxhash-otp-26/c_src/xxhash.c
cc -O3 -std=c99 -Wall -W -Wundef -Wmissing-prototypes -Wno-implicit-function-declaration -fPIC -I /Users/two/.asdf/installs/erlang/26.2.5/erts-14.2.5/include/ -I /Users/two/.asdf/installs/erlang/26.2.5/lib/erl_interface-5.5.1/include -I/opt/homebrew/opt/unixodbc/include -I/opt/homebrew/opt/unixodbc/include -c -o /Users/two/RED/code/experiments/erlang-xxhash-otp-26/c_src/xxhash_nif.o /Users/two/RED/code/experiments/erlang-xxhash-otp-26/c_src/xxhash_nif.c
cc /Users/two/RED/code/experiments/erlang-xxhash-otp-26/c_src/xxhash.o /Users/two/RED/code/experiments/erlang-xxhash-otp-26/c_src/xxhash_nif.o -L/opt/homebrew/opt/unixodbc/lib -L/opt/homebrew/opt/unixodbc/lib -shared -L /Users/two/.asdf/installs/erlang/26.2.5/lib/erl_interface-5.5.1/lib -lei -o /Users/two/RED/code/experiments/erlang-xxhash-otp-26/c_src/../priv/xxhash.so
Undefined symbols for architecture arm64:
  "_enif_alloc_resource", referenced from:
      _nif_hash32_init in xxhash_nif.o
      _nif_hash64_init in xxhash_nif.o
  "_enif_get_resource", referenced from:
      _nif_hash32_update in xxhash_nif.o
      _nif_hash32_digest in xxhash_nif.o
      _nif_hash64_update in xxhash_nif.o
      _nif_hash64_digest in xxhash_nif.o
  "_enif_get_uint", referenced from:
      _nif_hash32 in xxhash_nif.o
      _nif_hash32_init in xxhash_nif.o
  "_enif_get_ulong", referenced from:
      _nif_hash64 in xxhash_nif.o
      _nif_hash64_init in xxhash_nif.o
  "_enif_inspect_binary", referenced from:
      _nif_hash32 in xxhash_nif.o
      _nif_hash32_update in xxhash_nif.o
      _nif_hash64 in xxhash_nif.o
      _nif_hash64_update in xxhash_nif.o
  "_enif_make_atom", referenced from:
      _init in xxhash_nif.o
  "_enif_make_badarg", referenced from:
      _nif_hash32 in xxhash_nif.o
      _nif_hash32_init in xxhash_nif.o
      _nif_hash32_update in xxhash_nif.o
      _nif_hash32_digest in xxhash_nif.o
      _nif_hash64 in xxhash_nif.o
      _nif_hash64_init in xxhash_nif.o
      _nif_hash64_update in xxhash_nif.o
      ...
  "_enif_make_resource", referenced from:
      _nif_hash32_init in xxhash_nif.o
      _nif_hash64_init in xxhash_nif.o
  "_enif_make_uint", referenced from:
      _nif_hash32 in xxhash_nif.o
      _nif_hash32_digest in xxhash_nif.o
  "_enif_make_ulong", referenced from:
      _nif_hash64 in xxhash_nif.o
      _nif_hash64_digest in xxhash_nif.o
  "_enif_open_resource_type", referenced from:
      _init in xxhash_nif.o
  "_enif_release_resource", referenced from:
      _xxhash_cleanup in xxhash_nif.o
      _nif_hash32_init in xxhash_nif.o
      _nif_hash64_init in xxhash_nif.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/two/RED/code/experiments/erlang-xxhash-otp-26/c_src/../priv/xxhash.so] Error 1
➜  c_src git:(fix_erlang_get_path_otp26)

Probably just the right C flags need to be passed to the system to make this compile

mariari commented 6 months ago

This can be solved by anoma/green#43

mariari commented 2 months ago

Done in V0.20.0