[XDA Assist] pobetiger:
Hello xda-assist,

I've been trying to build cm-11 for a while following their build instructions. I'm building on a mac os x 10.9.5 with Xcode

I've pulled the repo from official cm-11 and followed all the setup steps for building on mac. But I keep getting stuck with errors as follow:

host C: libmincrypt <= system/core/libmincrypt/dsa_sig.c
host C: libmincrypt <= system/core/libmincrypt/p256.c
host C: libmincrypt <= system/core/libmincrypt/p256_ec.c
host C: libmincrypt <= system/core/libmincrypt/p256_ecdsa.c
host C: libmincrypt <= system/core/libmincrypt/rsa.c
cc1: error: unrecognized command line option "-arch"
cc1: error: unrecognized command line option "-Wno-nested-anon-types"
cc1: error: unrecognized command line option "-arch"
cc1: error: unrecognized command line option "-Wno-nested-anon-types"
make: *** [/Volumes/android/build_output/system/host/darwin-x86/obj/STATIC_LIBRARIES/libmincrypt_intermediates/p256_ec.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [/Volumes/android/build_output/system/host/darwin-x86/obj/STATIC_LIBRARIES/libmincrypt_intermediates/dsa_sig.o] Error 1
cc1: error: unrecognized command line option "-arch"
cc1: error: unrecognized command line option "-Wno-nested-anon-types"
cc1: error: unrecognized command line option "-arch"
cc1: error: unrecognized command line option "-Wno-nested-anon-types"
cc1: error: unrecognized command line option "-arch"
cc1: error: unrecognized command line option "-Wno-nested-anon-types"
make: *** [/Volumes/android/build_output/system/host/darwin-x86/obj/STATIC_LIBRARIES/libmincrypt_intermediates/p256_ecdsa.o] Error 1
make: *** [/Volumes/android/build_output/system/host/darwin-x86/obj/STATIC_LIBRARIES/libmincrypt_intermediates/p256.o] Error 1
make: *** [/Volumes/android/build_output/system/host/darwin-x86/obj/STATIC_LIBRARIES/libmincrypt_intermediates/rsa.o] Error 1
GEN include/applets.h
GEN include/usage.h

After some debugging it turns out it's running prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1, which does not support the -arch and the -Wno-nested-anon-types flags.

I've googled and search the forum for keywords but I have no been able to find any help.

I've checked my path and verifies that /opt/local/bin (using macport) is in the front of the default /usr/bin:

$ echo $PATH | sed 's/:/\'$'\n/g'
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin
/Volumes/android/build_output/system/host/darwin-x86/bin
/Volumes/android/cm-11/system/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.7/bin
/Volumes/android/cm-11/system/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.7/bin
/Volumes/android/cm-11/system/prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.7/bin
/Volumes/android/cm-11/system/development/emulator/qtools
/Volumes/android/cm-11/system/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.7/bin
/Volumes/android/cm-11/system/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.7/bin
/Volumes/android/cm-11/system/development/scripts
/Volumes/android/cm-11/system/prebuilts/devtools/tools
/Users/pobetiger/bin
/opt/local/bin
/opt/local/sbin
/usr/local/bin
/Applications/eclipse
~/android-sdks/platform-tools
~/android-sdks/tools
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/opt/X11/bin
/usr/local/git/bin
/Applications/MacVim.app/Contents/MacOS

But this does not seem to be important...my build/core/combo/HOST_darwin-x86.mk contains this line (line 80):

HOST_TOOLCHAIN_ROOT := prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1
HOST_TOOLCHAIN_PREFIX := $(HOST_TOOLCHAIN_ROOT)/bin/i686-apple-darwin$(gcc_darwin_version)
# Don't do anything if the toolchain is not there
ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)-gcc)))
HOST_CC := $(HOST_TOOLCHAIN_PREFIX)-gcc
HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)-g++

ifeq ($(mac_sdk_version),10.9)
HOST_GLOBAL_CFLAGS += -I$(mac_sdk_root)/usr/include/c++/4.2.1 -arch i386 -Wno-nested-anon-types -Wno-unused-parameter
HOST_GLOBAL_LDFLAGS += -Wl,-arch,i386,-lstdc++

Which says it will always use the prebuilts/gcc/darwin-x86/host compiler.

So this is not a path setup issue. Not sure how to get around this. Any pointers to threads or right place to post the issue would be very helpful.