Installing Erlang R16B on Max OSX 10.8.4 using Homebrew - Undefined symbols for architecture x86_64: '___sync_val_compare_and_swap_1'
Last week, I upgraded my personal laptop from a 2007 15" Macbook Pro to a brand, spanking new 13" Air.
I've been playing around with Elixir recently, so set about installing Erlang and Elixir with Homebrew.
Unfortunately, compilation of Erlang failed. In the end the solution was simple, but it took a little more googling for the error than I expected so I'm centralizing the solution here.
This is the error I was getting when running
brew install -v erlang-r16.
Undefined symbols for architecture x86_64: "___sync_val_compare_and_swap_1", referenced from: _ethr_dw_atomic_cmpxchg in libethread.a(ethr_atomics.o) _ethr_dw_atomic_cmpxchg_ddrb in libethread.a(ethr_atomics.o) _ethr_dw_atomic_cmpxchg_rb in libethread.a(ethr_atomics.o) _ethr_dw_atomic_cmpxchg_wb in libethread.a(ethr_atomics.o) _ethr_dw_atomic_cmpxchg_acqb in libethread.a(ethr_atomics.o) _ethr_dw_atomic_cmpxchg_relb in libethread.a(ethr_atomics.o) _ethr_dw_atomic_cmpxchg_mb in libethread.a(ethr_atomics.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: *** [/private/tmp/erlang-h2cL/otp-OTP_R15B03-1/bin/i386-apple-darwin13.0.0/beam.smp] Error 1 make: *** [opt] Error 2 make: *** [smp] Error 2 make: *** [emulator] Error 2
Solution: Compile using GCC
I eventually found the solution on the Elixir mailing list where none other than Dave Thomas was having the same problem.
Erlang compiles without issue if you use GCC instead of Clang. But first you need to make sure you have GCC installed.
Here are the specific commands I ran to install GCC and Erlang:
brew tap homebrew/dupes brew install apple-gcc42 brew tap homebrew/versions brew install -v --use-gcc erlang-r16
That took care of installing Erlang for me and then I could processd to
brew install elixir without any issue.
More Articles on Software & Product Development
- Agile With a Lowercase “a”
- ”Agile“ is an adjective. It is not a noun. It isn’t something you do, it is something you are.
- How Do You End Up With A Great Product A Year From Now?
- Nail the next two weeks. 26 times in a row.
- Build it Twice
- Resist the urge to abstract until you've learned what is general to a class of problems and what is specific to each problem.