yashsingh1/xdaforums huggingface dataset:
[XPERIA X8 General] her3814:
you have : install 1.6 Stock ROM, an get the Original Code of your phone, that one you changed in build.prop to get the first time you flashed your phone for getting root and 2.1.a.0.6 ROM, (the code like 1234-0000) or something like that, you need the original one, then, edit the build.prop of the 1.6 rom installed on your phone, and put the original code, and connect your phone to PC Companion, so it'll update your phone to the 2.1 Orange Branded ROM
[XPERIA X8 General] athulele:
What is orange branded rom??
[XPERIA X8 General] reytorres:
how about kernel?

i just want to know, if i use seus update does it also bring back original kernel of my xperia x8 if i update it using seus?

if it didnt, then please give me some guide please,

im currently using mini cm7 / kernel aA-11 and i want to bring it back to original rom and kernel please help me
[XPERIA X8 General] pipi14:
Ofcourse it will flash all back to stock...
[Android Software Development] ArmanUV:
I updated OP with some updated info about Xcode 4.3.
[Android Software Development] conantroutman:
Nice work man. Very helpful.
[Android Software Development] ArmanUV:
thanks! I'll try to keep this topic updated as issues with mac are introduced/resolved.
[Android Software Development] grad061980:
Nice write up. Thanks.

Before I start again from scratch I have a question. Does this guide apply to previous versions of mac os x (mine is 10.6.8)? I used the official android initializing build environment page & cm7 wiki page for the instructions to setup my build environment.

Also, any tips to switch from macports to homebrew?

In the past I've had to cherry pick to get my OS X build environment set up for CM9. The compile from source fails because I started with macports instead of homebrew (bad idea). I tried to switch to homebrew without success. Any tips to switch from macports to homebrew?

For the sake of keeping this page on topic a pm response is ok if that is what you prefer.
[Android Software Development] WonkyYew:
Hi thanks for this !! Helpful one question what do i change so i can do AOSP instead of cm9??
[Android Software Development] ArmanUV:
Yes, this guide should work fine on Snow Leopard. It mostly depends on your Xcode version. If you have Xcode 3, you can skip step 1 entirely, since you already have gcc4.2 as part of Xcode.

If you have access to Xcode 4.2 and above, you will need to install gcc4.2 separately, as explained in the guide.

Now regarding Macports, I strongly suggest that you completely uninstall Macports before installing homebrew. Instructions are here: http://guide.macports.org/chunked/installing.macports.uninstalling.html

Full instructions are available on android.com : http://source.android.com/source/initializing.html

If you are using this guide, you need to change the repo initialization command to :

repo init -u https://android.googlesource.com/platform/manifest

and then do repo sync. You can setup ccache as usual. I don't think AOSP has the "brunch command", so you have to use launch and then make.

Run "lunch" and select an option from the menu. You can find more info about the options here: http://source.android.com/source/building.html. For maguro, you should use "full_maguro-userdebug".

To start the build, use

make -j$(sysctl -n hw.ncpu)
[Android Software Development] grad061980:
@ArmanUV. Sounds good & thanks for the input. I'll give the link to macports uninstall a go.
[Android Software Development] the5:
Im a real noob, whats the advantage of compiling from source?
[Android Software Development] WonkyYew:
Thanks for the help man !
[Android Software Development] empyyy:
Hi, thanks for your guide, setting up the repo was no problem at all!

But: I'm getting the following error when building.

external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libz_intermediates/adler32.o] Error 1
make: *** Waiting for unfinished jobs....

Seems to be a problem with the compiler, but I'm on xcode 4.3 and I've installed gcc-4.2 and set the env vars. Any help?
[Android Software Development] topprospect:
ArmanUV,

Thanks so much for posting this guide. Very helpful!

Are you having any trouble with errors like this?

external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints

Googling for this error implies that the fix is to use a version of GCC > 4.2. But there does not seem to be a GCC 4.4 in Homebrew.

Thanks again for the guide!

EDIT: Sorry for the double post with empyyy. Seems like there is someone else having my same issue!
[Android Software Development] ArmanUV:
You guys seem to have the same issue. What sort of Xcode configuration are you using? Can you post the output from "which gcc","which g++", "gcc -v", "g++ -v" and "cc -v"?
[Android Software Development] topprospect:
I am on Lion 10.7.4 with Xcode 4.3.2. Here is the output that you asked for:

