Feeds

Google's Native Code browser tech goes cross-platform

Write web modules in C/C++ that run on both Intel and ARM

Choosing a cloud hosting partner with confidence

Google I/O At its annual I/O conference in San Francisco this week, Google unveiled a new version of its Native Client technology that allows developers to deploy binary code for web applications in an architecture-independent way.

With the original version of Native Client (NaCl), developers could write modules in C or C++ and compile them into binary packages to be executed inside the browser at near-native speed. The initial release only supported 32-bit and 64-bit Intel x86 architectures, but Google added support for ARM in January.

The revamped version of the tech, dubbed Portable Native Client – PNaCl for short, pronounced "pinnacle" – still allows developers to target all three architectures, but now they can do so with a single executable package instead of compiling a separate package for each processor type.

It works by essentially breaking the process of compiling PNaCl modules into two steps. The PNaCl toolchain really only compiles the C/C++ code halfway, outputting LLVM compiler bitcode instead of native machine code. That bitcode is then packaged into a .pexe file for deployment.

The client browser handles the last mile itself, translating the bitcode of any .pexes it receives into whichever machine code format is appropriate for the platform on which it's running. That extra compilation step does add a bit of startup overhead, but not too much, and Google has been working to speed up the process even more.

PNaCl does have a few limitations, however. Unlike the earlier NaCl technology, PNaCl does not support linking with glibc, the standard C library found on many Unix-like systems. Instead, developers must statically link their PNaCl modules with the more lightweight Newlib library.

The new version of PNaCl, released on Wednesday, also introduces a new format for .pexe files. Modules created with older, experimental versions of the PNaCl toolchain will no longer work in browsers that support the latest version of the PNaCl spec.

That support is limited to Chrome version 29 or higher – which, for the time being at least, means only the bleeding-edge "Canary" releases of the browser. Fortunately, you can install Canary side-by-side with more stable versions of Chrome, so you're not forced to use it all the time.

Note, also, that PNaCl only works with Chrome running on Windows, OS X, Linux, and Chrome OS. Although it does support the ARM architecture, there is still no support for NaCl or PNaCl in Chrome for Android, so deploying binary modules for Android smartphones and tablets is out.

And the biggest catch of all, of course, is that Chrome is currently the only browser to support NaCl in any form, and it looks like it's going to stay that way.

For a while, it seemed as though the open source Firefox browser might be a likely candidate to adopt Google's tech, but the Mozilla Foundation has since come out strongly against the native-code approach, preferring to work on accelerating JavaScript execution through projects like asm.js.

That means web apps written using PNaCl will only run on Chrome, probably forever. But that's not all bad – as Google's Sundar Pichai observed in his Google I/O keynote, Chrome is the most popular browser in the world, after all.

And like the original NaCl, PNaCl is uniquely useful for organizations who want to use existing C/C++ code in web apps without translating their algorithms into another language, such as JavaScript. Few other tools let you do that as easily, which could make PNaCl's browser limitation a fair tradeoff, in some cases.

For more technical information on PNaCl and its architecture, you can consult Google's technical paper on the system. Or, if you want to just dive in and try the tools, you can find instructions and downloads at the PNaCl project's homepage. ®

Secure remote control for conventional and virtual desktops

More from The Register

next story
Be real, Apple: In-app goodie grab games AREN'T FREE – EU
Cupertino stands down after Euro legal threats
Download alert: Nearly ALL top 100 Android, iOS paid apps hacked
Attack of the Clones? Yeah, but much, much scarier – report
Microsoft: Your Linux Docker containers are now OURS to command
New tool lets admins wrangle Linux apps from Windows
Bada-Bing! Mozilla flips Firefox to YAHOO! for search
Microsoft system will be the default for browser in US until 2020
Facebook, working on Facebook at Work, works on Facebook. At Work
You don't want your cat or drunk pics at the office
Soz, web devs: Google snatches its Wallet off the table
Killing off web service in 3 months... but app-happy bonkers are fine
prev story

Whitepapers

Why and how to choose the right cloud vendor
The benefits of cloud-based storage in your processes. Eliminate onsite, disk-based backup and archiving in favor of cloud-based data protection.
A strategic approach to identity relationship management
ForgeRock commissioned Forrester to evaluate companies’ IAM practices and requirements when it comes to customer-facing scenarios versus employee-facing ones.
5 critical considerations for enterprise cloud backup
Key considerations when evaluating cloud backup solutions to ensure adequate protection security and availability of enterprise data.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
Protecting against web application threats using SSL
SSL encryption can protect server‐to‐server communications, client devices, cloud resources, and other endpoints in order to help prevent the risk of data loss and losing customer trust.