aboutsummaryrefslogtreecommitdiff
path: root/files/it/archive/b2g_os/prerequisiti_firefox_os_build/index.html
blob: b2b35ee9dfb61c4e29e1519eabf9749266a3d1a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
---
title: Prerequisiti Firefox OS build
slug: Archive/B2G_OS/Prerequisiti_Firefox_OS_build
translation_of: Archive/B2G_OS/B2G_OS_build_prerequisites
---
<div class="summary">
 <p><span class="seoSummary">Prima di ottnere il codice per compilare Firefox OS, ti serve un <a href="https://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions" title="https://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions">sistema di build</a> ben configurato<span class="seoSummary"> — questa pagina ti mostra come fare. Attualmente, è possibile compilare su sistemi Linux e OS X a 64-bit.</span> </span></p>
</div>
<div class="note">
 <p><strong>Nota</strong>: Per compilare Firefox OS su un telefono, comincia tenendo il tuo telefono DISCONNESSO dal computer. Ti diremo quando collegarlo.</p>
</div>
<h2 id="Avere_un_dispositivoemulatore_compatibile">Avere un dispositivo/emulatore compatibile</h2>
<p>Hai bisogno di un dispositivo compatibile, su cui compilare, oppure utilizzando un emulatore. Difficilmente supportiamo alcuni telefoni, alcuni necessitano di molte variazioni. Al momento supportiamo delle variazioni specifiche e alcuni dispositivi sono costantemente supportati.</p>
<div class="note">
 <p><strong>Note</strong>:  Il<a href="https://github.com/mozilla-b2g/B2G"> codice sorgente B2G</a> della Mozilla è l'implementazione di referenza di B2G, ma i rivenditori di telefoni sono liberi di aggiungere ulteriori patch o apportare modifiche. Quando compri l'Alcatel One Touch per esempio, questo contiene la versione del rivenditore. Ciò non significa che faccia differenza per le applicazioni installate, ma può esserlo a livello di piattaforma. Il porting sul Nexus 4 è mantenuto direttamente da Mozilla; è evidentemente molto più semplice lavorare sulla nostra versione di Gecko, rispetto alle altre.</p>
</div>
<h3 id="Set_1">Set 1</h3>
<p>Il Set numero 1 rappresenta l'obbiettivo principale di sviluppo ed è tipicamente il primo a ricevere bug-fix e funzionalità.</p>
<dl>
 <dt>
  Keon</dt>
 <dd>
  Il Keon è il <a href="http://www.geeksphone.com/" title="http://www.geeksphone.com/">Geeksphone</a> Keon , fù uno dei primi telefoni per sviluppatori.Nota che le build per questo telefono sono rilasciate dalla Geeksphone.</dd>
 <dt>
  Inari</dt>
 <dd>
  Inari è un'altro dispositivo per testare. Usa qusta configurazione per build-are sui dispositivi ZTE Open.<strong>Attenzione:</strong> le build più nuove di Firefox OS potrebbero avere problemi  con il boot sulla partizione di default dei ZTE Open.</dd>
 <dt>
  Flame</dt>
 <dd>
  Il Flame è il nuovo telefono standard di referenza della Mozilla;doversti usare la configurazione del Flame se stai build-ando per il ZTE Open C,entrambi sono basati sul sistema Android Jellybean.</dd>
 <dt>
  <a href="/en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_emulators" title="en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_emulators">Emulatore (ARM e x86)</a></dt>
 <dd>
  Ci sono due emulatori disponibili: uno emula il codice ARM ,l'altro esegue tutto in codice x86. <a href="/en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_emulators" title="/en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_emulators">Impara di più suill'installazione ed utilizzo degli emulatori</a>.</dd>
 <dd>
  <strong>Nota bene che non dovresti utilizzare l'emulatore x86 </strong><strong>— è difficile da installare e non è ben supportato.</strong></dd>
 <dt>
  <a href="/en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_desktop_client" title="/en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_desktop_client">Desktop</a></dt>
 <dd>
  Puoi anche build-are una versione di Firefox OS per desktop; questa esegue  <a href="/en-US/docs/Mozilla/Gecko" title="/en-US/docs/Mozilla/Gecko">Gecko</a> in applicazione <a href="/en-US/docs/XULRunner" title="/en-US/docs/XULRunner">XULRunner</a> , e successivamente usi l'esperienza utente di  <a href="/en-US/docs/Mozilla/Firefox_OS/Platform/Gaia/Introduction_to_Gaia" title="/en-US/docs/Mozilla/Firefox_OS/Platform/Gaia/Introduction_to_Gaia">Gaia</a> ,dentro.</dd>
</dl>
<p>Puoi ,ovviamente , build-are il <a href="/en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_desktop_client" title="en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_desktop_client">client </a><a href="/en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_desktop_client" title="en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_desktop_client">desktop</a> oppure uno degli <a href="/en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_emulators" title="en-US/docs/Mozilla/Firefox_OS/Using_the_B2G_emulators">emulatori</a> senza un telefono.</p>
<h3 id="Set_2">Set 2</h3>
<p><span id="answer_long1" style="display: block;">I dispositivi del Set numero 2,sono funzionanti nella norma e molti sviluppatori (in particolare i sviluppatori di app) li utilizzano ,di conseguenza tendono ad accogliere i cambiamenti in secondo piano.</span></p>
<dl>
 <dt>
  <a href="/en-US/docs/Mozilla/Firefox_OS/Samsung_Nexus_S" title="/en-US/docs/Mozilla/Firefox_OS/Samsung_Nexus_S"><span class="link-https">Samsung Nexus S</span></a></dt>
 <dd>
  I modelli del Nexus S,di cui si è a conoscenza del loro funzionamento ,sono il GT-I9020A e il GTI9023.Gli altri potrebbero funzionare.</dd>
 <dt>
  Samsung Nexus S 4G</dt>
 <dd>
  Il SPH-D720 è supprtato come dispositivo del Set 2.</dd>
