Feeds

Google's Native Code browser tech goes cross-platform

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

Boost IT visibility and business value

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. ®

Build a business case: developing custom apps

More from The Register

next story
PEAK LANDFILL: Why tablet gloom is good news for Windows users
Sinofsky's hybrid strategy looks dafter than ever
Leaked Windows Phone 8.1 Update specs tease details of Nokia's next mobes
New screen sizes, dual SIMs, voice over LTE, and more
Fiendishly complex password app extension ships for iOS 8
Just slip it in, won't hurt a bit, 1Password makers urge devs
Mozilla keeps its Beard, hopes anti-gay marriage troubles are now over
Plenty on new CEO's todo list – starting with Firefox's slipping grasp
Apple: We'll unleash OS X Yosemite beta on the MASSES on 24 July
Starting today, regular fanbois will be guinea pigs, it tells Reg
Another day, another Firefox: Version 31 is upon us ALREADY
Web devs, Mozilla really wants you to like this one
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
Cloudy CoreOS Linux distro declares itself production-ready
Lightweight, container-happy Linux gets first Stable release
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
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.
The Essential Guide to IT Transformation
ServiceNow discusses three IT transformations that can help CIO's automate IT services to transform IT and the enterprise.
Maximize storage efficiency across the enterprise
The HP StoreOnce backup solution offers highly flexible, centrally managed, and highly efficient data protection for any enterprise.