Saturday, October 30, 2010

How to build CyanogenMod on Snow Leopard

Finally I've got success to build CyanogenMod on Snow Leopard (MBA11).
So I note some tips here and I've commited patches to CM Gerrit.

At the first, you should refer the AOSP build instruction (http://source.android.com/source/download.html) and setup the build environment for OS X. But you don't have to install JDK1.5. JDK1.6update3 has no problems for building CM.

You may get error during port install db46 due to JDK environment issue.

../dist/../libdb_java/db_java_wrap.c:123:17: error: jni.h: No such file or directory
Resolve it with following command.
$ sudo ln -s /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Headers \
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/.

Next, you should not use gmake-3.82 but should use gmake-3.81 because gmake-3.82 has a malloc/free bug.
So you can install old gmake-3.81 with following command.

$ mkdir gmake-3.81 && cd gmake-3.81
$ curl –O http://gmake.darwinports.com/dports/devel/gmake/Portfile
$ sudo port install
$ sudo port deactivate gmake@3.82_0
$ sudo port activate gmake@3.81_0

Additionally you should install gsed to run squisher.

$ sudo port install gsed

Ok, now ready to checkout CyanogenMod source via repo.

$ mkdir cm && cd cm
$ repo init -u git://github.com/CyanogenMod/android.git -b froyo

You should get master branch of external/qemu because froyo's qemu cannot be built on Snow Leopard.
Edit the .repo/manifest.xml

<project path="external/qemu" name="platform/external/qemu"  revision="tools_r6"/>
to
<project path="external/qemu" name="platform/external/qemu"  revision="master"/>
and run “repo sync”

And the last, I recommend installing gcc_select to use gcc-4.2 correctly.

$ sudo port install gcc_select
$ sudo gcc_select gcc42

Now you can build the CyanogenMod and get the bacon!

$ curl -o ./passion_update.zip -O http://mirror.teamdouche.net/get/passion/update-cm-6.1.0-RC1-N1-signed.zip
$ cd device/htc/passion && ./unzip-files.sh && cd ../../..
$ cd vendor/cyanogen && ./get-rommanager && cd ../..
$ cat buildspec.mk
TARGET_PRODUCT:=cyanogen_passion
TARGET_BUILD_VARIANT:=eng
TARGET_BUILD_TYPE:=release
PRODUCT_DEVICE:=passion
$ source build/envsetup.sh && lunch cyanogen_passion-eng
$ make –j4 bacon

Good luck.

3 comments:

salim said...

i get stuck when i try:

sudo port install

i get this error:

sudo: port: command not found

any ideas?

takuo said...

set PATH environment value with
$ export PATH=/opt/local/bin:$PATH

PKV Tester said...

Thanks takuo. Jetzt läuft alles super.