</dl>
<h3 id="Set_3">Set 3</h3>
<p><span id="answer_long1" style="display: block;">Firefox Os può essere preparato per questi dispositivi ,ma non hanno funzionato perfettamente su regolari basi degli sviluppatori principali. La loro affidabilità e le loro funzionalità potreggo avere delle latenze,facilemnte avvertibili,più dei dispositivi del Set 1 e del Set 2 .</span></p>
<dl>
 <dt>
  Samsung Galaxy S2</dt>
 <dd>
  L'unico modello cu sui funziona è il i9100; nessun'altra versione funziona officialmente. (Il i9100P potrebbe funzionare, dato che l'unica cosa che differisce è l'aggiunta di un chip NFC)</dd>
 <dt>
  Samsung Galaxy Nexus</dt>
 <dd>
  Non siamo a conoscenza di eventuali varianti non compatibili.</dd>
 <dt>
  Nexus 4</dt>
 <dd>
  Alcuni utenti sull'IRC lo hanno testato con successo. Potrebbe o no,richiedere il re-flash di Android 4.3 se prima aveva Android 4.4 ( Android <a href="https://developers.google.com/android/nexus/images#occamjwr66y">build disponibili da Google </a>)</dd>
 <dt>
  Nexus 5</dt>
 <dd>
  Alcuni utenti sull'IRC lo hanno testato con successo.</dd>
 <dt>
  Tara</dt>
 <dd>
  Tara è un'altro dipsositivo per testare.Il Manifest del  Tara è presente solo nel branch master. Lo script/comando pre ottenere il codice è  "BRANCH=master ./config.sh tara".</dd>
 <dt>
  Unagi</dt>
 <dd>
  Unagi è un dispositivo utilizzato per il test e svilupo della piattaforma come smartphone di fascia basso-media. Molti degli sviluppatori di Firefox OS ,lavorano sul Unagi.</dd>
 <dt>
  <a href="/en-US/docs/Mozilla/Firefox_OS/Pandaboard" title="/en-US/docs/Mozilla/Firefox_OS/Pandaboard">Pandaboard</a></dt>
 <dd>
  La Pandaboard è una board di sviluppo basata sull'architettura OMAP 4,utilizzato per sviluppare su piattaforme mobili.</dd>
</dl>
<div class="warning">
 <strong>Important</strong>e: Solo i dispositivi con almeno Android 4 sono supportati.Se iltuo dispositivo è presente nella lista ma ha un versione di Android più vecchia, serve prima aggiornarlo prima di fare qualsiasi cosa.</div>
<div class="note">
 <p><strong>Appunto:</strong> I dispositivi dei Set 2 e Set 3 ,hanno il tasto Home software anzichè hardware.</p>
 <p>Tutti i dispositivi del Set 1 hanno un pulsante Home hardware che permette all'utente di tornare alla schermata di Home. Molti dispositivi basati su Android ICS,hanno i pulsanti sullo schermo  per la navigzione. Ora a<span style="line-height: 1.5em; font-size: 14px;">bbiamo un pulsante virtuale per i dispositivi senza pulsante hardware.Se non è già attivo automaticamente ,vai su Impostazioni,poi su  <a href="https://developer.mozilla.org/en-US/Firefox_OS/Debugging/Developer_settings">Opzioni Sviluppatore</a> ,e dopo  <a href="/en-US/Firefox_OS/Debugging/Developer_settings#Enable_software_home_button">Abilita il tasto home</a> .</span></p>
 <p><span style="line-height: 1.5em; font-size: 14px;">Nella versione 1.4 c'è anche un'opzione per "Home gesture abilitate",attivandole verrà rimosso il pulsante sullo schermo in favore dello swipe dal basso verso l'alto per tornare alla home.</span></p>
</div>
<h2 id="Requisiti_per_GNULinux">Requisiti per GNU/Linux</h2>
<p>Per fare la build su linux, avrai bisogno:</p>
<ul>
 <li>Una distribuzione a  <strong>64 bit GNU/Linux</strong> (Ubuntu 12.04 raccomandata).</li>
 <li>Almeno <strong>4 GB</strong> di RAM.</li>
 <li>Almeno  <strong>30 GB</strong> di spazio disponibile sull'hard disk.</li>
</ul>
<p>Questo è molto più dei reali requisiti minimi,ma ogni tanto il build-ing fallisce solo per la mancanza di risosrse. Un tipico errore in questo caso è "<span style="line-height: 1.5;"><strong>arm-linux-androideabi-g++: Internal error: Killed (program cc1plus)</strong>".</span></p>
<p>Avrai bisogno anche dei seguenti strumenti installati</p>
<ul>
 <li><strong>autoconf 2.13</strong></li>
 <li><strong>bison</strong></li>
 <li><strong>bzip2</strong></li>
 <li><strong>ccache</strong></li>
 <li><strong>curl</strong></li>
 <li><strong>flex</strong></li>
 <li><strong>gawk</strong></li>
 <li><strong>git</strong></li>
 <li><strong>gcc / g++ / g++-multilib</strong></li>
 <li><strong>make</strong></li>
 <li><strong>OpenGL shared libraries</strong></li>
 <li><strong>patch</strong></li>
 <li><strong>X11 headers</strong></li>
 <li><strong>32-bit ncurses</strong></li>
 <li><strong>32-bit zlib</strong></li>
