Android OS Forum banner

[GUIDE][JB] How to build AOKP JB on Mac 10.8 Mtn Lion

39K views 133 replies 32 participants last post by  wKovacs64  
#1 · (Edited by Moderator)
First of all thanks to ArmanUV for the guide format and Birdman for the advice and CM for the commits.

DISCLAIMER: I AM NOT RESPONSIBLE FOR ANYTHING THAT HAPPENS TO YOU WHILE FOLLOWING THIS GUIDE BUT I HAVE FOLLOWED IT MYSELF AND AM ALIVE AND WELL!!

Instructions:

First you need to go to the App Store and download Xcode 4. Once that is installed, open it up and go to preferences. Now click on the "Downloads" tab and then next to where it says "Command Line Tools" click install. That'll will take a few minutes.

Also you want to make sure you have android-sdk downloaded and installed and have it placed in /usr/local/ and make sure adb and fastboot work.


Open up the terminal and type:
Code:
<br />
java<br />
Install homebrew (note: technically you could use MacPorts to achieve the same thing, but I used homebrew):
Code:
<br />
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL [URL=https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew]https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew[/URL].rb)"<br />
Now make sure android-sdk and homebrew are in $PATH
Code:
<br />
touch ~/.bash_profile && echo "PATH=/usr/local/bin:/usr/local/sbin:$PATH:/usr/local/android-sdk/tools:/usr/local/android-sdk/platform-tools" >> ~/.bash_profile<br />
Now run this and see if you need to update anything.
Code:
<br />
brew doctor<br />
If you do (and you probably will once a day) type:
Code:
<br />
brew update<br />
Now we need to get our dev packages
Code:
<br />
brew install git coreutils findutils gnu-sed gnupg pngcrush repo<br />
Once that is done, run
Code:
 brew outdated
if it shows anything, run
Code:
 brew upgrade
