I have been annoyed by the following error in installing Erlang with
asdf on Mac.
LD /Users/xxxx/.asdf/plugins/erlang/kerl-home/builds/asdf_26.0/otp_src_26.0/lib/erl_interface/bin/x86_64-apple-darwin22.4.0/erl_call ld: warning: ignoring file /Users/xxxxxx/.asdf/plugins/erlang/kerl-home/builds/asdf_26.0/otp_src_26.0/lib/erl_interface/obj/x86_64-apple-darwin22.4.0/libei.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64 Undefined symbols for architecture x86_64: "___erl_errno_place", referenced from: _main in erl_call-456a49.o "_ei_connect", referenced from: _main in erl_call-456a49.o
Then I resolved this issue, and would like you to know about it.
The issue says that Linker(LD) can’t read
libei.a archive file which is made by
ranlib. At last symbols in libei.a can’t be found to make an error of “undefined symbols.”
When I checked
ranlib, there are two sets on my Mac.
$ which -a ar /usr/local/opt/binutils/bin/ar /usr/bin/ar
So I found
binutils/bin/ar, ranlib causes this issue because archives by
binutils is different from one by
binutils, it worked without any errors.
I don’t know if we need the
binutils of Gnu. But I think it shouldn’t be installed on Mac.
binutils is used to build cross-compilers themself, it is necessary to note this.
Additionally, I am using
asdf to install Erlang instead of
asdf builds Erlang by Makefile, but the
brew seems only to get the object for Mac. So Installing with the
brew works fine.