Jump to content

Compiling CM on OS X Lion


Guest PaulOBrien

Recommended Posts

Just a couple of tips if you want to compile CM on OSX lion.

  • the version of 'sed' that ships with Lion will break things. You need to compile up a version using the latest Xcode, or (much easier) grab my precompiled binary from here - http://cl.ly/1H1q2f0s1e1u000c2r0u
  • you need to install the Mac OS X 10.5 SDK. This is part of Xcode 3.2.6, or you can just install the SDK on it's own (recommended) that i've extracted for you from here - http://loadbalancing.modaco.com/download.php?url=mf/?b81j3up6avzje50
  • after grabbing the source, you need to edit './external/elfutils/config-compat-darwin.h'. Find:

    static inline size_t strnlen (const char *__string, size_t __maxlen)
    {
    int len = 0;
    while (__maxlen-- && *__string++)
    len++;
    return len;
    } [/code] and change to...
    [code]/* static inline size_t strnlen (const char *__string, size_t __maxlen)
    {
    int len = 0;
    while (__maxlen-- && *__string++)
    len++;
    return len;
    } */

That's it, you should now be able to build! :)

P

Link to comment
Share on other sites

Guest imperticus

I keep getting this error, any help would be much appreciated

make: *** [out/host/darwin-x86/obj/EXECUTABLES/emulator_intermediates/emulator] Error 1

Link to comment
Share on other sites

Guest bhanvadia

should I replace 'sed' which is alias of 'gsed' with the sed file you compiled?

so i mean copy your given 'sed' to my "/opt/local/bin/" folder

replaced sed in /urs/bin/

hope it works now.

same error as above, something like problem in libSDL

Edited by bhanvadia
Link to comment
Share on other sites

  • 4 weeks later...

I'm having trouble building on Lion. It's my first Mac and it came with Snow Leopard.

I've installed the dependencies via homebrew (gnu-sed, sdl et al.). I've manually installed SDK 10.5

Does this imply a wrong command is used or am I missing any?

Target boot image: out/target/product/bravo/boot.img

stat: cannot read file system information for `%z': No such file or directory

/bin/bash: File: "out/target/product/bravo/boot.img"

    ID: e00000600000011 Namelen: *       Type: hfs

Block size: 4096       Fundamental block size: 4096

Blocks: Total: 3750000    Free: 940225     Available: 940225

Inodes: Total: 3749998    Free: 940225

+

0 : syntax error in expression (error token is ": "out/target/product/bravo/boot.img"

    ID: e00000600000011 Namelen: *       Type: hfs

Block size: 4096       Fundamental block size: 4096

Blocks: Total: 3750000    Free: 940225     Available: 940225

Inodes: Total: 3749998    Free: 940225

+

0 ")

make: *** [out/target/product/bravo/boot.img] Error 1

make: *** Deleting file `out/target/product/bravo/boot.img'
The other error is a dependency on SDL. It seems like it doesn't use the one from homebrew:
ld: warning: ignoring file out/host/darwin-x86/obj/STATIC_LIBRARIES/libSDL_intermediates/libSDL.a, file was built for archive which is not the architecture being linked (i386)

Undefined symbols for architecture i386:

  "_SDL_Init", referenced from:

Any ideas?

Link to comment
Share on other sites

I'm having trouble building on Lion. It's my first Mac and it came with Snow Leopard.

I'll answer my own questions.

The SDL problem seems to be a Mac problem that isn't fixable at the moment. You can workaround it by not building the emulator stuff.

Do this by commenting out all lines in

external/qemu/Android.mk
The toolchain problem stems from the fact that Android actually supports the mac toolchain from Snow Leopard and onwards. So put homebrew path LAST in $PATH, so that it uses the Mac toolchain first. When building DevNull/Oxygen ROM you in addition to the steps above also need to make a symlink in /usr/local/bin from sed to gsed, since they explicitly call gsed at one point. Also you have to disable WITH_DEXPREOPT like so:
make -j8 devnull WITH_DEXPREOPT=false

Now I'm able to build on my OS X Lion machine.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.