</ul>
<h3 id="Problemi_della_build_per_emulatore"><strong>Problemi della build per emulatore</strong></h3>
<p>Se stai facendo una build per <strong>emulatore</strong> , you need to pay attention to these issues:</p>
<div class="note">
 <p><strong>First, note that you shouldn't use the x86 emulator — it is hard to install and not well supported.</strong></p>
</div>
<p>Next, the build-system for the emulator builds both 32bit and 64bit versions of the emulator. As the emulator depends on OpenGL, this means that you need to have both 32bit and 64bit versions of OpenGL libraries installed on your system. See the discussion in <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=897727" title="https://bugzilla.mozilla.org/show_bug.cgi?id=897727">bug 897727</a>.</p>
<p>There are two ways that you can solve this problem:</p>
<h4 id="Solution_1_have_both_32bit_and_64bit_OpenGL_libs_installed_with_the_right_symlinks">Solution #1: have both 32bit and 64bit OpenGL libs installed, with the right symlinks</h4>
<p>If your linux distro has multilib packages for OpenGL libraries, you can attempt installing them. You might then have to manually create some symlinks.</p>
<p>For example, here is the situation on Ubuntu 12.04 LTS x86-64. On this distribution, the <code>libgl1-mesa-dev</code> package cannot be installed simultaneously in x86-64 and i386 versions, but you can have the following combination of packages simultaneously installed:</p>
<pre class="bz_comment_text" id="comment_text_12">sudo apt-get install libgl1-mesa-dev libglapi-mesa:i386 libgl1-mesa-glx:i386</pre>
<p>After having run this command, you will still have to manually create some symlinks for the emulator build to succeed:</p>
<pre class="note">sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so</pre>
<h4 id="Solution_2_just_patch_the_emulator_so_it_only_builds_64bit">Solution #2: just patch the emulator so it only builds 64bit</h4>
<p>Just apply <a href="https://bug897727.bugzilla.mozilla.org/attachment.cgi?id=786280" title="https://bug897727.bugzilla.mozilla.org/attachment.cgi?id=786280">this patch</a> to the sdk/ git repository under the B2G repo. This will cause the B2G emulator to only attempt to build the 64bit emulator if you're on a 64bit system, thus avoiding any multilib issues. The 32bit emulator is unused anyway on a 64bit system. This is the simplest solution, until this patch eventually bit-rots.</p>
<h3 id="64_bit_requirement_installation">64 bit requirement installation</h3>
<p>This section lists the commands you need to run in different Linux distributions to install all the requirements for building Firefox OS.</p>
<h4 id="Ubuntu_12.04_Linux_Mint_13_Debian_6">Ubuntu 12.04 / Linux Mint 13 / Debian 6</h4>
<p>Run the following command in Terminal:</p>
<pre>sudo apt-get update
sudo apt-get install autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev make zip</pre>
<p>If you'll build for the <a href="https://developer.mozilla.org/en-US/Firefox_OS/Developer_phone_guide/Flame">"Flame"</a> reference device or Nexus 5, run the following command in Terminal:</p>
<pre>sudo apt-get install libxml2-utils </pre>
<p>And see the above comments about emulator build issues!</p>
<h4 id="Ubuntu_12.10">Ubuntu 12.10</h4>
<p>Run the following command in Terminal:</p>
<pre>sudo apt-get install autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib gcc-4.6 g++-4.6 g++-4.6-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev make zip</pre>
<p>In addition to the emulator build issues discussed above, the compiler will default to <code>gcc-4.7</code>, which will fail to build with an error along the following lines:</p>
<p>"<code>KeyedVector.h:193:31: error: indexOfKey was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation"</code></p>
<p>To fix this, you will need to specify GCC 4.6 as the default host compiler after having retrieved the B2G sources: Read <a href="/en-US/docs/Mozilla/Firefox_OS/Customization_with_the_.userconfig_file#Changing_the_default_host_compiler">Changing the default host compiler</a> to find out how to do it.</p>
<p class="note">In a fresh Ubuntu 12.10 install, you'll get an error about unmet dependencies for ia32-libs. The following commands fix it:</p>
<pre>sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install ia32-libs</pre>
<h4 id="Ubuntu_13.04">Ubuntu 13.04</h4>
<p>Run the following command in Terminal:</p>
<pre>sudo apt-get install --no-install-recommends autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib gcc-4.6 g++-4.6 g++-4.6-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev zlib1g:amd64 zlib1g-dev:amd64 zlib1g:i386 zlib1g-dev:i386 libgl1-mesa-dev libx11-dev make zip</pre>
<p>In addition to the emulator build issues discussed above, the compiler will default to <code>gcc-4.7</code>, which will fail to build with an error along the following lines:</p>
<p>"<code>KeyedVector.h:193:31: error: indexOfKey was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation"</code></p>
<p>To fix this, you will need to specify GCC 4.6 as the default host compiler after having retrieved the B2G sources: Read <a href="/en-US/docs/Mozilla/Firefox_OS/Customization_with_the_.userconfig_file#Changing_the_default_host_compiler">Changing the default host compiler</a> to find out how to do it.</p>
<h4 id="Ubuntu_13.10">Ubuntu 13.10</h4>
<p>With Ubuntu 13.10, multi-arch packages are now the main way to support multiple architectures (e.g. 32-bit on a 64-bit install).  You must tell your Ubuntu system that you want to support 32-bit packages as well:<br>
  </p>
