Asdf-erlang: Compile failure with Erlang 23.0.(3,4) on macOS 10.15.6, Xcode 12

Created on 18 Sep 2020  路  5Comments  路  Source: asdf-vm/asdf-erlang

Building Erlang 23.0.3 and 23.0.4 on macOS 10.15.6 fails with

drivers/common/inet_drv.c:1484:30: error: static declaration of 'in6addr_any' follows non-static declaration
static const struct in6_addr in6addr_any = { { IN6ADDR_ANY_INIT } };
                             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet6/in6.h:211:30: note: previous declaration is here
extern const struct in6_addr in6addr_any;
                             ^
drivers/common/inet_drv.c:1493:30: error: static declaration of 'in6addr_loopback' follows non-static declaration
static const struct in6_addr in6addr_loopback =
                             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet6/in6.h:212:30: note: previous declaration is here
extern const struct in6_addr in6addr_loopback;
                             ^
 CC obj/x86_64-apple-darwin19.6.0/opt/smp/zlib_nif.o
 CC obj/x86_64-apple-darwin19.6.0/opt/smp/prim_socket_nif.o
2 errors generated.
make[4]: *** [obj/x86_64-apple-darwin19.6.0/opt/smp/inet_drv.o] Error 1
make[4]: *** Waiting for unfinished jobs....
nifs/common/prim_socket_nif.c:2903:30: error: static declaration of 'in6addr_any' follows non-static declaration
static const struct in6_addr in6addr_any = { { IN6ADDR_ANY_INIT } };
                             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet6/in6.h:211:30: note: previous declaration is here
extern const struct in6_addr in6addr_any;
                             ^
nifs/common/prim_socket_nif.c:2912:30: error: static declaration of 'in6addr_loopback' follows non-static declaration
static const struct in6_addr in6addr_loopback =
                             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet6/in6.h:212:30: note: previous declaration is here
extern const struct in6_addr in6addr_loopback;
                             ^
2 errors generated.
make[4]: *** [obj/x86_64-apple-darwin19.6.0/opt/smp/prim_socket_nif.o] Error 1
make[3]: *** [opt] Error 2
make[2]: *** [opt] Error 2
make[1]: *** [smp] Error 2
make: *** [emulator] Error 2

I just updated to Xcode 12, which is my suspicion as culprit. However I'm not knowledgeable in Erlang builds, so I'm not sure how to fix this.

Most helpful comment

All 5 comments

Looks like it may be related to #157, but I already have Xcode installed and turning off the implicit function decl warning feels wrong.

That works, except -02 should be -O2, otherwise it breaks completely. Nonetheless it seems like this shouldn't be necessary (why are we setting the optimization level?), should I file this upstream with kerl or somewhere like that?

I guess CFLAGS only works if you set an optimization level. That explains that part. Doesn't explain why it doesn't build on macOS without this flag.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeremy-postmates picture jeremy-postmates  路  6Comments

yossarin picture yossarin  路  3Comments

RobinClowers picture RobinClowers  路  3Comments

CraigCottingham picture CraigCottingham  路  4Comments

denegny picture denegny  路  6Comments