building NACL stuff on OS X

this wasn’t too much fun as it is a constantly moving target and documentation slides by the side… So no doubt by the time someone else reads this it’ll be obsolete.

Some of the steps you can follow from here…

https://developers.google.com/native-client/sdk/download

the output will be completely different though.  Something like this:

$ ./naclsdk list
Bundles:
I: installed
*: update available

I sdk_tools (stable)
vs_addin (dev)
pepper_27 (post_stable)
pepper_28 (post_stable)
pepper_29 (post_stable)
pepper_30 (post_stable)
pepper_31 (stable)
pepper_32 (dev)
pepper_canary (canary)

All installed bundles are up-to-date.

I chose to install the stable branch, pepper_31 in this case (the google page talks about version 14 being stable, so a LOT has changed).

./naclsdk update pepper_31

And two big files will download and unpack in your directory.

You will also need depot_tools, a collection of scripts google uses for git/svn.  Be sure to setup your path & environment for NACL building:

$ cat /Users/neozeed/.profile
NACL_SDK_ROOT=/Users/neozeed/src/nacl_sdk/pepper_31/
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/neozeed/src/depot_tools

export NACL_SDK_ROOT PATH

And of course you’ll want to check out the nacl ports.  With everything in place the download should at least work correctly

mkdir naclports
cd naclports
gclient config –name=src https://chromium.googlesource.com/external/naclports.git
gclient config http://naclports.googlecode.com/svn/trunk/src
gclient sync

And then before you go racing off trying to build something, as it stands right now (December 2013, pepper v.31), there is a big ‘libc’ change going on, and most of the nacl stuff will not build.  You’ll need to issue something like this:

NACL_GLIBC=1 make nethack

The other major roadblock I’ve seen so far is that zlib will not build correctly, it’ll want to build a static version of itself, because the configure script is still seeing your PC as OS X, not as a nacl build.  I found the easier way was to rename the Darwin section, and then remove all the Linux bits in the OS detection and rename that to Darwin…

Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-“$cc -shared -Wl,-soname,libz.so.1”};;

becomes

Darwin*) LDSHARED=${LDSHARED-“$cc -shared -Wl,-soname,libz.so.1”};;

And further down just rename

Darwin*) shared_ext=’.dylib’

to

XXXDarwin*) shared_ext=’.dylib’

And rebuilt zlib and now you should get the dynamic library everything else hinges on.

I hope this helps someone else..

This entry was posted in OS X and tagged , by neozeed. Bookmark the permalink.
avatar

About neozeed

What is there to tell? I've loved UNIX like things since I was first exposed to QNX in highschool (we had the Unisys ICONS!), and spent the better time of my teenage years trying to get my own UNIX... I should have bought Coherent in retrospect.. Anyways latched onto Linux in 1992, and then got some old BSD admin books and have been hooked on the VAX BSD & other big/ancient things since...!

10 thoughts on “building NACL stuff on OS X

  1. what the.. the new theme really surprised me.

    anyway, unrelated to your post, and i don’t even know if you have an android device (probably not), but have you ever tried using qemu on android?

    there are some .apks floating around the ‘net, but all of them are for emulating x86. i have a chroot environment set up (debian stable), but qemu-system-arm is not in the repos.

    is it worth trying to build it from source (cross-compiling or maybe on the device itself, lol) or is it currently impossible to run e.g. a virtualised netbsd-arm in my linux chroot with ncurses output?

    • I do actually, I switched from an iPhone to android when I was in the UK, as my iPhone doesn’t take sim cards.. It wasn’t a problem when I lived in the USA, but when traveling I needed to take SIM cards. I nearly went back to an iPhone in hong kong but when I saw google maps & google translate in action, I was pretty much boxed into android. Personally I preferred the iPhone, but when you live somewhere where you cannot read and have a hard time getting around, the droid platform makes a nice crutch.

      I saw one build of Qemu on Android and I was even thinking of moving my BBS to it, as it sure is small, but the lack of a RS-232 port kind of kills it for me.

      • yeah, i see your point in both cases. : ) i myself would prefer ios for its concise architecture and stable api, not to mention the lack of late ’90s windows pc-like fragmentation, but the hardware is ridiculously expensive (especially here in central europe) and jailbreaking is much more of a hassle than rooting android..

        so.. could you link me to that android build you mentioned? googling this stuff really doesn’t help..

Leave a Reply

Your email address will not be published.

Notify me of followup comments via e-mail. You can also subscribe without commenting.