# echo -n "which gcc: "; which gcc; echo -n "which g++: "; which g++; echo ""; echo "gcc -v:"; gcc -v; echo ""; echo "g++ -v:"; g++ -v; echo ""; echo "cc -v:"; cc -v
which gcc: /usr/bin/gcc
which g++: /usr/bin/g++

gcc -v:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

g++ -v:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

cc -v:
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix

They are pointing to LLVM, but my CC and CXX variables point to:

env|grep 4.2
CXX=/usr/local/bin/g++-4.2
CC=/usr/local/bin/gcc-4.2

Do I need to add something to PATH? I'm sure I just missed something obvious in your instructions.. Thanks for helping!
[Android Software Development] ArmanUV:
Everything checks out. I'm away from my main machine so I can't run a test build, but I suspect that a recent change is causing problems.

Now, regarding the compiler, Setting CC/CXX *should* take care of everything, but I am currently not 100% sure that somewhere in a makefile, these environment variables aren't being ignored. Since I wrote the guide, I noticed a lot of clang warnings in the build, which means that CC/CXX is not honored and /usr/bin/cc and /usr/bin/c++ is being used.

A more robust method of making sure gcc-4.2 is being used is creating symlinks to gcc-4.2 and g++-4.2 :

ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/gcc
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/cc
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/c++
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/g++

Obviousely, a systemic method like this has its downsides but it may be the only choice without having to change CM code (especially since I lack the knowledge to do so :D )

