OLD | NEW |
(Empty) | |
| 1 {{+bindTo:partials.standard_nacl_article}} |
| 2 |
| 3 <section id="frequently-asked-questions"> |
| 4 <h1 id="frequently-asked-questions">Frequently Asked Questions</h1> |
| 5 <div class="contents local topic" id="contents"> |
| 6 <ul class="small-gap"> |
| 7 <li><p class="first"><a class="reference internal" href="#what-is-native-client-
good-for" id="id3">What is Native Client Good For?</a></p> |
| 8 <ul class="small-gap"> |
| 9 <li><a class="reference internal" href="#why-did-google-build-native-client" id=
"id4">Why did Google build Native Client?</a></li> |
| 10 <li><a class="reference internal" href="#when-should-i-use-native-client" id="id
5">When should I use Native Client?</a></li> |
| 11 <li><a class="reference internal" href="#when-should-i-use-portable-native-clien
t" id="id6">When should I use Portable Native Client?</a></li> |
| 12 <li><a class="reference internal" href="#how-fast-does-code-run-in-portable-nati
ve-client" id="id7">How fast does code run in Portable Native Client?</a></li> |
| 13 <li><a class="reference internal" href="#why-use-portable-native-client-instead-
of-technology-x" id="id8">Why use Portable Native Client instead of <em><tech
nology X></em>?</a></li> |
| 14 <li><a class="reference internal" href="#if-i-want-direct-access-to-the-os-shoul
d-i-use-native-client" id="id9">If I want direct access to the OS, should I use
Native Client?</a></li> |
| 15 </ul> |
| 16 </li> |
| 17 <li><p class="first"><a class="reference internal" href="#development-environmen
ts-and-tools" id="id10">Development Environments and Tools</a></p> |
| 18 <ul class="small-gap"> |
| 19 <li><a class="reference internal" href="#what-development-environment-and-develo
pment-operating-system-do-you-recommend" id="id11">What development environment
and development operating system do you recommend?</a></li> |
| 20 <li><a class="reference internal" href="#i-m-not-familiar-with-native-developmen
t-tools-can-i-still-use-the-native-client-sdk" id="id12">I’m not familiar
with native development tools, can I still use the Native Client SDK?</a></li> |
| 21 </ul> |
| 22 </li> |
| 23 <li><p class="first"><a class="reference internal" href="#openness-and-supported
-architectures-and-languages" id="id13">Openness, and Supported Architectures an
d Languages</a></p> |
| 24 <ul class="small-gap"> |
| 25 <li><a class="reference internal" href="#is-native-client-open-is-it-a-standard"
id="id14">Is Native Client open? Is it a standard?</a></li> |
| 26 <li><a class="reference internal" href="#what-are-the-supported-instruction-set-
architectures" id="id15">What are the supported instruction set architectures?</
a></li> |
| 27 <li><a class="reference internal" href="#do-i-have-to-use-c-or-c-i-d-really-like
-to-use-another-language" id="id16">Do I have to use C or C++? I’d really
like to use another language.</a></li> |
| 28 <li><a class="reference internal" href="#will-you-only-support-chrome-what-about
-other-browsers" id="id17">Will you only support Chrome? What about other browse
rs?</a></li> |
| 29 <li><a class="reference internal" href="#what-s-the-difference-between-npapi-and
-pepper" id="id18">What’s the difference between NPAPI and Pepper?</a></li
> |
| 30 <li><a class="reference internal" href="#is-npapi-part-of-the-native-client-sdk"
id="id19">Is NPAPI part of the Native Client SDK?</a></li> |
| 31 <li><a class="reference internal" href="#does-native-client-support-simd-vector-
instructions" id="id20">Does Native Client support SIMD vector instructions?</a>
</li> |
| 32 <li><a class="reference internal" href="#can-i-use-native-client-for-3d-graphics
" id="id21">Can I use Native Client for 3D graphics?</a></li> |
| 33 <li><a class="reference internal" href="#does-native-client-support-concurrency-
parallelism" id="id22">Does Native Client support concurrency/parallelism?</a></
li> |
| 34 </ul> |
| 35 </li> |
| 36 <li><p class="first"><a class="reference internal" href="#coming-soon" id="id23"
>Coming Soon</a></p> |
| 37 <ul class="small-gap"> |
| 38 <li><a class="reference internal" href="#do-native-client-modules-have-access-to
-external-devices" id="id24">Do Native Client modules have access to external de
vices?</a></li> |
| 39 </ul> |
| 40 </li> |
| 41 <li><p class="first"><a class="reference internal" href="#security-and-privacy"
id="id25">Security and Privacy</a></p> |
| 42 <ul class="small-gap"> |
| 43 <li><a class="reference internal" href="#what-happens-to-my-data-when-i-use-nati
ve-client" id="id26">What happens to my data when I use Native Client?</a></li> |
| 44 <li><a class="reference internal" href="#how-does-native-client-prevent-sandboxe
d-code-from-doing-bad-things" id="id27">How does Native Client prevent sandboxed
code from doing Bad Things?</a></li> |
| 45 <li><a class="reference internal" href="#how-does-google-know-that-the-safety-me
asures-in-native-client-are-sufficient" id="id28">How does Google know that the
safety measures in Native Client are sufficient?</a></li> |
| 46 </ul> |
| 47 </li> |
| 48 <li><p class="first"><a class="reference internal" href="#development" id="id29"
>Development</a></p> |
| 49 <ul class="small-gap"> |
| 50 <li><a class="reference internal" href="#how-do-i-debug" id="id30">How do I debu
g?</a></li> |
| 51 <li><a class="reference internal" href="#how-do-i-build-x86-32-x86-64-or-arm-nex
es" id="id31">How do I build x86-32, x86-64 or ARM <code>.nexes</code>?</a></li> |
| 52 <li><a class="reference internal" href="#how-can-my-web-application-determine-wh
ich-nexe-to-load" id="id32">How can my web application determine which <code>.ne
xe</code> to load?</a></li> |
| 53 <li><a class="reference internal" href="#is-it-possible-to-build-a-native-client
-module-with-just-plain-c-not-c" id="id33">Is it possible to build a Native Clie
nt module with just plain C (not C++)?</a></li> |
| 54 <li><a class="reference internal" href="#what-unix-system-calls-can-i-make-throu
gh-native-client" id="id34">What UNIX system calls can I make through Native Cli
ent?</a></li> |
| 55 <li><a class="reference internal" href="#is-my-favorite-third-party-library-avai
lable-for-native-client" id="id35">Is my favorite third-party library available
for Native Client?</a></li> |
| 56 <li><a class="reference internal" href="#do-all-the-files-in-an-application-need
-to-be-served-from-the-same-domain" id="id36">Do all the files in an application
need to be served from the same domain?</a></li> |
| 57 </ul> |
| 58 </li> |
| 59 <li><p class="first"><a class="reference internal" href="#portability" id="id37"
>Portability</a></p> |
| 60 <ul class="small-gap"> |
| 61 <li><a class="reference internal" href="#do-i-have-to-do-anything-special-to-mak
e-my-application-run-on-different-operating-systems" id="id38">Do I have to do a
nything special to make my application run on different operating systems?</a></
li> |
| 62 <li><a class="reference internal" href="#how-easy-is-it-to-port-my-existing-nati
ve-code-to-native-client" id="id39">How easy is it to port my existing native co
de to Native Client?</a></li> |
| 63 </ul> |
| 64 </li> |
| 65 <li><p class="first"><a class="reference internal" href="#troubleshooting" id="i
d40">Troubleshooting</a></p> |
| 66 <ul class="small-gap"> |
| 67 <li><a class="reference internal" href="#my-pexe-isn-t-loading-help" id="id41">M
y <code>.pexe</code> isn’t loading, help!</a></li> |
| 68 <li><a class="reference internal" href="#my-nexe-files-never-finish-loading-what
-gives" id="id42">My <code>.nexe</code> files never finish loading. What gives?<
/a></li> |
| 69 </ul> |
| 70 </li> |
| 71 </ul> |
| 72 </div> |
| 73 <p>This document answers some frequently asked questions about Native |
| 74 Client (NaCl) and Portable Native Client (PNaCl, pronounced |
| 75 “pinnacle”). For a high-level overview of Native Client, see the |
| 76 <a class="reference internal" href="/native-client/overview.html"><em>Technical
Overview</em></a>.</p> |
| 77 <p>If you have questions that aren’t covered in this FAQ:</p> |
| 78 <ul class="small-gap"> |
| 79 <li>Scan through the <a class="reference internal" href="/native-client/sdk/rele
ase-notes.html"><em>Release Notes</em></a>.</li> |
| 80 <li>Search through or ask on the <a class="reference internal" href="/native-cli
ent/help.html"><em>Native Client Forums</em></a>.</li> |
| 81 </ul> |
| 82 <section id="what-is-native-client-good-for"> |
| 83 <h2 id="what-is-native-client-good-for">What is Native Client Good For?</h2> |
| 84 <section id="why-did-google-build-native-client"> |
| 85 <h3 id="why-did-google-build-native-client">Why did Google build Native Client?<
/h3> |
| 86 <ul class="small-gap"> |
| 87 <li><strong>Performance:</strong> Native Client modules run nearly as fast as na
tive |
| 88 compiled code.</li> |
| 89 <li><strong>Security:</strong> Native Client lets users run native compiled code
in the |
| 90 browser with the same level of security and privacy as traditional web |
| 91 applications.</li> |
| 92 <li><p class="first"><strong>Convenience:</strong></p> |
| 93 <ul class="small-gap"> |
| 94 <li>Developers can leverage existing code, written in C/C++ or other |
| 95 languages, in their applications without forcing users to install a |
| 96 plugin.</li> |
| 97 <li>This code can interact with the embedding web page as part of an |
| 98 HTML and JavaScript web application, or it can be a self-contained |
| 99 and immersive experience.</li> |
| 100 </ul> |
| 101 </li> |
| 102 <li><p class="first"><strong>Portability:</strong> Native Client and Portable Na
tive Client applications |
| 103 can execute on:</p> |
| 104 <ul class="small-gap"> |
| 105 <li>The Windows, Mac, Linux or ChromeOS operating systems.</li> |
| 106 <li>Processors with the x86-32, x86-64, or ARM instruction set |
| 107 architectures. Native Client also has experimental support for MIPS.</li> |
| 108 </ul> |
| 109 </li> |
| 110 </ul> |
| 111 <p>Portable Native client further enhances the above:</p> |
| 112 <ul class="small-gap"> |
| 113 <li><strong>Performance:</strong> Each PNaCl release brings with it more perform
ance |
| 114 enhancements. Already-released applications get faster over time, |
| 115 conserving user’s battery.</li> |
| 116 <li><strong>Security:</strong> Users are kept secure with an ever-improving sand
box |
| 117 model which adapts to novel attacks, without affecting |
| 118 already-released applications.</li> |
| 119 <li><strong>Convenience:</strong> Developers only need to ship a single <code>.p
exe</code> file, |
| 120 not one <code>.nexe</code> file per supported architecture.</li> |
| 121 <li><strong>Portability:</strong> Developers and users don’t need to worry
about |
| 122 already-released applications not working on new hardware: PNaCl |
| 123 already supports all architectures NaCl does, and as PNaCl evolves it |
| 124 gains support for new processors and fully uses their capabilities.</li> |
| 125 </ul> |
| 126 <p>For more details, refer to the <a class="reference internal" href="/native-cl
ient/nacl-and-pnacl.html"><em>history behind and comparison of |
| 127 NaCl and PNaCl</em></a>.</p> |
| 128 </section><section id="when-should-i-use-native-client"> |
| 129 <h3 id="when-should-i-use-native-client">When should I use Native Client?</h3> |
| 130 <p>The following are some typical use cases. For details, see the |
| 131 <a class="reference internal" href="/native-client/overview.html"><em>Technical
Overview</em></a>.</p> |
| 132 <ul class="small-gap"> |
| 133 <li>Porting existing software components for use in a web application.</li> |
| 134 <li>Porting legacy desktop applications.</li> |
| 135 <li>Handling browser-side encryption and decryption for an enterprise |
| 136 application.</li> |
| 137 <li>Handling multimedia for a web application.</li> |
| 138 <li>Handling various aspects of web-based games, including physics engines |
| 139 and AI.</li> |
| 140 </ul> |
| 141 <p>Native Client is a versatile technology; we expect that it will also be |
| 142 used in many other contexts outside of Chrome.</p> |
| 143 </section><section id="when-should-i-use-portable-native-client"> |
| 144 <h3 id="when-should-i-use-portable-native-client">When should I use Portable Nat
ive Client?</h3> |
| 145 <p>See <a class="reference internal" href="/native-client/nacl-and-pnacl.html"><
em>NaCl and PNaCl</em></a>. In short: PNaCl works on the |
| 146 open web whereas NaCl only works on the Chrome Web Store.</p> |
| 147 </section><section id="how-fast-does-code-run-in-portable-native-client"> |
| 148 <h3 id="how-fast-does-code-run-in-portable-native-client">How fast does code run
in Portable Native Client?</h3> |
| 149 <p>Fast! The SPEC2k benchmarks (C, C++ and floating-point benchmarks) give |
| 150 the following overhead for optimized PNaCl compared to regular optimized |
| 151 LLVM:</p> |
| 152 <table border="1" class="docutils"> |
| 153 <colgroup> |
| 154 </colgroup> |
| 155 <tbody valign="top"> |
| 156 <tr class="row-odd"><td>x86-32</td> |
| 157 <td>15%</td> |
| 158 </tr> |
| 159 <tr class="row-even"><td>x86-64</td> |
| 160 <td>25%</td> |
| 161 </tr> |
| 162 <tr class="row-odd"><td>ARM</td> |
| 163 <td>10%</td> |
| 164 </tr> |
| 165 </tbody> |
| 166 </table> |
| 167 <p>Note that benchmark performance is sometimes bimodal, so different use |
| 168 cases are likely to achieve better or worse performance than the above |
| 169 averages. For example floating-point heavy code usually exhibits much |
| 170 lower overheads whereas very branch-heavy code often performs worse.</p> |
| 171 <p>For details, see:</p> |
| 172 <ul class="small-gap"> |
| 173 <li><a class="reference external" href="https://nativeclient.googlecode.com/svn/
data/site/NaCl_SFI.pdf">Adapting Software Fault Isolation to Contemporary CPU Ar
chitectures</a> (PDF).</li> |
| 174 <li><a class="reference external" href="http://research.google.com/pubs/pub34913
.html">Native Client: A Sandbox for Portable, Untrusted x86 Code</a> (PDF).</li> |
| 175 </ul> |
| 176 <p>If your code isn’t performing as close to native speed as you’d e
xpect, |
| 177 <a class="reference internal" href="/native-client/help.html"><em>let us know</e
m></a>!</p> |
| 178 </section><section id="why-use-portable-native-client-instead-of-technology-x"> |
| 179 <h3 id="why-use-portable-native-client-instead-of-technology-x">Why use Portable
Native Client instead of <em><technology X></em>?</h3> |
| 180 <p>Many other technologies can be compared to Portable Native Client: |
| 181 Flash, Java, Silverlight, ActiveX, .NET, asm.js, etc...</p> |
| 182 <p>Different technologies have different strengths and weaknesses. In |
| 183 appropriate contexts, Portable Native Client can be faster, more secure, |
| 184 and/or more compatible across operating systems and architectures than |
| 185 other technologies.</p> |
| 186 <p>Portable Native Client complement other technologies by giving web |
| 187 developers a new capability: the ability to run fast, secure native code |
| 188 from a web browser in an architecture-independent way.</p> |
| 189 </section><section id="if-i-want-direct-access-to-the-os-should-i-use-native-cli
ent"> |
| 190 <h3 id="if-i-want-direct-access-to-the-os-should-i-use-native-client">If I want
direct access to the OS, should I use Native Client?</h3> |
| 191 <p>No—Native Client does not provide direct access to the OS or devices, |
| 192 or otherwise bypass the JavaScript security model. For more information, |
| 193 see later sections of this FAQ.</p> |
| 194 </section></section><section id="development-environments-and-tools"> |
| 195 <h2 id="development-environments-and-tools">Development Environments and Tools</
h2> |
| 196 <section id="what-development-environment-and-development-operating-system-do-yo
u-recommend"> |
| 197 <h3 id="what-development-environment-and-development-operating-system-do-you-rec
ommend">What development environment and development operating system do you rec
ommend?</h3> |
| 198 <p>You can develop on Windows, Mac, or Linux, and the resulting Native |
| 199 Client or Portable Native Client application will run inside the Google |
| 200 Chrome browser on all those platforms as well as ChromeOS. You can also |
| 201 develop on ChromeOS with <a class="reference external" href="https://github.com/
dnschneid/crouton">Crouton</a>, and we’re working on |
| 202 self-hosting a full development environment on Portable Native Client.</p> |
| 203 <p>Any editor+shell combination should work as well as IDEs like Eclipse, |
| 204 Visual Studio with the <a class="reference internal" href="/native-client/devgui
de/devcycle/vs-addin.html"><em>Native Client Add-In</em></a> on Windows, or Xcod
e on Mac OSX.</p> |
| 205 </section><section id="i-m-not-familiar-with-native-development-tools-can-i-stil
l-use-the-native-client-sdk"> |
| 206 <h3 id="i-m-not-familiar-with-native-development-tools-can-i-still-use-the-nativ
e-client-sdk">I’m not familiar with native development tools, can I still
use the Native Client SDK?</h3> |
| 207 <p>You may find our <a class="reference internal" href="/native-client/devguide/
tutorial/index.html"><em>Tutorial</em></a> and <a class="reference internal" hre
f="/native-client/devguide/devcycle/building.html"><em>Building |
| 208 instructions</em></a> useful, and you can look at |
| 209 the code and Makefiles for the SDK examples to understand how the |
| 210 examples are built and run.</p> |
| 211 <p>You’ll need to learn how to use some tools (like GCC, LLVM, make, |
| 212 Eclipse, Visual Studio, or Xcode) before you can get very far with the |
| 213 SDK. Try seaching for an <a class="reference external" href="https://www.google.
com/search?q=gcc+introduction">introduction to GCC</a>.</p> |
| 214 </section></section><section id="openness-and-supported-architectures-and-langua
ges"> |
| 215 <h2 id="openness-and-supported-architectures-and-languages">Openness, and Suppor
ted Architectures and Languages</h2> |
| 216 <section id="is-native-client-open-is-it-a-standard"> |
| 217 <h3 id="is-native-client-open-is-it-a-standard">Is Native Client open? Is it a s
tandard?</h3> |
| 218 <p>Native Client is completely open: the executable format is open and the |
| 219 <a class="reference external" href="nacl_project_">source code is open</a>. Righ
t |
| 220 now the Native Client project is in its early stages, so it’s premature |
| 221 to consider Native Client for standardization.</p> |
| 222 <p>We consistenly try to document our design and implementation and hope to |
| 223 standardize Portable Native Client when it gains more traction. A good |
| 224 example is our <a class="reference internal" href="/native-client/reference/pnac
l-bitcode-abi.html"><em>PNaCl bitcode reference manual</em></a>.</p> |
| 225 </section><section id="what-are-the-supported-instruction-set-architectures"> |
| 226 <h3 id="what-are-the-supported-instruction-set-architectures">What are the suppo
rted instruction set architectures?</h3> |
| 227 <p>Portable Native Client uses an architecture-independent format (the |
| 228 <code>.pexe</code>) which can currently be translated to execute on processors |
| 229 with the x86-32, x86-64, and ARM instruction set architectures, as well |
| 230 as experimental support for MIPS. As new architectures come along and |
| 231 become popular we expect Portable Native Client to support them without |
| 232 developers having to recompile their code.</p> |
| 233 <p>Native Client can currently execute on the same architectures as |
| 234 Portable Native Client but is only supported on the Chrome Web |
| 235 Store. Native Client’s <code>.nexe</code> files are architecture-dependent
and |
| 236 cannot adapt to new architectures without recompilation, we therefore |
| 237 deem them better suited to a web store than to the open web.</p> |
| 238 <p>With Portable Native Client we deliver a system that has comparable |
| 239 portability to JavaScript and can adapt to new instruction set |
| 240 architectures without requiring recompilation. The web is better when |
| 241 it’s platform-independent, and we’d like it to stay that way.</p> |
| 242 </section><section id="do-i-have-to-use-c-or-c-i-d-really-like-to-use-another-la
nguage"> |
| 243 <span id="other-languages"></span><h3 id="do-i-have-to-use-c-or-c-i-d-really-lik
e-to-use-another-language"><span id="other-languages"></span>Do I have to use C
or C++? I’d really like to use another language.</h3> |
| 244 <p>Right now only C and C++ are supported directly by the toolchain in the |
| 245 SDK. C# and other languages in the .NET family are supported via the |
| 246 <a class="reference external" href="https://github.com/elijahtaylor/mono">Mono p
ort</a> for Native |
| 247 Client. Moreover, there are several ongoing projects to support |
| 248 additional language runtimes (e.g. <a class="reference external" href="https://c
ode.google.com/p/naclports/source/browse#svn%2Ftrunk%2Fsrc%2Fexamples%2Ftools">n
aclports supports Lua, Python and |
| 249 Ruby</a>) |
| 250 as well as to compile more languages to LLVM’s intermediate |
| 251 representation (e.g. support Haskell with <a class="reference external" href="ht
tp://www.haskell.org/ghc/docs/latest/html/users_guide/code-generators.html">GHC<
/a> |
| 252 or support Fortran with <a class="reference external" href="https://flang-gsoc.b
logspot.ie/2013/09/end-of-gsoc-report.html">flang</a>), or |
| 253 transpile languages to C/C++ (source-to-source compilation).</p> |
| 254 <p>If you’re interested in getting other languages working, please contact
the |
| 255 Native Client team by way of the <a class="reference external" href="https://gro
ups.google.com/group/native-client-discuss">native-client-discuss mailing list</
a>.</p> |
| 256 </section><section id="will-you-only-support-chrome-what-about-other-browsers"> |
| 257 <h3 id="will-you-only-support-chrome-what-about-other-browsers">Will you only su
pport Chrome? What about other browsers?</h3> |
| 258 <p>We aim to support multiple browsers. However, a number of features that |
| 259 we consider requirements for a production-quality system that keeps the |
| 260 user safe are difficult to implement without help from the |
| 261 browser. Specific examples are an out-of-process plugin architecture and |
| 262 appropriate interfaces for integrated 3D graphics. We have worked |
| 263 closely with Chromium developers to deliver these features and we are |
| 264 eager to collaborate with developers from other browsers.</p> |
| 265 </section><section id="what-s-the-difference-between-npapi-and-pepper"> |
| 266 <h3 id="what-s-the-difference-between-npapi-and-pepper">What’s the differe
nce between NPAPI and Pepper?</h3> |
| 267 <p><a class="reference internal" href="/native-client/pepper_stable/index.html">
<em>Pepper</em></a> (also known as PPAPI) is a new API that |
| 268 lets Native Client modules communicate with the browser. Pepper supports |
| 269 various features that don’t have robust support in NPAPI, such as event |
| 270 handling, out-of-process plugins, and asynchronous interfaces. Native |
| 271 Client has transitioned from using NPAPI to using Pepper.</p> |
| 272 </section><section id="is-npapi-part-of-the-native-client-sdk"> |
| 273 <h3 id="is-npapi-part-of-the-native-client-sdk">Is NPAPI part of the Native Clie
nt SDK?</h3> |
| 274 <p>NPAPI is not supported by the Native Client SDK, and is <a class="reference e
xternal" href="http://blog.chromium.org/2013/09/saying-goodbye-to-our-old-friend
-npapi.html">deprecated in |
| 275 Chrome</a>.</p> |
| 276 </section><section id="does-native-client-support-simd-vector-instructions"> |
| 277 <h3 id="does-native-client-support-simd-vector-instructions">Does Native Client
support SIMD vector instructions?</h3> |
| 278 <p>Native Client currently supports SSE on x86 and NEON on ARM. Support for |
| 279 AVX on x86 is under way.</p> |
| 280 <p>Portable Native Client should support SIMD vectors in the near future.</p> |
| 281 </section><section id="can-i-use-native-client-for-3d-graphics"> |
| 282 <h3 id="can-i-use-native-client-for-3d-graphics">Can I use Native Client for 3D
graphics?</h3> |
| 283 <p>Yes. Native Client supports <a class="reference external" href="https://www.k
hronos.org/opengles/">OpenGL ES 2.0</a>.</p> |
| 284 <p>To alert the user regarding their hardware platform’s 3D feature set |
| 285 before loading a large NaCl application, see <a class="reference internal" href=
"/native-client/devguide/coding/3D-graphics.html"><em>Vetting the driver in |
| 286 Javascript</em></a>.</p> |
| 287 <p>Some GL extensions are exposed to Native Client applications, see the |
| 288 <a class="reference external" href="https://src.chromium.org/viewvc/chrome/trunk
/src/ppapi/lib/gl/gles2/gles2.c">GLES2 file</a>. |
| 289 This file is part of the GL wrapper supplied by the library |
| 290 <code>ppapi_gles2</code> which you’ll want to include in your project. In
most |
| 291 cases extensions map to extensions available on other platforms, or |
| 292 differ very slightly (if they differ, the extension is usually CHROMIUM |
| 293 or ANGLE instead of EXT).</p> |
| 294 </section><section id="does-native-client-support-concurrency-parallelism"> |
| 295 <h3 id="does-native-client-support-concurrency-parallelism">Does Native Client s
upport concurrency/parallelism?</h3> |
| 296 <p>Native Client and Portable Native Client both support pthreads, |
| 297 C11/C++11 threads, and low-level synchronization primitives (mutex, |
| 298 barriers, atomic read/modify/write, compare-and-exchange, etc...), thus |
| 299 allowing your Native Client application to utilize several CPU cores. |
| 300 Note that this allows you to modify datastructures concurrently without |
| 301 needing to copy them, which is often a limitation of shared-nothing |
| 302 systems. For more information see <a class="reference internal" href="/native-cl
ient/reference/pnacl-c-cpp-language-support.html#memory-model-and-atomics"><em>m
emory model and atomics</em></a> and <a class="reference internal" href="/native
-client/reference/pnacl-c-cpp-language-support.html#language-support-threading">
<em>threading</em></a>.</p> |
| 303 <p>Native Client doesn’t support HTML5 Web Workers directly but can |
| 304 interact with JavaScript code which does.</p> |
| 305 </section></section><section id="coming-soon"> |
| 306 <h2 id="coming-soon">Coming Soon</h2> |
| 307 <section id="do-native-client-modules-have-access-to-external-devices"> |
| 308 <h3 id="do-native-client-modules-have-access-to-external-devices">Do Native Clie
nt modules have access to external devices?</h3> |
| 309 <p>At this time Native Client modules do not have access to serial ports, |
| 310 camera devices, or microphones: Native Client can only use native |
| 311 resources that today’s browsers can access. However, we intend to |
| 312 recommend such features to the standards bodies and piggyback on their |
| 313 efforts to make these resources available inside the browser.</p> |
| 314 <p>You can generally think of Pepper as the C/C++ bindings to the |
| 315 capabilities of HTML5. The goal is for Pepper and JavaScript to evolve |
| 316 together and stay on par with each other with respect to features and |
| 317 capabilities.</p> |
| 318 </section></section><section id="security-and-privacy"> |
| 319 <h2 id="security-and-privacy">Security and Privacy</h2> |
| 320 <section id="what-happens-to-my-data-when-i-use-native-client"> |
| 321 <h3 id="what-happens-to-my-data-when-i-use-native-client">What happens to my dat
a when I use Native Client?</h3> |
| 322 <p>Users can opt-in to sending usage statistics and crash information in |
| 323 Chrome, which includes usage statistics and crash information about |
| 324 Native Client. Crashes in your code won’t otherwise send your |
| 325 information to Google: Google counts the number of such crashes, but |
| 326 does so anonymously without sending your application’s data or its debug |
| 327 information.</p> |
| 328 <p>For additional information about privacy and Chrome, see the <a class="refere
nce external" href="https://www.google.com/chrome/intl/en/privacy.html">Google |
| 329 Chrome privacy policy</a> and the <a class="reference external" href="https://ww
w.google.com/chrome/intl/en/eula_text.html">Google |
| 330 Chrome Terms of Service</a>.</p> |
| 331 </section><section id="how-does-native-client-prevent-sandboxed-code-from-doing-
bad-things"> |
| 332 <h3 id="how-does-native-client-prevent-sandboxed-code-from-doing-bad-things">How
does Native Client prevent sandboxed code from doing Bad Things?</h3> |
| 333 <p>Native Client’s sandbox works by validating the untrusted code (the |
| 334 compiled Native Client module) before running it. The validator checks |
| 335 the following:</p> |
| 336 <ul class="small-gap"> |
| 337 <li><strong>Data integrity:</strong> No loads or stores are permitted outside of
the |
| 338 data sandbox. In particular this means that once loaded into memory, |
| 339 the binary is not writable. This is enforced by operating system |
| 340 protection mechanisms. While new instructions can be inserted at |
| 341 runtime to support things like JIT compilers, such instructions will |
| 342 be subject to runtime verification according to the following |
| 343 constraints before they are executed.</li> |
| 344 <li><strong>No unsafe instructions:</strong> The validator ensures that the Nati
ve |
| 345 Client application does not contain any unsafe instructions. Examples |
| 346 of unsafe instructions are <code>syscall</code>, <code>int</code>, and <code>lds
</code>.</li> |
| 347 <li><strong>Control flow integrity:</strong> The validator ensures that all dire
ct and |
| 348 indirect branches target a safe instruction.</li> |
| 349 </ul> |
| 350 <p>The beauty of the Native Client sandbox is in reducing “safe” cod
e to a |
| 351 few simple rules that can be verified by a small trusted validator: the |
| 352 compiler isn’t trusted. The same applies to Portable Native Client where |
| 353 even the <code>.pexe</code> to <code>.nexe</code> translator, a simplified compi
ler |
| 354 backend, isn’t trusted: it is validated before executing, and so is its |
| 355 output.</p> |
| 356 <p>In addition to static analysis of untrusted code, the Native Client |
| 357 runtime also includes an outer sandbox that mediates system calls. For |
| 358 more details about both sandboxes, see <a class="reference external" href="http:
//research.google.com/pubs/pub34913.html">Native Client: A Sandbox for |
| 359 Portable, Untrusted x86 Code</a> |
| 360 (PDF).</p> |
| 361 </section><section id="how-does-google-know-that-the-safety-measures-in-native-c
lient-are-sufficient"> |
| 362 <h3 id="how-does-google-know-that-the-safety-measures-in-native-client-are-suffi
cient">How does Google know that the safety measures in Native Client are suffic
ient?</h3> |
| 363 <p>Google has taken several steps to ensure that Native Client’s security |
| 364 works, including:</p> |
| 365 <ul class="small-gap"> |
| 366 <li>Open source, peer-reviewed papers describing the design.</li> |
| 367 <li>A <a class="reference internal" href="/native-client/community/security-cont
est/index.html"><em>security contest</em></a>.</li> |
| 368 <li>Multiple internal and external security reviews.</li> |
| 369 <li>The ongoing vigilance of our engineering and developer community.</li> |
| 370 </ul> |
| 371 <p>Google is committed to making Native Client safer than JavaScript and |
| 372 other popular browser technologies. If you have suggestions for security |
| 373 improvements, let the team know, by way of the <a class="reference external" hre
f="https://groups.google.com/group/native-client-discuss">native-client-discuss |
| 374 mailing list</a>.</p> |
| 375 </section></section><section id="development"> |
| 376 <h2 id="development">Development</h2> |
| 377 <section id="how-do-i-debug"> |
| 378 <h3 id="how-do-i-debug">How do I debug?</h3> |
| 379 <p>Instructions on <a class="reference internal" href="/native-client/sdk/exampl
es.html#debugging-the-sdk-examples"><em>debugging the SDK examples</em></a> usin
g GDB are available. You can also |
| 380 debug Native Client modules with some <a class="reference internal" href="/nativ
e-client/devguide/devcycle/debugging.html"><em>alternative approaches</em></a>.<
/p> |
| 381 </section><section id="how-do-i-build-x86-32-x86-64-or-arm-nexes"> |
| 382 <h3 id="how-do-i-build-x86-32-x86-64-or-arm-nexes">How do I build x86-32, x86-64
or ARM <code>.nexes</code>?</h3> |
| 383 <p>By default, the applications in the <code>/examples</code> folder create |
| 384 architecture-independent <code>.pexe</code> for Portable Native Client. To |
| 385 generate a <code>.nexe</code> targetting one specific architecture using the |
| 386 Native Client or Portable Native Client toolchains, see the |
| 387 <a class="reference internal" href="/native-client/devguide/devcycle/building.ht
ml"><em>Building instructions</em></a>.</p> |
| 388 </section><section id="how-can-my-web-application-determine-which-nexe-to-load"> |
| 389 <h3 id="how-can-my-web-application-determine-which-nexe-to-load">How can my web
application determine which <code>.nexe</code> to load?</h3> |
| 390 <p>Your application does not need to make the decision of loading an |
| 391 x86-32, x86-64 or ARM <code>.nexe</code> explicitly—the Native Client runt
ime |
| 392 examines a manifest file (<code>.nmf</code>) to pick the right <code>.nexe</code
> file for |
| 393 a given user. You can generate a manifest file using a Python script |
| 394 that’s included in the SDK (see the <code>Makefile</code> in any of the SD
K |
| 395 examples for an illustration of how to do so). Your HTML file specifies |
| 396 the manifest filename in the <code>src</code> attribute of the <code><embed&g
t;</code> |
| 397 tag. You can see the way the pieces fit together by examining the |
| 398 examples included in the SDK.</p> |
| 399 </section><section id="is-it-possible-to-build-a-native-client-module-with-just-
plain-c-not-c"> |
| 400 <h3 id="is-it-possible-to-build-a-native-client-module-with-just-plain-c-not-c">
Is it possible to build a Native Client module with just plain C (not C++)?</h3> |
| 401 <p>Yes. See the <code>"Hello, World!"</code> in C example in the SDK u
nder |
| 402 <code>examples/tutorial/using_ppapi_simple/</code>, or the Game of Life example |
| 403 under <code>examples/demo/life/life.c</code>.</p> |
| 404 </section><section id="what-unix-system-calls-can-i-make-through-native-client"> |
| 405 <h3 id="what-unix-system-calls-can-i-make-through-native-client">What UNIX syste
m calls can I make through Native Client?</h3> |
| 406 <p>Native Client doesn’t directly expose any system calls from the host OS |
| 407 because of the inherent security risks and because the resulting |
| 408 application would not be portable across operating systems. Instead, |
| 409 Native Client provides portable cross-OS abstractions wrapping or |
| 410 proxying OS functionality or emulating UNIX system calls. For example, |
| 411 Native Client provides an <code>mmap()</code> system call that behaves much like |
| 412 the standard UNIX <code>mmap()</code> system call.</p> |
| 413 </section><section id="is-my-favorite-third-party-library-available-for-native-c
lient"> |
| 414 <h3 id="is-my-favorite-third-party-library-available-for-native-client">Is my fa
vorite third-party library available for Native Client?</h3> |
| 415 <p>Google has ported several third-party libraries to Native Client; such |
| 416 libraries are available in the <a class="reference external" href="https://code.
google.com/p/naclports">naclports</a> project. We encourage you to |
| 417 contribute libraries to naclports, and/or to host your own ported |
| 418 libraries, and to <a class="reference external" href="https://groups.google.com/
group/native-client-discuss">let the team know about it</a> when you do.</p> |
| 419 </section><section id="do-all-the-files-in-an-application-need-to-be-served-from
-the-same-domain"> |
| 420 <h3 id="do-all-the-files-in-an-application-need-to-be-served-from-the-same-domai
n">Do all the files in an application need to be served from the same domain?</h
3> |
| 421 <p>The <code>.nmf</code>, and <code>.nexe</code> or <code>.pexe</code> files mus
t either be served from the |
| 422 same origin as the embedding page or an origin that has been configured |
| 423 correctly using <a class="reference external" href="http://en.wikipedia.org/wiki
/Cross-origin_resource_sharing">CORS</a>.</p> |
| 424 <p>For applications installed from the Chrome Web Store the Web Store manifest |
| 425 must include the correct, verified domain of the embedding page.</p> |
| 426 </section></section><section id="portability"> |
| 427 <h2 id="portability">Portability</h2> |
| 428 <section id="do-i-have-to-do-anything-special-to-make-my-application-run-on-diff
erent-operating-systems"> |
| 429 <h3 id="do-i-have-to-do-anything-special-to-make-my-application-run-on-different
-operating-systems">Do I have to do anything special to make my application run
on different operating systems?</h3> |
| 430 <p>No. Native Client and Portable Native Client applications run without |
| 431 modification on all supported operating systems.</p> |
| 432 <p>However, to run on different instruction set architectures (such as |
| 433 x86-32, x86-64 or ARM), you currently have to either:</p> |
| 434 <ul class="small-gap"> |
| 435 <li>Use Portable Native Client.</li> |
| 436 <li>Build and supply a separate <code>.nexe</code> file for each architecture, a
nd |
| 437 make them available on the Chrome Web Store. See <a class="reference internal" h
ref="/native-client/devguide/devcycle/building.html"><em>target |
| 438 architectures</em></a> for details about which |
| 439 <code>.nexe</code> files will run on which architectures.</li> |
| 440 </ul> |
| 441 </section><section id="how-easy-is-it-to-port-my-existing-native-code-to-native-
client"> |
| 442 <h3 id="how-easy-is-it-to-port-my-existing-native-code-to-native-client">How eas
y is it to port my existing native code to Native Client?</h3> |
| 443 <p>In most cases you won’t have to rewrite much, if any, code. The Native |
| 444 Client-specific tools, such as <code>pnacl-clang++</code> or <code>x86_64-nacl-g
++</code>, |
| 445 take care of most of the necessary changes. You may need to make some |
| 446 changes to your operating system calls and interactions with external |
| 447 devices to work with the web. Porting existing Linux libraries is |
| 448 generally straightforward, with large libraries often requiring no |
| 449 source change.</p> |
| 450 <p>The following kinds of code may be more challenging to port:</p> |
| 451 <ul class="small-gap"> |
| 452 <li>Code that does direct TCP/IP or UDP networking. For security reasons |
| 453 these APIs are only available to packaged applications, not on the |
| 454 open web, after asking for the appropriate permissions. Native Client |
| 455 is otherwise restricted to the networking APIs available in the |
| 456 browser.</li> |
| 457 <li>Code that creates processes, including UNIX forks. Creating processes |
| 458 is not supported for security reasons. However, threads are supported.</li> |
| 459 <li>Code that needs to do local file I/O. Native Client is restricted to |
| 460 accessing URLs and to local storage in the browser (the Pepper file I/O API |
| 461 has access to the same per-application storage that JavaScript has via Local |
| 462 Storage). HTML5 File System can be used, among others. For POSIX compatabiliy |
| 463 the Native Client SDK includes a library called nacl_io which allows the |
| 464 application to interact with all these types of files via standard POSIX I/O |
| 465 functions (e.g. open/fopen/read/write/...). See <a class="reference internal" hr
ef="/native-client/devguide/coding/nacl_io.html"><em>Using NaCl I/O</em></a> for
more details.</li> |
| 466 </ul> |
| 467 </section></section><section id="troubleshooting"> |
| 468 <span id="faq-troubleshooting"></span><h2 id="troubleshooting"><span id="faq-tro
ubleshooting"></span>Troubleshooting</h2> |
| 469 <section id="my-pexe-isn-t-loading-help"> |
| 470 <h3 id="my-pexe-isn-t-loading-help">My <code>.pexe</code> isn’t loading, h
elp!</h3> |
| 471 <ul class="small-gap"> |
| 472 <li>You must use Google Chrome version 31 or greater for Portable Native |
| 473 Client. Make sure you have Portable Native Client installed in |
| 474 <code>about:nacl</code>; if not open <code>about:components</code> and “Ch
eck for |
| 475 update” for PNaCl.</li> |
| 476 <li>PNaCl <code>.pexe</code> must be compiled with pepper_31 SDK or higher (earl
ier |
| 477 SDK versions had experimental support for PNaCl, now deprecated).</li> |
| 478 <li>Your application can verify that Portable Native Client is supported |
| 479 in JavaScript with <code>navigator.mimeTypes['application/x-pnacl'] !== |
| 480 undefined</code>. This is preferred over checking the Chrome version.</li> |
| 481 </ul> |
| 482 </section><section id="my-nexe-files-never-finish-loading-what-gives"> |
| 483 <h3 id="my-nexe-files-never-finish-loading-what-gives">My <code>.nexe</code> fil
es never finish loading. What gives?</h3> |
| 484 <p>Here are ways to resolve some common problems that can prevent loading:</p> |
| 485 <ul class="small-gap"> |
| 486 <li>You must use Google Chrome version 14 or greater for Native Client.</li> |
| 487 <li>If you haven’t already done so, enable the Native Client flag in |
| 488 Google Chrome. Type <code>about:flags</code> in the Chrome address bar, scroll |
| 489 down to “Native Client”, click the “Enable” link, scroll
down to the |
| 490 bottom of the page, and click the “Relaunch Now” button (all browser |
| 491 windows will restart).</li> |
| 492 <li>Verify that the Native Client plugin is enabled in Google Chrome. Type |
| 493 <code>about:plugins</code> in the Chrome address bar, scroll down to “Nati
ve |
| 494 Client”, and click the “Enable” link. (You do not need to rela
unch |
| 495 Chrome after you enable the Native Client plugin).</li> |
| 496 <li>Make sure that the <code>.nexe</code> files are being served from a web |
| 497 server. Native Client uses the same-origin security policy, which |
| 498 means that modules will not load in pages opened with the <code>file://</code> |
| 499 protocol. In particular, you can’t run the examples in the SDK by |
| 500 simply dragging the HTML files from the desktop into the browser. See |
| 501 <a class="reference internal" href="/native-client/devguide/devcycle/running.htm
l"><em>Running Native Client Applications</em></a> |
| 502 for instructions on how to run the httpd.py mini-server included in |
| 503 the SDK.</li> |
| 504 <li>The <code>.nexe</code> files must have been compiled using SDK version 0.5 o
r |
| 505 greater.</li> |
| 506 <li>You must load the correct <code>.nexe</code> file for your machine’s s
pecific |
| 507 instruction set architecture (x86-32, x86-64 or ARM). You can ensure |
| 508 you’re loading the correct <code>.nexe</code> file by building a separate |
| 509 <code>.nexe</code> for each architecture, and using a <code>.nmf</code> manifest
file to |
| 510 let the browser select the correct <code>.nexe</code> file. Note: the need to |
| 511 select a processor-specific <code>.nexe</code> goes away with Portable Native |
| 512 Client.</li> |
| 513 <li>If things still aren’t working, <a class="reference internal" href="/n
ative-client/help.html"><em>ask for help</em></a>!</li> |
| 514 </ul> |
| 515 </section></section></section> |
| 516 |
| 517 {{/partials.standard_nacl_article}} |
OLD | NEW |