asdf-vm / asdf-erlang

Erlang plugin for asdf version manager
https://github.com/asdf-vm/asdf
MIT License
482 stars 119 forks source link

Can't compile any erlang version in MacOS Catalina 10.15.7 #169

Closed palcalde closed 2 years ago

palcalde commented 4 years ago

Hello! Don't know how but since some months ago I'm just unable to install any erlang version (i've tried OTP21, OTP22, OTP23 and the error is always the same) with asdf so I'm currently stuck with the brew one. I've tried for hours but no luck, I've tried updating asdf, updating kerl, updating LD, updating Xcode and also with old versions of it, nothing works, error is always the same.

The error seems to be related with kerl and some binary missing symbols for architecture x86_64. However, I see that the binary is inside .asdf so no idea how can this happen.

➜  rider-cp git:(disable_perk_from_prod) ✗ asdf install erlang 23.0.3
asdf_23.0.3 is not a kerl-managed Erlang/OTP installation
The asdf_23.0.3 build has been deleted
Extracting source code
Building Erlang/OTP 23.0.3 (asdf_23.0.3), please wait...
APPLICATIONS DISABLED (See: /Users/pabloa/.asdf/plugins/erlang/kerl-home/builds/asdf_23.0.3/otp_build_23.0.3.log)
 * jinterface     : Java compiler disabled by user

Build failed.
  "_ei_x_new", referenced from:
      _main in erl_call-ec13fc.o
  "_ei_x_new_with_version", referenced from:
      _main in erl_call-ec13fc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [/Users/pabloa/.asdf/plugins/erlang/kerl-home/builds/asdf_23.0.3/otp_src_23.0.3/lib/erl_interface/bin/x86_64-apple-darwin19.6.0/erl_call] Error 1
make[2]: *** [opt] Error 2

gcc version

gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

You can see I'm using Xcode12, but I've tried with Xcode11 and Xcode11.03 and the problem still persists.

LD version

ld -v
@(#)PROGRAM:ld  PROJECT:ld64-609
BUILD 07:59:13 Aug 25 2020
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 12.0.0, (clang-1200.0.32.2) (static support for 27, runtime is 27)
TAPI support using: Apple TAPI version 12.0.0 (tapi-1200.0.23)

Any help with this is much appreciated! 🙇

zhangzhen commented 4 years ago

I have the same problem as you.

Stratus3D commented 4 years ago

I have not experienced this issue. It may be worth opening an issue on https://github.com/kerl/kerl since asdf-erlang uses kerl for Erlang builds.

seivan commented 3 years ago

@zhangzhen @palcalde What are the config options you used while installing?

menty44 commented 3 years ago

Hello! Don't know how but since some months ago I'm just unable to install any erlang version (i've tried OTP21, OTP22, OTP23 and the error is always the same) with asdf so I'm currently stuck with the brew one. I've tried for hours but no luck, I've tried updating asdf, updating kerl, updating LD, updating Xcode and also with old versions of it, nothing works, error is always the same.

The error seems to be related with kerl and some binary missing symbols for architecture x86_64. However, I see that the binary is inside .asdf so no idea how can this happen.

➜  rider-cp git:(disable_perk_from_prod) ✗ asdf install erlang 23.0.3
asdf_23.0.3 is not a kerl-managed Erlang/OTP installation
The asdf_23.0.3 build has been deleted
Extracting source code
Building Erlang/OTP 23.0.3 (asdf_23.0.3), please wait...
APPLICATIONS DISABLED (See: /Users/pabloa/.asdf/plugins/erlang/kerl-home/builds/asdf_23.0.3/otp_build_23.0.3.log)
 * jinterface     : Java compiler disabled by user

Build failed.
  "_ei_x_new", referenced from:
      _main in erl_call-ec13fc.o
  "_ei_x_new_with_version", referenced from:
      _main in erl_call-ec13fc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [/Users/pabloa/.asdf/plugins/erlang/kerl-home/builds/asdf_23.0.3/otp_src_23.0.3/lib/erl_interface/bin/x86_64-apple-darwin19.6.0/erl_call] Error 1
make[2]: *** [opt] Error 2

gcc version

gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

You can see I'm using Xcode12, but I've tried with Xcode11 and Xcode11.03 and the problem still persists.

LD version

ld -v
@(#)PROGRAM:ld  PROJECT:ld64-609
BUILD 07:59:13 Aug 25 2020
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 12.0.0, (clang-1200.0.32.2) (static support for 27, runtime is 27)
TAPI support using: Apple TAPI version 12.0.0 (tapi-1200.0.23)

Any help with this is much appreciated! 🙇

Same issue, am using high siera

timuryan commented 3 years ago

non-cctools build tools are used. Make sure that Apple's toolchain is used. You could try to remove Homebrew's binutils or adjust the $PATH variable.

% $(which ranlib) -V Apple Inc. version cctools-977.1

palcalde commented 2 years ago

Fixed!

I removed ranlib GCC version which was in /usr/local/bin/ranlib and now its picking the /usr/bin/ranlib one which is the Apple Inc Version u mentioned. Now I was able to install erlang fine!

$(which ranlib) -V
Apple Inc. version cctools-977.1
error: /Library/Developer/CommandLineTools/usr/bin/ranlib: no archives specified
Usage: /Library/Developer/CommandLineTools/usr/bin/ranlib [-sactfqLT] [-] archive [...]
asdf install erlang 24.0.6
asdf_24.0.6 is not a kerl-managed Erlang/OTP installation
The asdf_24.0.6 build has been deleted
Extracting source code
Building Erlang/OTP 24.0.6 (asdf_24.0.6), please wait...
APPLICATIONS DISABLED (See: /Users/pabloa/.asdf/plugins/erlang/kerl-home/builds/asdf_24.0.6/otp_build_24.0.6.log)
 * crypto         : No usable OpenSSL found
 * ssh            : No usable OpenSSL found
 * ssl            : No usable OpenSSL found

Erlang/OTP 24.0.6 (asdf_24.0.6) has been successfully built
Installing Erlang/OTP 24.0.6 (asdf_24.0.6) in /Users/pabloa/.asdf/installs/erlang/24.0.6...
You can activate this installation running the following command:
. /Users/pabloa/.asdf/installs/erlang/24.0.6/activate
Later on, you can leave the installation typing:

Thank you @timuryan!