Going Native (Client) – For Today

October 3, 2009

Native Client, Technology

Mandelbrot NaCl in Chrome

Mandelbrot NaCl in Chrome

It’s been a while since I’ve taken the time to actually post anything substantial on this site.  I have been swamped at work.  And I have focused more of my personal time on family matters and on micro-blogging.  And today was going to be no exception to that rule.

I got up first thing this morning.  My intentions were to spend time on yard work and to enjoy time away from the computer.  After two months of heads-down work, I wanted the break.

But I decided that I would spend a few minutes on Google Reader.  That was my first mistake.  It didn’t take long for me to notice lots of kerfuffle about Google Chrome and built-in support for Native Client.  I remembered the Native Client buzz from Google I/O but I hadn’t really dug into the subject.  That changed this morning.

Native Client was a Google Code initiative that has developed into something far more transformative.  Stated simply, Native Client is a way that web applications can access/run native instructions on an x86 system.

That’s nothing new, per se.  Indeed, the idea of interpreting code to make it portable has been around for a long time.  When I built my first computer (a Heathkit H89 system), I decided to run UCSD’s Pascal p-system as an OS.  For those too young to know what I’m talking about, this was a PC operating system that ran completely on interpreted pseudo-code (i.e., interpreted byte-code).  Since then, the more obvious examples of this are Java and .Net applications.

And Google is now building their own instance of portable code.  I think this is all preparatory for Chrome OS and the cloud-based services that they are soon to unleash upon the computing world.  But that is a subject for a different post.  Today’s post is about getting started in Native Client.

So after sharing a few articles in Google Reader and tweeting a little bit about it, I decided to launch down the path of understanding it by installing the new platform.  But that was easier said than done.  Now that I am done, it doesn’t seem all that hard.  But it took me quite a few fits and starts.

Before launching into the list of tasks, let me note that I did all of this work on my Windows 7 system.  So I spent a lot of time figuring out which issues were part of the Native Client experience and which were part of the Windows 7 experience.  But I’ve been through the tunnel and it isn’t nearly as hard as it seemed while stumbling in the dark.

Here’s what I did: [I’ll update this post with links after I finish my dinner.]

  • I downloaded the latest version of Chrome (  Actually, this happened automatically.
  • I enabled the browser to run the Native Client. [You must add a run-time option to your Chrome invocation.  In my case, I used the following:  chrome.exe –enable-nacl
  • I downloaded the Getting Started guide and I realized that there was far more to Native Client than just the browser additions.  Indeed, I needed to download and install the Native Client interpreter.
  • Before I could launch into that installation, I needed to install Python.  I hadn’t installed that onto the Windows 7 system yet.  So off I went to http://www.python.org.
  • Of course, Python wasn’t enough.  I had to also install the PyWin extensions.
  • Once I had Python installed, I ran the installation and configuration steps in the Getting Started document.  Of course, things failed.  At first, I saw errors indicating that Visual Studio was not properly installed.  Huh?  So I had to actually go into the installation scripts.  Once there, it was obvious what the problem was: I didn’t have a working C compiler or development environment on this system.
  • The next step took way too much time.  I had to decide which C compiler I should install.  I don’t have a licese for VS 2008 at home.  So I had to decide whether to use Cygwin, MinGW or gcw.  I had read that there were problems with Cygwin so I tried gcw.  No joy.  I then tried MinGW.  Also, less joy than anticipated.  Since I had great success with Cygwin on other systems, I decided to try it after all.  Well, I had no troubles at all installing and using Cygwin with Native Client.  [Note: The only problem with Cygwin was apparently a problem with the zip functionality in Cygwin.  I avoided this and had no issues whatsoever.]
  • Now that I had a compiler and a scripting engine, I could actually run the installer as delivered from Google.  Lo and behold, things began to work. But I still needed to have a local web server for testing.  Since I didn’t want to use any of my other web servers lying around the bat cave, I decided to try the hpptd instance that comes with the Native Client code itself.  [BTW, I still don’t know if I like a Python-based web server, but it works fine.  So why not.]
  • I ran the Mandelbrot and Life examples from the command line.  And they worked flawlessly.  So it was time to move on to the browser tests.
  • I tried the samples in Chrome and ended up getting 404 errors thrown by the web server.  I was not feeling happy.  But I wanted to get this done.  So I pushed ahead and installed the Firefox extension.  And once I used the Firefox extension that ships with Native Client, everything worked.  All the sample apps worked like a charm.  At some point (probably tomorrow) I’ll try to get Chrome to use the Native Client environment.  But that is for tomorrow.

Now that I can sit down and think about what I’ve done, I realize that this is still a developer preview.  But the only reason that it is in such a state is because no one has packaged everything up properly.  The code works.  And it has immense promise.  It just needs someone to put a pretty wrapper around it.

And that person won’t be me – at least, not tonight.


*Update: The solution to the Chrome issue was simple.  I mispelled the execution parm.  Once corrected, Native Client goodness is available within my Chrome browser.  w00t!

**Update: Curious…Native Client works with an invalid parameter (–enable-nacl) but doesn’t work with the valid one (–internal-nacl).  And it also works w/o any parameter.  I wonder if Chrome is using the NPAPI plugin.



Subscribe to our RSS feed and social profiles to receive updates.

One Comment on “Going Native (Client) – For Today”

  1. Ben Says:

    IIRC (it was a while back when I read the documentation, and I haven’t tried to use NaCl yet myself), –internal-nacl makes Chrome use the built-in NaCl code (if it’s actually built-in) and –enable-nacl just enables NaCl. It could be using the NPAPI plugin or the internal NaCl code, but you’d have to ask someone else for a definite answer.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s