Original URL: http://www.theregister.co.uk/2010/05/13/google_native_client_sdk/

Google heats up native code for Chrome OS

Salt, Pepper, and a whole lotta plug-in

By Cade Metz

Posted in Developer, 13th May 2010 23:54 GMT

Google has released a preliminary software development kit for Native Client, its native-code browser plug-in.

The company unveiled its Native Client SDK "developer preview" with a blog post on Wednesday, calling it "an important first step in making Native Client more accessible as a tool for developing real web applications." Google released a research version of Native Client a year ago - including a snapshot of its source tree - and this allowed for application development. But until now there was no formal SDK.

"The [research] download was big and cumbersome to use," reads the post from senior software engineer David Springer. "The Native Client SDK preview, in contrast, includes just the basics you need to get started writing an app in minutes."

Native Client - NaCl for short - is now bundled with Google's Chrome browser, but at this point the SDK only works with Chromium, the open source incarnation of Chrome. The SDK relies on certain extensions to NPAPI Pepper - a new browser plug-in model - and these are only available with Chromium.

NPAPI Pepper, an update to the Netscape Plug-in Application Programming Interface (NPAPI), was originally developed by Google, and the company says Mozilla is supporting the effort as well. But at this point, it's not available with Firefox or any other non-Google browser.

To use the Native Client SDK, you'll need a recent Chromium build, and you'll need to start it with a Native Client command line flag (--enable-nacl). You can grab the SDK here.

Native Client is a means of running native code inside the browser, letting you beef up a web app with existing libraries written in languages such as C and C++. As Google Native Client project manager Henry Bridge explains in a video that accompanies Springer's blog post, web apps written for Native Client include HTML, CSS, and JavaScript as well as native code. The HTML, CSS, and JavaScript bits are deployed as text files, and the native code bit require a compiler that produces Native Client binaries.

NaCl

NaCl

The SDK includes a compiler based on GCC (GNU Compiler Collection) for creating x86-32 or x86-64 binaries from C or C++ source code, and you'll find ports of popular open source projects like zlib, Lua, and libjpeg.

Google is obsessed with moving all applications into what it insists on calling the cloud, and Native Client is part of the company's ongoing efforts to put online apps on a par with desktop applications from the likes of Microsoft, its bête noire.

"Imagine you want to create a video editing application for the web," Bridge says. "When it comes time to write the code to modify the video data, what's the right approach? You could implement the video editing on the server but this approach would waste bandwidth and feel slow. On the other hand, you could try to implement video editing code that would run on the client in JavaScript but this would be difficult to implement and would also be slow.

"Native Client gives you the best of both worlds: download the data once to the client and do the editing there."

Google has said that Native Client will be an "important part" of its Chrome OS, the browser-based "operating system" set to debut on x86 and ARM netbooks at the end of the year. The original research version of native Client ran on x86-32, and recently, Google introduced versions that runs on x86-64 and ARM. The company says Native Client executables run at about 97 per cent of the speed of unmodified native code.

"These results indicate that a browser running on virtually any modern computer or cell phone could run a fast, performance-sensitive Native Client application," reads a blog post announcing the ARM and x86-64 versions. The new SDK does not yet work on ARM.

Chrome OS is essentially Google's Chrome browser running atop a Goobuntu flavor of Linux. Native Client runs not only on Linux but also on Windows and Mac.

In addition, Google is developing a means of distributing portable versions of Native Code executables across all processors. The Portable Native Client project - aka PNaCl, pronounced 'pinnacle' - uses the Low Level Virtual Machine (LLVM) bitcode format. The idea is to compile C, C++, and other languages into LLVM bitcode that allows for client-side translation into the client's native instruction set.

Google likes to say that it believes in open web standards. But Native Client is yet another way the company is pushing technology that's outside the standard web stack. Google says it has solved the security problems that plague other plug-ins that have attempted to beef up the performance of web applications, but Native Client is still a plug-in. And at the moment, it only works with Chrome.

Next week, at Google's annual developer conference in San Francisco, Native Client engineers David Springer and Ian Lewis will detail the technology to developers during a talk entitled "Beyond JavaScript." And judging from Google's conference schedule, you'd have to say that the company will make some sort of announcement around Chrome or Chrome OS - two Chrome sessions are listed as "TBA."

This week, Verizon CEO Lowell McAdam told The Wall Street Journal that the US wireless carrier is working with Google on an iPad-challenging tablet PC, and the rumor is that it will be unveiled at next week's conference. McAdam did not say which Google OS the tablet would use, but the assumption is that it will run Android. Google has said in the past that Chrome OS will debut solely on netbooks.

We do get the feeling, however, that Google is moving at least some of its online applications to Native Client as it prepares for the launch of Chrome OS. That OS will not run local applications. At all. ®