[I recently found out that master aosp is no longer using CC/CXX to find the compiler (see ./build/core/combo/). Instead, it uses "gcc" and "g++" directly, which means that llvm-gcc will be used no matter what env variable you have. Fortunately, unlike cm9, master aosp is supposed to build fine with llvm-gcc (except for qemu, which doesn't matter for device images). ]
[Android Software Development] topprospect:
Okay, just tried this. I created a new dir (/Volumes/Android/bin) that simply houses those softlinks you recommended. Then I put /Volumes/Android/bin at the beginning of my PATH. That should fix it without breaking the rest of the system, e.g. homebrew.

The GENERAL_REGS problem still exists though. Pretty sure b/c gcc 4.2.1 doesn't understand this construct properly (need a newer version of gcc).

So I backed out the change that introduced this adler32.c.

https://github.com/CyanogenMod/android_external_zlib/commit/13bf40af68236c961542bdee1d4b7c0176bf15a0

The compile is getting farther now. I have to run to work so I'll post later if it succeeds.

The weird thing is: This change was made back in December. Why would it have worked for you?
[Android Software Development] topprospect:
Build works (and boots!) with the following:

cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0

Note the 1st revert is just to avoid massive conflicts seen when reverting the 2nd one by itself. The 2nd revert is the one that really matters here.

So this isn't really a solution.. Seems like we need to move to a newer version of gcc or figure out a patch to adler32.c that makes it gcc 4.2 compatible.
[Android Software Development] empyyy:
The first revert works fine, however the second one gives me the following error:

$ git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
error: could not revert 13bf40a... Implement vectorized adler32 and optimized slhash
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
error: Could not parse conflict hunks in zlib.h
[Android Software Development] topprospect:
Well, run git status. You'll see that the only conflict is in the comments in zlib.h. So, you can just ignore it.
[Android Software Development] ArmanUV:
Nice find. I tried to compile this morning and I ran into the same issue. This is what I don't understand: I did a couple of builds about a week ago without running into this issue. But, the latest commits on zlib are from 2 months ago.

Amazingly, the Xcode 4.3 toolchain (clang and llvm-gcc) builds this external/zlib/adler32.c just fine.

An alternative to this problem is to install an up to date gcc 4.7 :

brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gcc.rb

and then create symlinks to gcc-4.7/g++-4.7. I have not tested this yet.
[Android Software Development] empyyy:
I actually had to install it using

brew install gcc --use-llvm

otherwise it would've failed at bootstrapping.

Edit:

One error is fixed, the next one pops up...

/Volumes/android/cm9/prebuilt/darwin-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-ld:--defsym _image_size=: syntax error
make[4]: *** [arch/arm/boot/compressed/vmlinux] Error 1
make[3]: *** [arch/arm/boot/compressed/vmlinux] Error 2
make[2]: *** [zImage] Error 2
make[1]: *** [sub-make] Error 2
make: *** [TARGET_KERNEL_BINARIES] Error 2
make: *** Waiting for unfinished jobs....
[Android Software Development] topprospect:
I forked android_external_zlib and reverted the 2 changes. Until we figure out a better solution, you can point your local_manifest.xml to my repo for external/zlib:

git://github.com/dferg/android_external_zlib.git
[Android Software Development] ArmanUV:
That's one interesting error. I've never tried gcc 4.7 myself. I don't think everything is compatible with it yet.

Great. I'll add this to OP.
[Android Software Development] topprospect:
Btw, Arman, this is bad ass. I was running Ubuntu via VMware on my Hackintosh. I could rebuild from clobber in 25 minutes. Pretty good, but I had to always scp files back and forth, always dealing with the pain of two OS's.

Now I can build straight on OS X, no complicated VMware setup needed. I'm down to 14 minutes to build from make clobber. That's pretty f'ing cool! Love it. Thanks!

But back to debug: So if gcc 4.7 causes weird breakage, is there a homebrew formulae for gcc 4.4 (which is what Ubuntu 10.04 uses)? I like homebrew better, but port has a 4.4 version, I believe.
[Android Software Development] ArmanUV:
hole **** 15 minutes? you must have a monster hackintosh.

Now regarding gcc, I'm not sure that it doesn't work. If you can, please test it. I'm not sure what the best supported

According to empyyy you have to use llvm so those symlinks need to be removed so that homebrew can find llvm.

I found gcc 4.5 here :

brew install https://raw.github.com/Homebrew/homebrew-versions/master/gcc45.rb

I can't install it because mpfr is not downloading:

curl: (7) couldn't connect to host
Error: Failure while executing: /usr/bin/curl -qf#LA Homebrew\ 0.9\ (Ruby\ 1.8.7-357;\ Mac\ OS\ X\ 10.7.4) http://www.mpfr.org/mpfr-3.1.0/allpatches -o 000-homebrew.diff
> /

I'll try again once the mtpfr formula is updated (they usually solve these issues pretty fast)

We can also try gcc 4.6.3 which AFAIK is the version everyone on linux uses, so it should be the most compatible. I found a formula for it here:

https://raw.github.com/Homebrew/homebrew-dupes/c527b7cd5df96482d2b09a1ff1bdeada934228be/gcc.rb

I'll try this first (when mtpfr.org is back up)
[Android Software Development] empyyy:
Okay, seems to be a problem with the kernel source, since I'm building for the HTC One X. Building for the Galaxy Nexus works fine. Thanks again for your guide!
[Android Software Development] ArmanUV:
happy to help :)

Did you end up using gcc 4.7? Did it compile everything else ok?
[Android Software Development] empyyy:
I switched back to gcc-4.2, but I can try it with 4.7 tonight!
[Android Software Development] idan_mo:
amazing work! thanks!

EDIT:
[Android Software Development] idan_mo:
how do i do that?
[Android Software Development] empyyy:
this has already been discussed on the previous page.
[Android Software Development] idan_mo:
i saw it and i lost myself somewhere...

i'm not a mac expert.
[Android Software Development] empyyy:
Open your .repo/local_manifest.xml and add the following line:

<project name="dferg/android_external_zlib" path="external/zlib" remote="github" />

After that enter repo sync and it should build fine.
[Android Software Development] idan_mo:
i added the line to the file, wrote repo sync and i got these:
[Android Software Development] ArmanUV:
That looks like there is something wrong with either git or python. Try reintalling git from homebrew. You shouldn't need any separate python installed, since python 2.7 is bundled with os x.

EDIT: I added full instructions regarding this issue to OP.
[Android Software Development] topprospect:
You have some syntax error in your .repo/local_manifest.xml file. Here is mine:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="dferg/android_external_zlib" path="external/zlib" />
</manifest>
[Android Software Development] idan_mo:
this is my manifest file, i only added the last line:

and i'll try to reinstall homebrew again and i'll report.

EDIT:

i reinstalled homebrew and replaced my manifest file with the one from the OP.

so far so good and it's compiling.

a question:

when should i do when i want to download new source (and compile it again)?
[Android Software Development] ArmanUV:
See OP notes.
[Android Software Development] idan_mo:
it ends lie this (and no zip file):
[Android Software Development] empyyy:
What does it say before "Waiting for unfinished jobs"?
[Android Software Development] ArmanUV:
Was it this?

make: *** [out/host/darwin-x86/obj/EXECUTABLES/adb_intermediates/usb_osx.o] Error 1

Are you sure you are using gcc 4.2.1 as instructed in OP? I ran into this error with gcc 4.7 (or 4.6 I can't remember). You shouldn't get this error if you got apple-gcc2 from homebrew and changed your environment variables.

empyyy, did you have any luck with 4.7 or 4.6 ? I didn't expect 4.7 to work but then I got gcc 4.6 (which works in ubuntu) and it still didn't compile successfully.

If you have the time, please try building with 4.6. I'm starting to think there is something wrong with my setup.

Here is the 4.6 formula:

brew install https://raw.github.com/Homebrew/homebrew-dupes/c527b7cd5df96482d2b09a1ff1bdeada934228be/gcc.rb --use-gcc --enable-cxx
[Android Software Development] dhemke17:
Excellent guide...I read through it and decided to make the leap to Lion as I have been building on a separate partition on my macbook pro running 10.7.3 with Xcode 4.3.2. Went through the guide after reinstalling Xcode and the corresponding command line tools. The only thing that seemed to hang me up was that you must repeat the line below every time you restart terminal. I am compiling my own rom and not cm9 for both manguro and toro.

export CC=/usr/local/bin/gcc-4.2 && export CXX=/usr/local/bin/g++-4.2

Just figured I would say thanks a lot for the help
[Android Software Development] ArmanUV:
No problem :D

You can easily put those two lines in your ~/.bash_profile so that they are automatically run when you restart terminal. See this part of OP:

If you choose to put CC/CCX export commands in bash_profile, you have to remember to remove them when you want to build any other project other than cm9. However, homebrew may be smart enough to find the correct gcc even if you set CC/CCX (I think it uses xcrun to find the requested compiler)

A better solution is explained in the Notes section of OP: Creating an alias (like "cm9env") that mounts the disk image, runs ./build/envsetup.sh and sets CC/CXX.
[Android Software Development] idan_mo:
it was this:

and yes, i use gcc 4.2.1 exactly as instructed in OP
[Android Software Development] ArmanUV:
Did you extract the proprietry files? If you have pulled them from your device, try using the google provided scripts (see OP)
[Android Software Development] dhemke17:
I actually just made a quick exec. file to run with that at the start so I don't have to repeat everything every time I want to build...much more convenient.
[Android Software Development] idan_mo:
i used the google's files because it didn't work with my device connected with adb.
[Android Software Development] empyyy:
Okay, I just reinstalled OS X and only installed Command Line Tools and Homebrew so far. I'll set up my working directory now and then I'll try gcc-4.6, ArmanUV!
[Android Software Development] ArmanUV:
Awesome. I hope you didn't do all that just to install GCC 4.6. Home brew installs cross compilers in isolation. Right now I have 3 different gcc installations, and they don't conflict with each other.
[Android Software Development] empyyy:
I actually did that because it was kinda full of trash. Nothing better than a fresh OS X installation hehe :p
[Android Software Development] ArmanUV:
Oh yes it's like a android data wipe: it feels good knowing no junk is left anywhere.

I am gonna wait until mountain lion comes out and do the same.
[Android Software Development] ArmanUV:
The LLVM compatibility patches from AOSP have been merged into CM9. Therefore, you don't need gcc-4.2 anymore.

OP guide is updated to reflect this change.
[Android Software Development] adam80460:
Well for the life of me i cant seem to fix this issue. I follow the guide to the t..

http://pastebin.com/Be2f7HAC

obviously it has something to do with the srec...well it looks that way to me.
[Android Software Development] ArmanUV:
That error used to come up before the recent patches got merged. Can you post the output from the troubleshooting script in OP?
[Android Software Development] adam80460:
I should have said I was compiling straight Aosp not Cyanogenmod

PWD=/Users/Adam80460
LANG=en_US.UTF-8
SHLVL=1
HOME=/Users/Adam80460
LOGNAME=Adam80460
DISPLAY=/tmp/launch-9UIHeq/org.x:0
_=/usr/bin/env

WHICH GCC
:/usr/bin/gcc

WHICH G++:
/usr/bin/g++

WHICH CC:
/usr/bin/cc

WHICH C++:
/usr/bin/c++

BREW DOCTOR:
Your system is raring to brew.

BREW LIST:
apple-gcc42
coreutils
findutils
git
gnu-sed
gnupg
pngcrush
repo
xz

/USR/BIN:
lrwxr-xr-x 1 root wheel 12 Jun 1 16:10 gcc -> llvm-gcc-4.2
lrwxr-xr-x 1 root wheel 28 Jun 1 16:10 gcov-4.2 -> ../llvm-gcc-4.2/bin/gcov-4.2
lrwxr-xr-x 1 root wheel 52 Jun 1 16:09 i686-apple-darwin11-llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/i686-apple-darwin11-llvm-g++-4.2
lrwxr-xr-x 1 root wheel 52 Jun 1 16:09 i686-apple-darwin11-llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/i686-apple-darwin11-llvm-gcc-4.2
lrwxr-xr-x 1 root wheel 32 Jun 1 16:09 llvm-cpp-4.2 -> ../llvm-gcc-4.2/bin/llvm-cpp-4.2
lrwxr-xr-x 1 root wheel 32 Jun 1 16:09 llvm-g++ -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
lrwxr-xr-x 1 root wheel 32 Jun 1 16:09 llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
lrwxr-xr-x 1 root wheel 32 Jun 1 16:09 llvm-gcc -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
lrwxr-xr-x 1 root wheel 32 Jun 1 16:09 llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2

/USR/LOCAL/BIN:
lrwxr-xr-x 1 Adam80460 admin 46 Jun 1 15:25 c++-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/c++-4.2
lrwxr-xr-x 1 Adam80460 admin 46 Jun 1 15:25 cpp-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2
lrwxr-xr-x 1 Adam80460 admin 46 Jun 1 15:25 g++-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
lrwxr-xr-x 1 Adam80460 admin 46 Jun 1 15:25 gcc-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
lrwxr-xr-x 1 Adam80460 admin 47 Jun 1 15:25 gcov-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gcov-4.2
lrwxr-xr-x 1 Adam80460 admin 47 Jun 1 15:25 gfortran -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gfortran
lrwxr-xr-x 1 Adam80460 admin 51 Jun 1 15:25 gfortran-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gfortran-4.2
lrwxr-xr-x 1 Adam80460 admin 68 Jun 1 15:25 i686-apple-darwin11-cpp-4.2.1 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-cpp-4.2.1
lrwxr-xr-x 1 Adam80460 admin 68 Jun 1 15:25 i686-apple-darwin11-g++-4.2.1 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-g++-4.2.1
lrwxr-xr-x 1 Adam80460 admin 68 Jun 1 15:25 i686-apple-darwin11-gcc-4.2.1 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-gcc-4.2.1
lrwxr-xr-x 1 Adam80460 admin 73 Jun 1 15:25 i686-apple-darwin11-gfortran-4.2.1 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-gfortran-4.2.1

Adams-Mac-Pro:~ Adam80460$
Adams-Mac-Pro:~ Adam80460$
[Android Software Development] ArmanUV:
Well the guide is mostly meant for CM9.

But If you're compiling AOSP master, you don't even need apple-gcc42 since master is compatible with llvm-gcc and Xcode 4.3. Just compile without setting any environment variables or anything.

If you're compiling one of the release tags however (like 4.0.4), you definitely need apple-gcc4.2. Since you already have it installed, you need to set CC and CXX to point to /usr/local/bin/gcc-42 and /usr/local/bin/g++-4.2.
[Android Software Development] bhundven:
Just a fyi... I had the same problem with macports on snow leopard with cm7. This should do the same for cm9.

The solution I found is to do the following:

sudo port install gcc_select gcc44
sudo port select --set gcc mp-gcc44
sudo port select --set llvm mp-llvm-3.0
cd /opt/local/bin
ln -s gcc cc
cd <cm source>
make clobber
brunch <device>

Hope that helps if you use macports and have the same issue ;)
[Android Software Development] ArmanUV:
I'm not very good with macports but it seems to me that you basically installed and used gcc 4.4 to compile.

My advice is to stick with brew (because mixing homebrew and macpost is a BAD BAD idea ) and use apple-gcc42 for release tags and llvm-gcc (xcode) for master because that's what's officially supported by google.