Blockscout: (Mix) Could not compile dependency :keccakf1600

Created on 26 Aug 2018  路  12Comments  路  Source: blockscout/blockscout

Describe your issue here.

Trying to run the project for the first time.

Environment

  • Elixir & Erlang/OTP versions (elixir -version): Elixir 1.7.3 (compiled with Erlang/OTP 21)
  • Operating System: MacOS 10.13.6

Steps to reproduce

Step 4 in the Build and Run section

Also, I found this but didn't understand the solution (if it was proposed)

waiting on feedback

Most helpful comment

tried commenting out the environment variables as suggested above, unfortunately it didn't work for me, still getting the error 'Could not compile dependency :keccakf1600'

All 12 comments

@leonprou The issue that you referenced probably does not have any relation to the issue you're experiencing. In the referenced issue I was attempting to take a previously deployed version of explorer on Mac, with all dependencies built, and make a production build on a Linux machine.

Can you please provide more information on the error? Without seeing more it's difficult to debug.

Please make sure you have all the dependencies installed:

  • Erlang/OTP 21.0.4
  • Elixir 1.7.1
  • Postgres 10.3
  • Node.js 10.5.0
  • Automake
  • For Mac OSX users: brew install automake
  • Libtool
  • For Mac OSX users: brew install libtool

Also, please make sure all versions are correct as well.

@acravenho Hey, thanks for responding 馃憤

That's my dependencies:

  • Erlang/OTP 21 :white_check_mark:
  • IEx 1.7.3 :white_check_mark:

    • Postgres 10.5 :white_check_mark:

  • NodeJS v10.5.0 :white_check_mark:
  • automake 1.16.1
  • libtool 2.4.6

I'm executing the dependency install:
mix do deps.get, local.rebar --force, deps.compile, compile
Also, I can install the keccakf1600 module with mix deps.update keccakf1600. But when I'm doing the specified command from the README it is failing (the compilation).

And that's the part of the log with the error:

===> Compiling metrics
===> Compiling unicode_util_compat
===> Compiling idna
===> Compiling ranch
src/ranch_ssl.erl:128: Warning: ssl:ssl_accept/2: deprecated; use ssl:handshake/2 instead

==> poolboy (compile)
==> ssl_verify_fun (compile)
===> Compiling keccakf1600
LD keccakf1600.so
Undefined symbols for architecture x86_64:
"_enif_alloc_resource", referenced from:
_keccakf1600_sha3_224_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_224_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_256_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_384_nif_1 in keccakf1600_nif.o
...
"_enif_consume_timeslice", referenced from:
_keccakf1600_sha3_224_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_384_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_384_update_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_512_nif_4 in keccakf1600_nif.o
...
"_enif_get_resource", referenced from:
_keccakf1600_sha3_224_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_384_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_384_update_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_512_nif_4 in keccakf1600_nif.o
...
"_enif_get_tuple", referenced from:
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_224_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_256_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_384_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_384_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_512_update_nif_2 in keccakf1600_nif.o
...
"_enif_get_ulong", referenced from:
_keccakf1600_shake128_nif_2 in keccakf1600_nif.o
_keccakf1600_shake128_final_nif_2 in keccakf1600_nif.o
_keccakf1600_shake256_nif_2 in keccakf1600_nif.o
_keccakf1600_shake256_final_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_224_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_4 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_4 in keccakf1600_nif.o
...
"_enif_inspect_binary", referenced from:
_keccakf1600_sha3_224_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_224_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_256_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_384_nif_1 in keccakf1600_nif.o
...
"_enif_make_atom", referenced from:
_keccakf1600_nif_load in keccakf1600_nif.o
"_enif_make_badarg", referenced from:
_keccakf1600_sha3_224_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_224_init_nif_0 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_224_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_init_nif_0 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
...
"_enif_make_new_binary", referenced from:
_keccakf1600_sha3_224_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_224_init_nif_0 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_224_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_init_nif_0 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
...
"_enif_make_resource", referenced from:
_keccakf1600_sha3_224_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_384_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_384_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_512_nif_1 in keccakf1600_nif.o
...
"_enif_make_tuple", referenced from:
_keccakf1600_sha3_224_init_nif_0 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_256_init_nif_0 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_384_init_nif_0 in keccakf1600_nif.o
_keccakf1600_sha3_384_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_512_init_nif_0 in keccakf1600_nif.o
...
"_enif_make_ulong", referenced from:
_keccakf1600_sha3_224_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_384_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_384_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_512_nif_1 in keccakf1600_nif.o
...
"_enif_open_resource_type", referenced from:
_keccakf1600_nif_load in keccakf1600_nif.o
_keccakf1600_nif_upgrade in keccakf1600_nif.o
"_enif_priv_data", referenced from:
_keccakf1600_sha3_224_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_224_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_256_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_384_nif_1 in keccakf1600_nif.o
...
"_enif_release_resource", referenced from:
_keccakf1600_sha3_224_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_224_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_256_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_384_nif_1 in keccakf1600_nif.o
...
"_enif_schedule_nif", referenced from:
_keccakf1600_sha3_224_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_384_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_384_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_512_nif_1 in keccakf1600_nif.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: * [/Users/leon/workspace/blockscout/deps/keccakf1600/c_src/../priv/keccakf1600.so] Error 1
===> Hook for compile failed!

Undefined symbols for architecture x86_64:
"_enif_alloc_resource", referenced from:
_keccakf1600_sha3_224_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_224_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_224_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_256_update_nif_2 in keccakf1600_nif.o
_keccakf1600_sha3_256_final_nif_1 in keccakf1600_nif.o
_keccakf1600_sha3_384_nif_1 in keccakf1600_nif.o

This would indicate that you don't have the headers and libraries for Erlang installed or available on your linking paths as _enif_alloc_resource comes from those headers and libraries.

@leonprou how did you install Erlang and Elixir? homebrew?

@KronicDeth yeah I installed Elixir through homebrew. Didn't play a lot with it, but the iex works.

bump - i see the same thing on my machine - MacOS 10.14.0

Just noting that I had the following in my zsh profile ... commenting this out fixed the issue

    export LDFLAGS="-L${OPENSSL_PATH}/lib ${LDFLAGS}"
    export CPPFLAGS="-I${OPENSSL_PATH}/include ${CPPFLAGS}"
    export PKG_CONFIG_PATH="${OPENSSL_PATH}/lib/pkgconfig:${PKG_CONFIG_PATH}"

iirc, that stuff made it into my profile to workaround a python issue that I came across in the past

@johnhaitas Thanks, actually that's fixed my issue!

I had the following environment variables in .zshrc:

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

@KronicDeth can be closed I think

tried commenting out the environment variables as suggested above, unfortunately it didn't work for me, still getting the error 'Could not compile dependency :keccakf1600'

I'm using Debian 10, want to build BlockScout v3.5.1-beta
// Install Rustler fixed broken ex_keccak
// Using Rustler with Erlang
// you must install Erlang using asdf before install Rustler
// https://freesoft.dev/program/130553303
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
// Yeah Solved Broken ex_keccak !!!

// Bottom Error Message - Damm it... not helping debug broken things
user@iexplotech:~/IPTM2020/bs/blockscout$ mix phx.gen.secret
==> ex_keccak
Compiling NIF crate :exkeccak (native/exkeccak)...
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"
** (ErlangError) Erlang error: :enoent

I'm using Debian 10, want to build BlockScout v3.5.1-beta
// Install Rustler fixed broken ex_keccak
// Using Rustler with Erlang
// you must install Erlang using asdf before install Rustler
// https://freesoft.dev/program/130553303
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
// Yeah Solved Broken ex_keccak !!!

// Bottom Error Message - Damm it... not helping debug broken things
user@iexplotech:~/IPTM2020/bs/blockscout$ mix phx.gen.secret
==> ex_keccak
Compiling NIF crate :exkeccak (native/exkeccak)...
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"
** (ErlangError) Erlang error: :enoent

I have the same issue. Did you solve it?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dwalintukan picture dwalintukan  路  4Comments

bellaj picture bellaj  路  6Comments

ArseniiPetrovich picture ArseniiPetrovich  路  3Comments

zulhfreelancer picture zulhfreelancer  路  6Comments

gfreh picture gfreh  路  5Comments