<pre>sudo dpkg --add-architecture i386
sudo apt-get update</pre>
<p>Once you've completed that, then you can install the necessary packages:</p>
<pre style="font-family: 'Open Sans', sans-serif; line-height: 21px;">sudo apt-get install --no-install-recommends autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib gcc-4.6 g++-4.6 g++-4.6-multilib git lib32ncurses5-dev lib32z1-dev zlib1g:amd64 zlib1g-dev:amd64 zlib1g:i386 zlib1g-dev:i386 libgl1-mesa-dev libx11-dev make zip libxml2-utils

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 1

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 2

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 1

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 2

sudo update-alternatives --set gcc "/usr/bin/gcc-4.6"

sudo update-alternatives --set g++ "/usr/bin/g++-4.6" </pre>
<h4 id="Fedora_17181920"><br>
 Fedora 17/18/19/20</h4>
<p>Run the following command in Terminal:</p>
<pre class="note">sudo yum install autoconf213 bison bzip2 ccache curl flex gawk gcc-c++ git glibc-devel glibc-static libstdc++-static libX11-devel make mesa-libGL-devel ncurses-devel patch zlib-devel ncurses-devel.i686 readline-devel.i686 zlib-devel.i686 libX11-devel.i686 mesa-libGL-devel.i686 glibc-devel.i686 libstdc++.i686 libXrandr.i686 zip perl-Digest-SHA wget</pre>
<p>In addition to the above you will need GCC 4.6.x in order to compile the project:</p>
<ul>
 <li><a href="http://people.mozilla.org/~gsvelto/gcc-4.6.4-fc18.tar.xz">Pre-compiled GCC 4.6.x for  Fedora 17/18</a></li>
 <li><a href="http://people.mozilla.org/~gsvelto/gcc-4.6.4-fc19.tar.xz">Pre-compiled GCC 4.6.x for Fedora 19/20</a></li>
</ul>
<p>Download the right version for your Fedora installation, then install it to <code>/opt,</code> with the following command on Fedora 17/18:</p>
<pre class="note">curl -O http://people.mozilla.org/~gsvelto/gcc-4.6.4-fc18.tar.xz
sudo tar -x -a -C /opt -f gcc-4.6.4-fc18.tar.xz
</pre>
<p>And with the following command for Fedora 19/20:</p>
<pre class="note">curl -O http://people.mozilla.org/~gsvelto/gcc-4.6.4-fc19.tar.xz
sudo tar -x -a -C /opt -f gcc-4.6.4-fc19.tar.xz
</pre>
<p>You will need to specify GCC 4.6.x as the default host compiler after having retrieved the B2G sources: Read <a href="/en-US/docs/Mozilla/Firefox_OS/Customization_with_the_.userconfig_file#Changing_the_default_host_compiler">Changing the default host compiler</a> to find out how to do it.</p>
<p>If build fails with the compiler complaining about not finding libmpc.so.2, install the package compat-libmpc</p>
<h4 id="Arch_Linux"><strong>Arch Linux</strong></h4>
<p>Run the following command in Terminal:</p>
<pre class="note">sudo <span style=""><span style="">pacman -S --needed </span></span><span style=""><span style="">alsa-lib </span></span><span style=""><span style="">autoconf2.13</span></span><span style=""><span style=""> bison</span></span><span style=""><span style=""> ccache</span></span><span style=""><span style=""> </span></span><span style=""><span style="">curl firefox </span></span><span style=""><span style="">flex </span></span><span style=""><span style="">gcc-multilib </span></span><span style=""><span style="">git </span></span><span style=""><span style="">gperf </span></span><span style=""><span style="">libnotify </span></span><span style=""><span style="">libxt </span></span><span style=""><span style="">libx11 mesa multilib-devel </span></span><span style=""><span style="">wget wireless_tools </span></span><span style=""><span style="">yasm</span></span><span style=""><span style=""> zip </span></span><span style=""><span style="">lib32-mesa </span></span>lib32-mesa-libgl <span style=""><span style="">lib32-ncurses lib32-readline</span></span><span style=""><span style=""> </span></span><span style=""><span style="">lib32-zlib</span></span></pre>
<p>To install the lib32-* packages you need to have the multilib repository enabled.</p>
<p>B2G <a href="https://developer.mozilla.org/en-US/Firefox_OS/Building#KeyedVector.h.3A193.3A31.3A_error.3A_indexOfKey_was_not_declared_in_this_scope">can only be compiled with gcc4.6.4</a>, and because Arch Linux always has bleeding edge software you will need to install <a href="https://aur.archlinux.org/packages/gcc46-multilib">gcc46-multilib from AUR</a>. Note that you will have to edit the PKGBUILD and add <code>staticlibs</code> to the <code>options</code> array, or gcc will be unable to compile B2G and give you a <code>cannot find -lgcc</code> error when compiling. You will also need to add the following to your <code>.userconfig</code> file:</p>
<pre class="language-html">export CC=gcc-4.6.4
export CXX=g++-4.6.4</pre>
<p>By default, Arch Linux uses Python3. You'll have to force it to use the old python2. You can do that by linking the python2 executable to python but this is discouraged and considered error-prone. This will also break python 3 if it is installed on your system. A better way is to use <code>virtualenv</code>/<code>virtualenvwrapper</code>:</p>
<pre><span style=""><span style="">sudo pacman -S python-virtualenvwrapper
</span></span>source /usr/bin/virtualenvwrapper.sh
mkvirtualenv -p `which python2` firefoxos
workon firefoxos
</pre>
<p>Android will complain that you need make 3.81 or make 3.82 instead of 4.0. You can download <a href="https://aur.archlinux.org/packages/make-3.81/">make 3.81 from AUR</a>.  This will install the make-3.81 binary on your path, you need to create a symlink named make to a location earlier in the PATH variable for the build to use the correct version.</p>
<pre>mkdir -p ~/bin
ln -s `which make-3.81` ~/bin/make
export PATH=~/bin:$PATH
</pre>
<p>Android also needs the Java6 SDK and Arch only has Java7.  Unfortunately the aur build is broken, but you can still download the <a href="http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR">Java 6 SDK</a> and install it manually.  You will then need to put it in your path.</p>
<pre>cp ~/Downloads/jdk-6u45-linux-x64.bin /opt
su
cd /opt
chmod +x jdk-6u45-linux-x64.bin
./jdk-6u45-linux-x64.bin
exit
ln -s /opt/jdk1.6.0_45/bin/java ~/bin/java

