ARM - MAC M1- clang compiler

Hi Guys,

I have setup libzt with brew on my arm based MAC Silicon and have my environment all setup. when compiling the simple pingable application it produces a link error

Compiler version and Xcode version Version 14.1 (14B47b)

Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.1.0
Thread model: posix
"___gxx_personality_v0", referenced from:
      ZeroTier::Mutex::~Mutex() in libzt.a(Controls.cpp.o)
      ZeroTier::init_subsystems() in libzt.a(Controls.cpp.o)
      _zts_init_from_storage in libzt.a(Controls.cpp.o)
      _zts_init_from_memory in libzt.a(Controls.cpp.o)
      _zts_init_set_event_handler in libzt.a(Controls.cpp.o)
      _zts_init_blacklist_if in libzt.a(Controls.cpp.o)
      _zts_init_set_roots in libzt.a(Controls.cpp.o)
      ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Will there be support for arm based silicon with libzt?

thanks in advance

Hey James,

I tried to replicate this two ways (using our homebrew tap, and cloning directly from our repo) and both worked without error.

I also checked my version of clang and it matches yours exactly. Iā€™m running an M1 and compiled the example like so:

clang pingable-node.c -L/opt/homebrew/Cellar/libzt/1.8.1/lib -lzt -I/opt/homebrew/Cellar/libzt/1.8.1/include

Can you show me your exact compilation steps?

1 Like

Hi Joseph,

Thanks for the quick response, I cant believe how quick the M1 Max is on compiling, I have installed with homebrew and was running
clang pingable-node.c -o pn /opt/homebrew/Cellar/libzt/1.8.1/lib/libzt.a -I/opt/homebrew/Cellar/libzt/1.8.1/include -lpthread

I saw you had a different options and tried that also
clang pingable-node.c -L/opt/homebrew/Cellar/libzt/1.8.1/lib -lzt -I/opt/homebrew/Cellar/libzt/1.8.1/include

The above completes but I dont find a binary in my project folder (correction) I found a a.out I forgot my -o pingable-node at the end doh!

Thanks Joseph, thats got me running I was using the wrong clang parameters from old macbook pro.

No problem at all! Good luck!

1 Like