Now run this the correct a few symlinks [While it may not be needed anymore, I did it and I know AOKP builds after what I did]:
Code:
<br />
ln -s /usr/local/bin/gfind /usr/local/bin/find && ln -s /usr/local/bin/gsed /usr/local/bin/sed<br />
Now to create our case sensitive image for our AOKP work [NOTE: the 60g can be changed to anything. It only takes up what it needs but I used 60GB]:
Code:
<br />
hdiutil create -type SPARSE -fs "Case-sensitive Journaled HFS+" -size 60g -volname "android" -attach ~/Desktop/Android<br />
Now to create our working directory
Code:
<br />
cd /Volumes/android && mkdir aokp && cd aokp<br />
Now to initialize the git and to download it [NOTE: 'say finished' is just for funzies and your mac will actually say finished when it is done. if you take it off, it'll just end and not tell you.]:
Code:
<br />
repo init -u [URL=git://github.com/AOKP/platform_manifest.git]git://github.com/AOKP/platform_manifest.git[/URL] -b jb && repo sync && say 'finished'<br />
Now just sit back and wait because, depending on your internet connection it can take a long time.

[UPDATE: According to ProTekk, those cherry-picks below have been merged. So repo sync and you should be able to build off the bat :) Let me know if somethings goes wrong.

Now, some are reporting that AOKP will build now and doesn't need any extra steps on Mountain Lion. However there are some (myself included) that received emulator errors while trying to build.

Luckily, there are two things we can do to fix this.

One is cherry-pick from CM (until it get's merged with AOKP):
Code:
<br />
cd /volumes/android/aokp/sdk/emulator/opengl/tests/translator_tests && git fetch [URL=http://review.cyanogenmod.com/CyanogenMod/android_sdk]http://review.cyanogenmod.com/CyanogenMod/android_sdk[/URL] refs/changes/87/19487/1 && git cherry-pick FETCH_HEAD<br />
and the other is:
Code:
<br />
cd /Volumes/android/aokp/external/qemu && nano Makefile.android<br />
Now where ever there is lines of code, add a # to the beginning of it. After you have done that, hit CTRL-X, it will ask you if you want to keep modified changes and you hit "Y".


After that you just build below. Remember if you cherry-pick, once you repo sync again, it will discard the pick so you need to redo it after each repo sync.

NOW we are ready to build [NOTE: toro is vzw galaxy nexus. for other supported devices, replace 'toro' with it's name (ie maguro)]:
Code:
<br />
. build/envsetup.sh && brunch toro<br />
And you're done. I know this seems round about way to do things, but if you just can't wait on some nightlies for your device, this is a way to do it on the OSX 10.8 operating system.

-Cheers and hopefully everything works for y'all and there are no typos :)
 
#21 · (Edited by Moderator)
so now that I have built my first build, how do I build one tomorrow night? :)

I assume all the homebrew stuff is still setup fine, maybe do a 'homebrew update' to check for any updates

But to build the newest merges do I do the last two commands?

P.S. Thanks for this awesome guide, I am atleast getting my feet wet on this whole ROM building thing. Still have a TON to learn though...
 
#27 ·
Thank you very much for this thread!! I new to mac as well and haven't had a whole lot of time to learn how to do things properly. I'm still a little confused on some things, but copy and paste works great....and now I have a build of my own (created by someone else but at least my name now shows in the build info). Thanks again.
 
#29 ·
I think you need to run repo sync everytime to sync all the new merges, otherwise you will just build the exact same rom over and over.

I was curious how I can clean up my Android "partition"...I have about 4.5gb left on it but wanted to free up some space. What is safe to delete? I guess I could delete everything to resync it with new material...
 
#33 · (Edited by Moderator)
I ran into an error trying to compile AOKP on my mac.

ran the repo sync command no problem, but when I ran the
Code:
<br />
. build/envsetup.sh && brunch grouper<br />
command it ran for a long time like normal then at the end gave me this error.

Code:
<br />
make: *** [out/target/product/grouper/obj/STATIC_LIBRARIES/libc_nomalloc_intermediates/libc_nomalloc.a] Error 1<br />
make: *** Deleting file `out/target/product/grouper/obj/STATIC_LIBRARIES/libc_nomalloc_intermediates/libc_nomalloc.a'<br />
make: *** Waiting for unfinished jobs....<br />
make: *** [out/target/product/grouper/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a] Error 1<br />
make: *** Deleting file `out/target/product/grouper/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a'<br />
Note: Some input files use or override a deprecated API.<br />
Note: Recompile with -Xlint:deprecation for details.<br />
Note: Some input files use unchecked or unsafe operations.<br />
Note: Recompile with -Xlint:unchecked for details.<br />
1 error<br />
make: *** [out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar] Error 41<br />
What gives? I have succesfully compiled this for my GNex (toro) a few times no problem.

attached the full log in case you need more info

https://dl.dropbox.com/u/9461171/Error41Grouper.txt
 
#35 · (Edited by Moderator)
Im stuck and could use some help. I've gotten smoothly without any problems up to:

Code:
<br />
brew install git coreutils findutils gnu-sed gnupg pngcrush repo<br />
It goes through its process but it stops at:

Code:
<br />
==> Downloading [URL=ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.12.tar]ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.12.tar[/URL].bz2<br />
It just sits there, no "#" progress bar under i, just that line for a could 10-15 minutes. It looks like it hasn't even started the download process, I'm not sure were to go from here. I was able to follow the guide for Ubuntu but, thats all I use Ubuntu for and would like to get ride of that partition completely.

Edit - This just came up:

Code:
<br />
curl: (28) server response timeout<br />
Error: Download failed: [URL=ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.12.tar]ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.12.tar[/URL].bz2<br />
 
#39 · (Edited by Moderator)
Ok, so I had this going overnight, and I woke up this morning there was no activity happening on the terminal window where I told it to sync with the AOKP github. So then I decided to run the command again, and it said it can't detect my username/email. Then I decided to see if I could compile a build, and it said there was no such location or something like that.

Thanks in advance for any help. Also nice guide.

If nothing else, can someone help me uninstall what current source I have so I can start over?
 
#40 ·
Every time i try
Code:
<br />
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL [URL=https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew]https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew[/URL].rb)"<br />
i get this error :
Code:
<br />
curl: (22) The requested URL returned error: 404<br />
Any help? Somebody who knows the right url?
Thx
 
#42 ·
Thanks for this, worked perfectly.

Does anyone here know of a way to manipulate flashable ZIPs in OS X, similar to how you do it in Windows via 7zip, WinRAR, etc.? It seems all the Mac archiving utilities are either compressors or extractors rather than archive browsers/manipulators. I found a couple that claimed to do it but they were fail.
 
#43 ·
Use "Betterzip" http://macitbetter.com/

Sadly it's not free ($10) but it's pretty much the best (well, only really) archive manipulation tool for OSX. FYI, avoid stuffit/deluxe like the plague. If you ever download anything that comes in .sitx format, just trash it and find a better source file, stuffit is a plague that needs to be eliminated.

cheers :)