exthereum / abi

The Ethereum ABI Interface
MIT License
20 stars 22 forks source link

Got on_load_function_failed when trying to start release. #14

Closed PavelVesnin closed 6 years ago

PavelVesnin commented 6 years ago

Hi. Cannot start release with compiled :libsecp256k1 library. Release failed on docker container with Alpine and local Mac. I don't see libsecp256k1_nif.so in priv dir. Could it raise an error?


{supervisor,kernel,['Argument__1']}
<0.1384.0>
[]
{exit,{on_load_function_failed,libsecp256k1},[{init,run_on_load_handlers,0,[]},{kernel,init,1,[{file,"kernel.erl"},{line,217}]},{supervisor,init,1,[{file,"supervisor.erl"},{line,294}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,365}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,333}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
    initial_call:     pid:     registered_name:     error_info:     ancestors:     message_queue_len:     messages:     links:     dictionary:     trap_exit:     status:     heap_size:     stack_size:     reductions: 2018-06-04 14:21:43 supervisor_report   
[kernel_sup,<0.1360.0>]
0
[]
[<0.1361.0>]
[]
true
running
610
27
235
{local,kernel_sup}
start_error
{on_load_function_failed,libsecp256k1}
[{pid,undefined},{id,kernel_safe_sup},{mfargs,{supervisor,start_link,[{local,kernel_safe_sup},kernel,safe]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]
{application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}
    supervisor:     errorContext:     reason:     offender: 2018-06-04 14:21:44 crash_report        
<0.1359.0>
[]
{exit,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,libsecp256k1}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,134}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
[<0.1358.0>]
1
[{'EXIT',<0.1360.0>,normal}]
[<0.1358.0>,<0.1357.0>]
[]
true
running
376
27
213
    initial_call:     pid:     registered_name:     error_info:     ancestors:     message_queue_len:     messages:     links:     dictionary:     trap_exit:     status:     heap_size:     stack_size:     reductions: 2018-06-04 14:21:44 std_info            
kernel
{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,libsecp256k1}}},{kernel,start,[normal,[]]}}
permanent
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,libsecp256k1}}},{kernel,start,[normal,[]]}}}"}
    application:     exited:     type: Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,libsecp256k1}}},{kernel,start,[normal,[]]}}
Crash dump is being written to: erl_crash.dump...done```
hayesgm commented 6 years ago

Sorry, this is an issue with the libsecp256k1 library, which has a configuration issue. Can you try running this (from here):

export "CFLAGS=-I/usr/local/include -L/usr/local/lib"
cd deps/libsecp256k1 && rebar compile
mix compile
PavelVesnin commented 6 years ago

Yes, it works. Thank you!

PavelVesnin commented 6 years ago

@hayesgm I'm tried to make PR with libsecp256k1 compile documentation, but it's not allowed. Should I create PR from fork?

PavelVesnin commented 6 years ago

Also, could you ever trying to run ABI in docker based on alpine?

hayesgm commented 6 years ago

@PavelVesnin Here's (more or less) what my Dockerfile looks like for running ABI on Alpine Linux:

FROM bitwalker/alpine-elixir:1.6.1

RUN apk update

RUN apk add --update --no-cache --virtual build-dependencies \
    musl-dev=1.1.18-r3 \
    python2 automake libtool autoconf build-base gcc abuild \
    binutils binutils-doc gcc-doc

RUN apk add --update --no-cache --virtual node-dependencies \
    git make g++ nodejs nodejs-npm python2

RUN apk add --no-cache gmp-dev

# Add your files
ADD . /deploy/app

# Next, run deps.build on our project
RUN cd /deploy/app && mix deps.get && mix deps.compile

# and compile libsecp256ka
RUN cd /deploy/app/deps/libsecp256k1 && /opt/app/.mix/rebar compile

# run full compilation
RUN mix do deps.get, compile

# remove dev dependencies
RUN apk del build-dependencies node-dependencies

# run mix on start
CMD mix run --no-halt
atoulme commented 6 years ago

With pull request #23 we have upgraded to the latest libsecp256k1 library which should install correctly without the need for extra steps.

Please test it out and let us know.