ArweaveTeam / arweave

The Arweave server and App Developer Toolkit.
https://www.arweave.org
GNU General Public License v2.0
911 stars 201 forks source link

Cannot compile on Mac OS #347

Open iamgenchi opened 2 years ago

iamgenchi commented 2 years ago

MacBookPro Processor 2.4 GHz 8-Core Intel Core i9 MacOS Monterey 12.1

$ ./rebar3 as prod tar
....

===> Compiling /Users/genchi/Mining/arweave/c_src/b64fast.c
===> /Users/genchi/Mining/arweave/c_src/b64fast.c:38:64: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
        unbase64(bin.data+i, end-i, res+i*3/4, res_size-i*3/4, &illegal_char_error);
                                                               ^~~~~~~~~~~~~~~~~~~
c_src/naive.h:117:113: note: passing argument to parameter 'illegal_char_error' here
unbase64(const unsigned char* ascii, unsigned int len, unsigned char *bin, unsigned int bin_size, unsigned int *illegal_char_error)
                                                                                                                ^
/Users/genchi/Mining/arweave/c_src/b64fast.c:126:9: error: implicitly declaring library function 'memcpy' with type 'void *(void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
        memcpy(no_space_binary, bin.data, bin.size);
        ^
/Users/genchi/Mining/arweave/c_src/b64fast.c:126:9: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
1 warning and 1 error generated.
oday0311 commented 2 years ago

meet the same problem on mac,

ldmberman commented 2 years ago

@iamgenchi, @oday0311 I recommend you install gcc-10, then build via CFLAGS=-m64 CC=gcc-10 AR=gcc-10-ar CXX=g++-10 ./rebar3 ...

daocodedao commented 2 years ago

gcc@10: The x86_64 architecture is required for this software. Mac M1 can't installed

goomario commented 2 years ago

Try CFLAGS="-Wno-pointer-sign -Wno-implicit-function-declaration" ./rebar3 compile

fremgang commented 2 years ago

~THIS WORKED FOR ME~

God a new delayed compile error. I have no luck getting this to work. Ideas?

Erlang spec:

▶ erl
Erlang/OTP 25 [erts-13.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns] [dtrace]
`c++ -O3 -arch x86_64 -finline-functions -fPIC -I /usr/local/Cellar/erlang/25.0_1/lib/erlang/erts-13.0/include/ -I /usr/local/Cellar/erlang/25.0_1/lib/erlang/lib/erl_interface-5.3/include -std=c++11 -Wall  -c -o prometheus_process_collector_nif.o prometheus_process_collector_nif.cc
c++ -O3 -arch x86_64 -finline-functions -fPIC -I /usr/local/Cellar/erlang/25.0_1/lib/erlang/erts-13.0/include/ -I /usr/local/Cellar/erlang/25.0_1/lib/erlang/lib/erl_interface-5.3/include -std=c++11 -Wall  -c -o prometheus_process_info_macos.o prometheus_process_info_macos.cc
cc prometheus_process_collector_nif.o prometheus_process_info_macos.o -arch x86_64 -flat_namespace -undefined suppress -shared -L /usr/local/Cellar/erlang/25.0_1/lib/erlang/lib/erl_interface-5.3/lib -lei -lstdc++ -o /Users/jonasthoresen/Documents/arweave/_build/default/lib/prometheus_process_collector/c_src/../priv/prometheus_process_collector.so
=ERROR REPORT==== 20-Jun-2022::23:27:49.521771 ===
beam/beam_load.c(148): Error loading module enc:
  please re-compile this module with an Erlang/OTP 25 compiler

escript: exception error: undefined function enc:main/1
  in function  escript:run/2 (escript.erl, line 750)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1 
  in call from init:do_boot/3 
===> Hook for compile failed!´´´`
paradite commented 2 years ago

@fremgang you can install Erlang/OTP 23 by running brew install erlang@23 and follow the post install actions by brew.