Compiling Erlang on M2 (libobjc.A.dylib for architecture arm64 error)

I am trying to submit a patch for OTP but I am unable to get the code to compile.

$ LDFLAGS="-F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/" ./configure --without-termcap
$ make
...
ld: file not found: /usr/lib/libobjc.A.dylib for architecture arm64
collect2: error: ld returned 1 exit status
make[4]: *** [/Users/chiroptical/programming/erlang/otp/bin/aarch64-apple-darwin23.4.0/beam.jit] Error 1
make[3]: *** [opt] Error 2
make[2]: *** [opt] Error 2
make[1]: *** [jit] Error 2
make: *** [emulator] Error 2

Does this mean anything to anyone?

Any tips for getting ncurses enabled is also appreciated.

1 Like

Why do you set LDFLAGS?

Do you have the full Xcode application installed or just the command-line tools?

I have the Xcode application installed. I build like this:

% ./configure
% make

I would expect that having just the command-line tools installed should also work, but I have never tried it.

1 Like

I set LDFLAGS because it complained (and gave a nice error message about adding this -F flag). I have installed Xcode but maybe I need to install the command line tools (not exactly sure what this means, but I’ll google it) or add Xcode stuff to my PATH. I’ll try again tonight.

Side note: I haven’t done much OSX dev outside of nix shells so I am very rusty here. Thanks for the direction!

For posterity, the “nice error” isn’t nice but was google-able.

ld: framework not found Carbon
collect2: error: ld returned 1 exit status

Okay, to give an update here. This is on me. I am using home-manager to manage my development tools. I added,

home.packages = with pkgs; [
  clang
  clang-tools
  darwin.xcode
  darwin.apple_sdk.frameworks.Carbon
  darwin.libobjc
  wxGTK32
]

and removed gcc. Then, I was able to build with ./configure && make.

1 Like