</pre>
<h4 id="Gentoo_Linux"><strong>Gentoo Linux</strong></h4>
<h5 id="Installing_ccache">Installing ccache</h5>
<p>You will need to install <strong><a href="http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&amp;chap=3#doc_chap3">ccache</a></strong>, a tool for caching partial builds.</p>
<pre><span style=""><span style=""># emerge -av ccache</span></span>
</pre>
<p>Because ccache is known to frequently cause support issues, Gentoo encourages you to use it <em>explicitly</em> and <em>sparingly</em>.</p>
<p>To enable the required use of ccache, on <em>the subsequent step</em> of this guide where the <code>./build.sh</code> script is called, Gentoo users should instead run the command with an explicitly extended path, ie.</p>
<pre><span style=""><span style=""><strong>PATH=/usr/lib64/ccache/bin:$PATH</strong> ./build.sh</span></span>
</pre>
<h5 id="Generating_Partition_Images">Generating Partition Images</h5>
<p>If you are building B2G for actual physical hardware, then you may at some point also wish to generate some partition images for upload to your device. (For example, to restore backed up files to the device via the <strong><em>fastboot</em></strong> utility)</p>
<p>The filesystem image format used in this case is YAFFS2 (Yet Another Filesystem 2). Gentoo has support for the very latest (ie. git HEAD) <code>yaffs2-utils</code> userland package in portage. (Note: You will also need kernel patches if you want to mount YAFFS2 images, but this is not really required since you can deconstruct and rebuild them instead.)</p>
<pre># emerge --autounmask-write yaffs2-utils; etc-update; emerge -av yaffs2-utils</pre>
<p>In order to generate such an image, simply change to the parent directory of the partition filesystem tree you wish to package, and issue a command like this:</p>
<pre>mkyaffs2image system/ system.img</pre>
<h2 id="Requirements_for_Mac_OS_X">Requirements for Mac OS X</h2>
<p>To build Firefox OS on Mac OS X, there are a number of prequisite steps you need to follow, which are detailed below. We also discuss common errors you might come across in particular situations, and solutions to those.</p>
<div class="note">
 <p><strong>Note: Configuring and Building B2G for Keon WON'T WORK on a Mac</strong>. You'll need to use Linux to build B2G for this device.</p>
</div>
<h3 id="Version_Compatibility"><strong>Version Compatibility</strong></h3>
<p>XCode 4.2 or older are not compatible with Mac OS X 10.9 (a.k.a. "Mavericks"), so you may be surprised to find build failures of Firefox OS. Basically you can no longer build ICS emulator on Mac OS X 10.9 or above, and flatfish fails to build with XCode 5.x series.</p>
<table class="standard-table">
 <caption>
  Version compatibility of Mac OS X 10.9.x</caption>
 <tbody>
  <tr>
   <td> </td>
   <td>emulator (ICS)</td>
   <td>flatfish (JB-4.2)</td>
   <td>emulator-jb (JB-4.3)</td>
   <td>emulator-kk (KitKat-4.4)</td>
  </tr>
  <tr>
   <td>XCode 4.3.3</td>
   <td style="text-align: center;">X</td>
   <td style="text-align: center;">X</td>
   <td style="text-align: center;">X</td>
   <td style="text-align: center;">X</td>
  </tr>
  <tr>
   <td>XCode 4.4.1</td>
   <td style="text-align: center;">X</td>
   <td style="text-align: center;">O[1]</td>
   <td style="text-align: center;">O</td>
   <td style="text-align: center;">O</td>
  </tr>
  <tr>
   <td>XCode 4.5.2</td>
   <td style="text-align: center;">X</td>
   <td style="text-align: center;">O[1]</td>
   <td style="text-align: center;">O</td>
   <td style="text-align: center;">O</td>
  </tr>
  <tr>
   <td>XCode 4.6.3</td>
   <td style="text-align: center;">X</td>
   <td style="text-align: center;">O[1]</td>
   <td style="text-align: center;">O</td>
   <td style="text-align: center;">O</td>
  </tr>
  <tr>
   <td>XCode 5.0.2</td>
   <td style="text-align: center;">X</td>
   <td style="text-align: center;">X</td>
   <td style="text-align: center;">O</td>
   <td style="text-align: center;">O</td>
  </tr>
  <tr>
   <td>XCode 5.1.1</td>
   <td style="text-align: center;">X</td>
   <td style="text-align: center;">X</td>
   <td style="text-align: center;">O</td>
   <td style="text-align: center;">O</td>
  </tr>
 </tbody>
</table>
<ol>
 <li>You must have environment variable <strong>BUILD_MAC_SDK_EXPERIMENTAL=1</strong> exported to build flatfish.</li>
</ol>
<h3 id="Install_XCode_Command_Line_Utilities"><strong>Install XCode Command Line Utilities</strong></h3>
<p>You need to install Xcode's Command Line Utilities. You can download <em>just</em> the Command Line Utilities from <a href="https://developer.apple.com/downloads/" title="https://developer.apple.com/downloads/">Apple's developer downloads page</a> for your particular version of OS X, however if you would like the entire Xcode suite of applications, you can <a class="external" href="http://itunes.apple.com/us/app/xcode/id497799835?mt=12" style="line-height: 1.572;" title="http://itunes.apple.com/us/app/xcode/id497799835?mt=12">install Xcode</a><span style="line-height: 1.572;"> through the Mac App Store. </span></p>
<p>Xcode 4.3.1 (OS X 10.7 "Lion") and other newer versions such as 4.4.1+ (that is, Mac OS X 10.8 "Mountain Lion"), won't necessarily include the required Command Line Utilities. When you install Xcode, make sure to go into Preferences, then the Downloads panel, and install the Command Line Utilities. In addition, make sure you have at least 20 GB of free disk space.</p>
<p><img alt="Screenshot of Xcode Downloads Command Line Tools" src="/files/4557/xcode_downloads_command_line_tools.png" style="width: 750px; height: 528px;"></p>
<div class="note">
 <p><strong>Note:</strong> The Firefox OS emulator requires a Core 2 Duo processor or later; that is, a system that is compatible with Mac OS X 10.7 "Lion". You do not actually have to be running Lion, you just have to be compatible with it. You can, however, build any Firefox OS build on many older Macs.</p>
</div>
<div class="note">
 <p><strong>Note:</strong> XCode 4.2.x or older is not compatible with Mac OS X 10.9 or above, and XCode 4.3.x has no platform SDK for 10.8. Please install a newer version. If you're also working on flatfish, please make sure any of XCode 4.4, 4.5, and 4.6 is available.</p>
</div>
<h3 id="Run_Firefox_OS_Mac_Bootstrap">Run Firefox OS Mac Bootstrap</h3>
<p>Next, open a terminal and run the following command:</p>
<pre class="brush: bash">curl -fsSL https://raw.github.com/mozilla-b2g/B2G/master/scripts/bootstrap-mac.sh | bash</pre>
<p>This will pull and run a bootstrap script that makes sure you have all the prerequisites met to build the emulator. It will also prompt you for permission to install anything you're missing, and provide warnings and suggested fixes to problems. The script will check for and install the following items:</p>
<ul>
 <li><code>git</code></li>
 <li><code>gpg</code></li>
 <li><code>ccache</code></li>
 <li><code>yasm</code></li>
 <li><code>autoconf-213</code></li>
 <li><code>gcc-4.6</code></li>
 <li><code>gnu-tar</code></li>
 <li><code>homebrew</code></li>
</ul>
<h4 id="Xcode_wrangling">Xcode wrangling</h4>
<p>If you have already upgraded to Xcode 4.4+ and get the message that Xcode is outdated, check the Xcode path with:</p>
<pre>xcode-select -print-path</pre>
<p>If it still points to <code>/Developer</code> you can update the path with:</p>
<pre>sudo xcode-select -switch /Applications/Xcode.app</pre>
<h4 id="Making_the_Mac_OS_X_10.6_SDK_available">Making the Mac OS X 10.6 SDK available</h4>
<p>You also need to have the Mac OS X 10.6 SDK available. The SDK needs to be available at</p>
<pre>/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/</pre>
<p>If it cannot be found there you will need to extract and copy it from Xcode 4.3. To do this:</p>
<ol>
 <li>Download the XCode 4.3 .dmg file from the <a class="external" href="https://developer.apple.com/downloads/index.action">Apple Developer</a> portal (you'll need an <a href="https://developer.apple.com/register/index.action" title="https://developer.apple.com/register/index.action">Apple Developer account</a>).</li>
 <li>Download the utility <a href="http://www.charlessoft.com/" title="http://www.charlessoft.com/">Pacifist</a> and use it to extract the 10.6 SDK from the XCode 4.3 .dmg file. Click on the "Extract Package" button, find the SDK by searching for 10.6 in the search box, then <em>Ctrl + click</em> on the MacOSX10.6.sdk directory and Extract it to a suitable location.</li>
 <li>Add a symlink from the 10.6 SDK location to the <code>/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/</code> directory. For example, if you put the 10.6 SDK on your desktop, the comment would be</li>
</ol>
<pre>ln -s /Users/<em>&lt;yourusername&gt;</em>/Desktop/MacOSX10.6.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/</pre>
<div class="note">
 <p><strong>Note:</strong> This is not necessary for Mac OS X 10.9 or above, because 10.6 SDK is for ICS and ICS doesn't supports Mac OS X 10.9.</p>
</div>
<h3 id="Be_aware_of_Mac_file_system_case_sensitivity">Be aware of Mac file system case sensitivity</h3>
<p>By default, Mac OS X ships with a case-insensitive file system.  This is problematic because the Linux kernel has a number of files with the same name, but different case.  For example, see the header files <code>xt_CONNMARK.h</code> and <code>xt_connmark.h</code>.  This results in a number of files appearing to be modified in <code>/kernel</code> after a fresh <code>./config.sh</code>.</p>
<p>In many cases you can run the build just fine; for some platforms, however, you may encounter the following error:</p>
<pre><span class="quote">ERROR: You have uncommited changes in kernel
You may force overwriting these changes
with |source build/envsetup.sh force|

ERROR: Patching of kernel/ failed.</span></pre>
<p><span class="quote">Please see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=867259" title="https://bugzilla.mozilla.org/show_bug.cgi?id=867259">bug 867259</a></span> for more discussion and possible fixes for this problem.</p>
<p>Alternatively, it will always be safest to build on a case sensitive file system.  The easiest way to do this is to create a separate, mountable disk image with case-sensitivity enabled.  You can do this using Apple's Disk Utility application or from the command line:</p>
<pre>hdiutil create -volname 'firefoxos' -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/firefoxos.sparseimage</pre>
<p>Mount the drive with:</p>
<pre>open ~/firefoxos.sparseimage</pre>
<p>Change into the mounted drive with:</p>
<pre>cd /Volumes/firefoxos/</pre>
<p>You can then check out the code and compile from this location without worrying about case-sensitivity problems.</p>
<h3 id="Mountain_Lion_homebrew_gotcha">Mountain Lion homebrew gotcha</h3>
<div>
 <div>
  If you are on Mountain Lion and you receive an error during the installation of the dependencies via homebrew, such as:</div>
</div>
<div>
 <pre>clang: error: unable to execute command: Segmentation fault: 11</pre>
 ... try reinstalling the dependency manually adding the <code>--use-gcc</code> flag, for example:
 <pre>brew install mpfr --use-gcc</pre>
</div>
<h3 id="Follow_Samsung_Galaxy_S2_extra_steps">Follow Samsung Galaxy S2 extra steps</h3>
<p>If you plan to build for the Samsung Galaxy S2, you will also need to install heimdall. See {{ anch("Installing heimdall") }} for details. This is <strong>not</strong> done for you by the bootstrap script!</p>
<div class="note">
 <strong>Note:</strong> If you have installed the <a class="external" href="http://www.samsung.com/us/kies/" title="http://www.samsung.com/us/kies/">Samsung Kies</a> tool, which is used to manage the contents of many Samsung phones, you will have to remove it before you can flash Firefox OS onto your device. You can use the standard application removal process on Windows; on Mac, the Kies install disk image has a utility to fully remove Kies from your system. Flashing <strong>will not work</strong> if you have Kies installed. If you forget to remove Kies, the build system will detect it and remind you to uninstall it. Note also that the uninstall tool does not correctly remove the folder <code>~/Library/Application Support/.FUS</code>, and leaves a reference to a utility there in your user startup items list. You will want to remove these manually.</div>
<h3 class="note" id="Fix_libmpc_dependency_if_broken">Fix libmpc dependency if broken</h3>
<p><code>gcc 4.6</code> was built with <code>libmpc 0.9</code>; if you then use homebrew to update packages, libmpc gets updated to version 1.0, but homebrew doesn't rebuild <code>gcc 4.6</code> after the library version changes. So you need to create a symlink to make things work again, like this:</p>
<pre>cd /usr/local/lib/
ln -s libmpc.3.dylib libmpc.2.dylib</pre>
<h3 id="Optional_Install_HAX">Optional: Install HAX</h3>
<p>Intel provides a special driver that lets the B2G emulator run its code natively on your Mac instead of being emulated, when you're using the x86 emulator. If you wish to use this, you can <a class="external" href="http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/" title="http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/">download and install</a> it. It's not required, but it can improve emulation performance and stability.  </p>
<p>Before you install HAX you will need to install the <a href="http://developer.android.com/sdk/index.html" title="http://developer.android.com/sdk/index.html">Android SDK</a>.</p>
<h2 class="note" id="Install_adb">Install adb</h2>
<p>The build process needs to pull binary blobs from the Android installation on the phone before building B2G (unless you're building the emulator, of course).  For this, you will need <code>adb</code>, the Android Debug Bridge. Our <a href="/en-US/Firefox_OS/Debugging/Installing_ADB">Installing ADB</a> article explains how to get <code>adb</code> installed.</p>
<div class="warning">
 <p>Note for future when you start to use adb: adb needs the phone's lock screen to be unlocked in order to see your phone (at least in later versions of Firefox OS). You'll probably want to disable the lock screen (we'll get to how later in the build instructions).</p>
</div>
<h2 class="note" id="Install_heimdall">Install heimdall</h2>
<p>Heimdall is a utility for flashing the Samsung Galaxy S2. It's used by the Boot to Gecko flash utility to replace the contents of the phone with Firefox OS, as well as to flash updated versions of B2G and Gaia onto the device. You'll need it if you want to install Firefox OS on a Galaxy S2; it is <strong>not</strong> needed for any other device. For other devices, we build and use the fastboot utility instead.</p>
<div class="note">
 <strong>Note:</strong> Again, it's important to note that this is <strong>only required for installing Firefox OS on the Samsung Galaxy S2</strong>.</div>
<p>There are two ways to install heimdall:</p>
<ul>
 <li>You can <a class="link-https" href="https://github.com/Benjamin-Dobell/Heimdall" title="https://github.com/Benjamin-Dobell/Heimdall">download the code</a> GitHub and build it yourself.</li>
 <li>Use a package manager to install it.
  <ul>
   <li>On Linux: <code>sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev</code></li>
   <li>On Mac, you can <a class="link-https" href="https://github.com/downloads/Benjamin-Dobell/Heimdall/heimdall-suite-1.3.2-mac.dmg" title="https://github.com/downloads/Benjamin-Dobell/Heimdall/heimdall-suite-1.3.2-mac.dmg">download an installer package</a> and use that.</li>
  </ul>
 </li>
</ul>
<h2 id="Configure_ccache">Configure ccache</h2>
<p>The B2G build process uses ccache. The default cache size for ccache is 1GB, but the B2G build easily saturates this; around 3GB is recommended. You can configure your cache by running the following command inside terminal:</p>
<pre><code>$ ccache --max-size 3GB</code></pre>
<h2 id="For_Linux_configure_the_udev_rule_for_your_phone">For Linux: configure the udev rule for your phone</h2>
<div class="note">
 <p><strong>Note</strong>: This section is specific to Linux; Mac OS X has the necessary device permissions set up already.</p>
</div>
<p>Next, you need to confingure the udev rule for your phone,</p>
<p>You can get the <a href="https://developer.android.com/tools/device.html#VendorIds">USB vendor ID</a> by running <code>lsusb</code> with your phone plugged in, but typically it's Google <code>18d1,</code> Samsung <code>04e8</code>, ZTE <code>19d2</code>, Geeksphone/Qualcomm <code>05c6</code>. Add this line in your <code>/etc/udev/rules.d/android.rules</code> file (replacing <code>XXXX</code> with the ID for your device):</p>
<pre>SUBSYSTEM=="usb", ATTR{idVendor}=="XXXX", MODE="0666", GROUP="plugdev"</pre>
<p>Take ZTE for example, the content in android.rules will be</p>
<pre style="font-size: 14px;">SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", MODE="0666", GROUP="plugdev"</pre>
<div class="note">
 <p><span style="line-height: 1.572;">If the file doesn't exist, create it. The <code>rules.d</code> directory is usually read only by default, so you may have to use <code>chmod</code> to make the directory writeable, or the file, or both.</span></p>
</div>
<p><span style="line-height: 1.572;">Once you've saved the file, and closed it,  make the file readable:</span></p>
<pre>sudo chmod a+r /etc/udev/rules.d/android.rules
</pre>
<p>Now that the udev rules have been updated, restart the udev daemon. For ubuntu:</p>
<pre>sudo service udev restart</pre>
<p>Finally, unplug and the USB cable but don't replug it in because we need to enable remote debugging on the phone first.</p>
<h2 id="Enable_remote_debugging">Enable remote debugging</h2>
<p>Before you plug your phone back into your USB port, put it USB developer mode. This allows you to debug and flash the phone. To enable developer mode, on your phone enable <a href="/en-US/Firefox_OS/Debugging/Developer_settings#Remote_debugging">Remote Debugging</a> in <a href="/en-US/Firefox_OS/Debugging/Developer_settings">Developer settings</a> (this was called Developer mode on older versions.) Once the option is checked, remote debugging is enabled, and you are ready to go.</p>
<p>At this point, connect your phone to your computer via a USB cable (if you created the udev rule before, this will trigger udev to detect the phone and create the device node with the right permissions). Now you can check if you can list your device via the <code>adb devices</code> command (remember that adb can only see your phone when the lock screen is unlocked). If everything has worked ok, you should see an output similar to this (the following is for a Geeksphone Keon):</p>
<pre style="font-size: 14px;">$ adb devices
List of devices attached
full_keon       device</pre>
<p>If the device did not list as expect, check the file name and the script are all correct (see previous section), then restart the computer and retype the command again. Note also that if your device uses fastboot, the bootloader may identify itself with a different vendor ID than the one you see when the device boots normally.</p>
<h2 id="Backup_the_phone_system_partition">Backup the phone system partition</h2>
<div class="note">
 <p><strong>Note</strong>: You have to do this before you build your device if you do not have an existing system backup, because some libraries will be referenced in build time. These library might be proprietary so we can't provide in our code base.</p>
</div>
<p>It is recommended that you back up the entire Android system partition on your phone.</p>
<p>You can use this copy of the binary blobs for Android in case you later delete your B2G tree. To do this, run:</p>
<pre>adb pull /system &lt;backup target dir&gt;/system
</pre>
<p> Depending on the phone, you may also need to pull the <code>/data</code> and/or <code>/vendor</code> directories:</p>
<pre>adb pull /data &lt;backup target dir&gt;/data
adb pull /vendor &lt;backup target dir&gt;/vendor
</pre>
<p>If the pull commands fail with an "insufficient permission" message, try the following:</p>
<ul>
 <li>stop and restart the adb server, or if that fails,</li>
 <li>double-check that you have granted root permissions to the <code>adb</code> tool within your custom ROM (e.g. under CyanogenMod, change <em>Settings &gt; System &gt; Developer Options &gt; Root Access</em> to <em>Apps and ADB</em> or <em>ADB only</em>).</li>
 <li>Verify that you have set up the udev rule correctly (see {{ anch("For Linux: configure the udev rule for your phone") }}.</li>
</ul>
<h2 id="On_to_the_next_step">On to the next step</h2>
<blockquote>
 <p>At this point, you should be ready to <a href="/en-US/docs/Mozilla/Firefox_OS/Preparing_for_your_first_B2G_build" title="en-US/docs/Mozilla/Firefox_OS/Preparing_for_your_first_B2G_build">fetch the Firefox OS code</a>!</p>
</blockquote>