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

**URL:** <https://erlangforums.com/t/compiling-erlang-on-m2-libobjc-a-dylib-for-architecture-arm64-error/3534>\
**Category:** Questions / Help\
**Tags:** erlang-otp\
**Created:** [April 29, 2024, 11:45pm UTC](https://erlangforums.com/t/compiling-erlang-on-m2-libobjc-a-dylib-for-architecture-arm64-error/3534 "2024-04-29T23:45:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chiroptical](https://erlangforums.com/user_avatar/erlangforums.com/chiroptical/32/2044_2.png) [@chiroptical](https://erlangforums.com/u/chiroptical)\
**Post date:** [April 29, 2024, 11:45pm UTC](https://erlangforums.com/t/compiling-erlang-on-m2-libobjc-a-dylib-for-architecture-arm64-error/3534/1 "2024-04-29T23:45:55Z")

</div>

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

```erlang
$ 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.

---

<div class="post-metadata">

**Author:** ![bjorng](https://erlangforums.com/user_avatar/erlangforums.com/bjorng/32/174_2.png) [@bjorng](https://erlangforums.com/u/bjorng)\
**Post date:** [April 30, 2024, 3:17am UTC](https://erlangforums.com/t/compiling-erlang-on-m2-libobjc-a-dylib-for-architecture-arm64-error/3534/2 "2024-04-30T03:17:46Z")

</div>

> [@chiroptical](#):
>
> ```erlang
> $ LDFLAGS="-F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/" ./configure --without-termcap
> 
> ```

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:

```erlang
% ./configure
% make

```

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

---

<div class="post-metadata">

**Author:** ![chiroptical](https://erlangforums.com/user_avatar/erlangforums.com/chiroptical/32/2044_2.png) [@chiroptical](https://erlangforums.com/u/chiroptical)\
**Post date:** [April 30, 2024, 2:23pm UTC](https://erlangforums.com/t/compiling-erlang-on-m2-libobjc-a-dylib-for-architecture-arm64-error/3534/3 "2024-04-30T14:23:37Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![chiroptical](https://erlangforums.com/user_avatar/erlangforums.com/chiroptical/32/2044_2.png) [@chiroptical](https://erlangforums.com/u/chiroptical)\
**Post date:** [April 30, 2024, 2:50pm UTC](https://erlangforums.com/t/compiling-erlang-on-m2-libobjc-a-dylib-for-architecture-arm64-error/3534/4 "2024-04-30T14:50:56Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![chiroptical](https://erlangforums.com/user_avatar/erlangforums.com/chiroptical/32/2044_2.png) [@chiroptical](https://erlangforums.com/u/chiroptical)\
**Post date:** [April 30, 2024, 5:07pm UTC](https://erlangforums.com/t/compiling-erlang-on-m2-libobjc-a-dylib-for-architecture-arm64-error/3534/5 "2024-04-30T17:07:52Z")

</div>

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

```erlang
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`.
