10 Follow along with Brad Nelson's Google I/O 2014 talk.
11 Explore our new in-browser development environment and debugger.
13 Learn how easy it is to edit, build, and debug NaCl application
14 all in your desktop web browser or on a Chromebook.
15 Work either on-line or off-line!
19 <iframe class="video" width="500" height="281"
20 src="//www.youtube.com/embed/OzNuzBDEWzk?rel=0" frameborder="0"></iframe>
25 These development tools are a work in progress, see `Feature Status`_.
26 At this point, they are a learning tool and demonstration of NaCl's
27 flexibility, but are not the recommended tools for a production application.
28 To develop a substantial application for Native Client /
29 Portable Native Client,
30 we currently recommend you use the
31 `Native Client SDK </native-client/sdk/download>`_.
35 <b><font color="#880000">
36 NOTE: The NaCl Development Environment is not yet stable.
37 Ideally user data is preserved, but currently it can be lost during updates
38 or sporadically. We're working to resolve this.
44 The setup process currently requires several steps.
45 We're working to reduce the number of steps in future releases.
46 As the process gets easier, we'll update this page.
48 To install the development environment:
50 * Install the `NaCl Development Environment <https://chrome.google.com/webstore/detail/nacl-development-environm/aljpgkjeipgnmdpikaajmnepbcfkglfa>`_.
52 * Navigate to: chrome://flags and:
54 * Enable **Native Client**.
55 * Restart your browser by clicking **Relaunch Now**.
57 * First run is slow (as it downloads and installs packages). Launch and allow
58 initial install to complete before first use.
60 When initially experimenting with the development environment,
61 at this time, we recommend you run it without the debugger activated.
62 Once you're ready to apply the debugger, follow these steps:
64 * Install a usable version of
65 `Chrome Linux (M36+, Dev or Beta channel) <http://www.chromium.org/getting-involved/dev-channel>`_.
66 * Install the `Native Client Debugger Extension <https://chrome.google.com/webstore/detail/nacl-debugger/ncpkkhabohglmhjibnloicgdfjmojkfd>`_.
67 * Install `Native Client GDB <https://chrome.google.com/webstore/detail/gdb/gkjoooooiaohiceibmdleokniplmbahe>`_.
69 * Navigate to: chrome://flags and:
71 * Enable **Native Client GDB-based debugging**.
72 * Restart your browser by clicking **Relaunch Now**.
74 * NOTE: If you experience unexplained hangs, disable GDB-based debugging
75 temporarily and try again.
80 To follow along in this tutorial, you'll need to use a text editor to modify
81 various files in our development environment.
82 There are currently two editor options, nano or vim.
83 Emacs is coming soon...
84 If you're unsure what to pick, nano is simpler to start with and has on-screen
87 * You can open **nano** like this::
91 Here's an online `nano tutorial <http://mintaka.sdsu.edu/reu/nano.html>`_.
93 * You can open **vim** like this::
97 Here's an online `vim tutorial <http://www.openvim.com/tutorial.html>`_.
103 This tutorial also uses a revision control program called
104 `git <http://en.wikipedia.org/wiki/Git_(software)>`_.
105 In order to commit to a git repository,
106 you need to setup your environment to with your identity.
108 You'll need to add these lines to `~/.bashrc` to cause them to be invoked each
109 time you start the development environment.
112 git config --global user.name "John Doe"
113 git config --global user.email johndoe@example.com
115 You can reload you `~/.bashrc` by running:
120 Tour (follow the video)
121 =======================
123 Create a working directory and go into it::
128 Download a zip file containing our sample::
130 $ curl http://nacltools.storage.googleapis.com/io2014/voronoi.zip -O
137 Go into the sample and take a look at the files inside::
142 Our project combines voronoi.cc with several C++ libraries to produce a NEXE
143 (or Native Client Executable).
145 .. image:: /images/voronoi1.png
147 The resulting application combines the NEXE with some Javascript to load
148 the NaCl module, producing the complete application.
150 .. image:: /images/voronoi2.png
152 Let's use git (a revision control program) to track our changes.
154 First, create a new repository::
158 Add everything here::
162 Then commit our starting state::
164 $ git commit -m "imported voronoi demo"
166 Now, likes run **make** to compile our program (NOTE: Changed since video,
167 we've got Makefiles!)::
171 Oops, we get this error::
173 voronoi.cc: In member function 'void Voronoi::Update()':
174 voronoi.cc:506: error: 'struct PSContext2D_t' has no member named 'hieght'
176 We'll need to start an editor to fix this.
177 You'll want to change *hieght* to *height* on line 506.
182 Lets look at the diff::
188 $ git commit -am "fixed build error"
190 To test our application, we run a local web server, written in python.
191 Run the server with this command (NOTE: Running through a Makefile
196 Then, navigate to http://localhost:5103/ to test the demo.
198 If you follow along with the demo video, you will discover the sample crashes
199 when you change the thread count.
204 If you haven't installed the debugger at this point, skip to the next section.
206 At this point, if you have the debugger installed, you should be able to open
207 the developer console and view the resulting crash.
209 You can see a backtrace with::
213 You can see active threads with::
217 Currently, symbol information is limited for GLibC executables.
218 We have improvements coming that will improve the experience further.
220 For newlib and PNaCl executables you can retrieve full symbols information
231 Return to the development environment and stop the test server,
234 Open your editor again, navigate to line 485 and change *valu* to *value*.
240 Check the diff and commit our fix::
243 $ git commit -am "fixed thread ui bug"
245 Now look at your commit history::
249 Run the demo again. And everything now works::
256 Thanks for checking out our environment.
257 Things are rapidly changing and in the coming months you can expect to see
258 further improvements and filling out of our platform and library support.
260 Check back at this page for the latest status.
265 Here is a summary of feature status. We hope to overcome these limitations
268 * NaCl Development Environment
275 * GCC w/ GLibC (x86-32 and x86-64 only)
276 * Lua (install with: `package -i lua && . setup-environment`)
277 * Ruby (install with: `package -i ruby && . setup-environment`)
278 * Nethack! (install with: `package -i nethack && . setup-environment`)
285 * Pipes / Redirection
286 * Symbolic and hard links
288 * Missing / broken on ARM:
295 * Runs reliably only on a recent Beta or Dev Channel (M36+) build.
296 * Currently unreliable on some platforms: