user6936: I'm using Fedora_21_MATE.img on a Raspberry Pi. Installing the Arduino IDE 1.0.6 using these commands, taken from Arduino On Pi. Those instructions are for Raspbian, I assume, so changing for Fedora, apt-get to yum:
sudo yum install arduino

One waits and arduino installs. One can then run the Arduino IDE from the Fedora GUI menu, and it loads - after moaning about the user has to be a member of the dialout and lock groups. This is easily resolved by adding the user to the required groups, using the control panel. 
However, trying to compile anything, i.e. blink, in the IDE, gives me the following error:
avr-g++: error trying to exec cc1plus: execvp: No such file or directory

In verbose mode, little additional information is offered.
Arduino: 1.0.6 (Linux), Board: "Arduino Uno"
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /tmp/build6314348775898760987.tmp/Blink.cpp -o /tmp/build6314348775898760987.tmp/Blink.cpp.o 
avr-g++: error trying to exec 'cc1plus': execvp: No such file or directory

The file in question, cc1plus, is actually present in the filesystem:
[piebody@berrybody ~]$ locate cc1plus
/usr/libexec/gcc/armv7hl-redhat-linux-gnueabi/4.9.2/cc1plus
/usr/libexec/gcc/avr/4.9.2/cc1plus
[piebody@berrybody ~]$ 

Does anyone know why it doesn't run "out of the box"? Do I need to modify any environment variables, and if so, which ones and with what exactly? I assume my PATH environment variable needs fixing, but is there any environment variable specific to avr-g++ that needs changing?
I appreciate that this is probably a simple UNIX paths issue, and that the question may be more suited to SE: Unix & Linux.

user6936: There seem to be two issues:

Getting the IDE to fully function when launched from the command
line, and;
Getting the IDE to fully function (i.e. compile) when launched from
the Fedora GUI menu.

I have found a solution if I run the Arduino IDE from the command line, by adding the path to  one of the cc1plus binaries to the PATH environment variable:
[piebody@berrybody ~]$ PATH=${PATH}:/usr/libexec/gcc/avr/4.9.2
[piebody@berrybody ~]$ export PATH
[piebody@berrybody ~]$ arduino&

However, if I launch the Arduino IDE from the Fedora application menu, and then try to compile a sketch, it still can't locate cc1plus. Maybe the PATH needs to be added in my .profile, or some other mechanism, to get an application launched from the Fedora menu to see the path?1
Yet, even with the command line launch, it still does not finish compiling.  I now get the following error when the IDE attempts to compile:
In file included from Blink.ino:18:0:
/usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:23:20: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
                    ^
compilation terminated.

In verbose mode
Arduino: 1.0.6 (Linux), Board: "Arduino Uno"
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /tmp/build1210300884764677972.tmp/Blink.cpp -o /tmp/build1210300884764677972.tmp/Blink.cpp.o 
In file included from Blink.ino:18:0:
/usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:23:20: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
                    ^
compilation terminated.

I assume that this is another PATH issue. One that relates to the path to the Arduino libraries, or libc libraries.
After reading can't locate avr libraries2, I can't see why avr-g++ is not picking up the avr directory in the /usr directory.
The actual path to stdlib.h is /usr/avr/include/stdlib.h
The output of avr-gcc (and avr-g++) shows --prefix=/usr
The Arduino IDE preference file (~/.arduino/preference.txt) shows the line
last.ide.1.0.6.hardwarepath=/usr/share/arduino/hardware

Linking the includes
If I manually link some header files to where the compiler actually is looking, then it works (until avr-gcc needs a header that I have not linked to):
cd /usr/share/arduino/hardware/arduino/cores/arduino
sudo ln -s /usr/avr/include/stdlib.h stdlib.h
sudo ln -s /usr/avr/include/string.h string.h
sudo ln -s /usr/avr/include/math.h math.h

but I can not do this for every header file, it is ridiculous. There must be a way of linking to /usr/avr from /usr/share/arduino/hardware/arduino/cores/arduino. I have tried linking the parent directories /usr/avr and /usr/avr/include, at various points along the directory hierarchy of /usr/share/arduino/hardware/arduino/cores/arduino, but none of those seem to work.
Copying the include directory
After reading default include file path?, and running avr-cpp -v I saw that the default #include search path was 
#include <...> search starts here:
 /bin/../lib/gcc/avr/4.9.2/include
 /bin/../lib/gcc/avr/4.9.2/include-fixed
End of search list.

From this, I could see that avr-cpp was searching in /lib/gcc/avr/4.9.2/include. I examined, and compared, the contents of /lib/gcc/avr/4.9.2/include with /usr/avr/include and they held similar (the same) files, except /lib/gcc/avr/4.9.2/include was a subset, that is to say that it was missing the required files. 
I ended up copying the /usr/avr/include directory, which contains the required header files (stdlid.h etc., to which I had linked previously), and replacing the original include directory, in the directory where avr-gcc seemed to be looking, which was in its own directory location /lib/gcc/avr/4.9.2/.
cd /lib/gcc/avr/4.9.2/
mv include include.old
cp -r /usr/avr/include .

Then the Arduino compiler seemed to work, until it then gave an assembler error:
Assembler messages
Error: unrecognized option -mmcu=avr5

This is an issue with avr-as.
I will update as I resolve these issues.

1 I eventually resolved this by creating a script in /usr/bin (where the arduino binary was located) called arduino.launch which contains the PATH settings and a call to arduino:
#!/bin/sh
PATH=${PATH}:/usr/libexec/gcc/avr/4.9.2
export PATH
arduino

setting it to be executable with chmod +x arduino.launch. Then I edited the properties of the Fedora Arduino launch icon, by right-clicking on the icon and selecting Properties, and changed the Command entry from arduino to arduino.launch.
However, there must be a better way of doing this, as this seems to be a bit of a hack.
2 Other posts 1, 2 and 3) that I have read, apart from providing useful paths to investigate, merely suggest reinstalling. However, as bone headed as I may seem, there must be a way of linking up what is already on the file system (everything is there - just in the "wrong" place), such that compiles work as they should.

6936: <p>I'm using <a href="http://sourceforge.net/projects/berryboot/files/os_images/Fedora_21_MATE.img/download" rel="nofollow">Fedora_21_MATE.img</a> on a Raspberry Pi. Installing the Arduino IDE 1.0.6 using these commands, taken from <a href="http://www.instructables.com/id/Arduino-On-Pi/" rel="nofollow">Arduino On Pi</a>. Those instructions are for Raspbian, I assume, so changing for Fedora, <code>apt-get</code> to <code>yum</code>:</p>

<pre><code>sudo yum install arduino
</code></pre>

<p>One waits and <code>arduino</code> installs. One can then run the Arduino IDE from the Fedora GUI menu, and it loads - after moaning about the user has to be a member of the <code>dialout</code> and <code>lock</code> groups. This is easily resolved by adding the user to the required groups, using the control panel. </p>

<p>However, trying to compile anything, i.e. <code>blink</code>, in the IDE, gives me the following error:</p>

<pre><code>avr-g++: error trying to exec cc1plus: execvp: No such file or directory
</code></pre>

<p>In verbose mode, little additional information is offered.</p>

<pre><code>Arduino: 1.0.6 (Linux), Board: "Arduino Uno"
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /tmp/build6314348775898760987.tmp/Blink.cpp -o /tmp/build6314348775898760987.tmp/Blink.cpp.o 
avr-g++: error trying to exec 'cc1plus': execvp: No such file or directory
</code></pre>

<p>The file in question, <code>cc1plus</code>, is actually present in the filesystem:</p>

<pre><code>[piebody@berrybody ~]$ locate cc1plus
/usr/libexec/gcc/armv7hl-redhat-linux-gnueabi/4.9.2/cc1plus
/usr/libexec/gcc/avr/4.9.2/cc1plus
[piebody@berrybody ~]$ 
</code></pre>

<p>Does anyone know why it doesn't run "out of the box"? Do I need to modify any environment variables, and if so, which ones and with what exactly? I assume my <code>PATH</code> environment variable needs fixing, but is there any environment variable specific to <code>avr-g++</code> that needs changing?</p>

<p>I appreciate that this is probably a simple UNIX paths issue, and that the question may be more suited to SE: Unix &amp; Linux.</p>
 6936: <p>There seem to be two issues:</p>

<ul>
<li>Getting the IDE to fully function when launched from the command
line, and;</li>
<li>Getting the IDE to fully function (i.e. compile) when launched from
the Fedora GUI menu.</li>
</ul>

<p>I have found a solution if I run the Arduino IDE from the command line, by adding the path to  one of the <code>cc1plus</code> binaries to the <code>PATH</code> environment variable:</p>

<pre><code>[piebody@berrybody ~]$ PATH=${PATH}:/usr/libexec/gcc/avr/4.9.2
[piebody@berrybody ~]$ export PATH
[piebody@berrybody ~]$ arduino&amp;
</code></pre>

<p>However, if I launch the Arduino IDE from the Fedora application menu, and then try to compile a sketch, it still can't locate <code>cc1plus</code>. Maybe the <code>PATH</code> needs to be added in my <code>.profile</code>, or some other mechanism, to get an application launched from the Fedora menu to see the path?<sup>1</sup></p>

<p>Yet, even with the command line launch, it still does not finish compiling.  I now get the following error when the IDE attempts to compile:</p>

<pre><code>In file included from Blink.ino:18:0:
/usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:23:20: fatal error: stdlib.h: No such file or directory
 #include &lt;stdlib.h&gt;
                    ^
compilation terminated.
</code></pre>

<p>In verbose mode</p>

<pre><code>Arduino: 1.0.6 (Linux), Board: "Arduino Uno"
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard /tmp/build1210300884764677972.tmp/Blink.cpp -o /tmp/build1210300884764677972.tmp/Blink.cpp.o 
In file included from Blink.ino:18:0:
/usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:23:20: fatal error: stdlib.h: No such file or directory
 #include &lt;stdlib.h&gt;
                    ^
compilation terminated.
</code></pre>

<p>I assume that this is another <code>PATH</code> issue. One that relates to the path to the Arduino libraries, or <a href="http://ubuntuforums.org/showthread.php?t=441404" rel="nofollow"><code>libc</code></a> libraries.</p>

<p>After reading <a href="http://forum.arduino.cc/index.php?topic=48232.0" rel="nofollow">can't locate avr libraries</a><sup>2</sup>, I can't see why <code>avr-g++</code> is not picking up the <code>avr</code> directory in the <code>/usr</code> directory.</p>

<p>The actual path to <code>stdlib.h</code> is <code>/usr/avr/include/stdlib.h</code></p>

<p>The output of <code>avr-gcc</code> (and <code>avr-g++</code>) shows <code>--prefix=/usr</code></p>

<p>The Arduino IDE preference file (<code>~/.arduino/preference.txt</code>) shows the line</p>

<pre><code>last.ide.1.0.6.hardwarepath=/usr/share/arduino/hardware
</code></pre>

<p><strong>Linking the includes</strong></p>

<p>If I manually link some header files to where the compiler actually is looking, then it works (until <code>avr-gcc</code> needs a header that I have not linked to):</p>

<pre><code>cd /usr/share/arduino/hardware/arduino/cores/arduino
sudo ln -s /usr/avr/include/stdlib.h stdlib.h
sudo ln -s /usr/avr/include/string.h string.h
sudo ln -s /usr/avr/include/math.h math.h
</code></pre>

<p>but I can not do this for <em>every</em> header file, it is ridiculous. There must be a way of linking to <code>/usr/avr</code> from <code>/usr/share/arduino/hardware/arduino/cores/arduino</code>. I have tried linking the parent directories <code>/usr/avr</code> and <code>/usr/avr/include</code>, at various points along the directory hierarchy of <code>/usr/share/arduino/hardware/arduino/cores/arduino</code>, but none of those seem to work.</p>

<p><strong>Copying the include directory</strong></p>

<p>After reading <a href="http://www.avrfreaks.net/forum/default-include-file-path" rel="nofollow">default include file path?</a>, and running <code>avr-cpp -v</code> I saw that the default <code>#include</code> search path was </p>

<pre><code>#include &lt;...&gt; search starts here:
 /bin/../lib/gcc/avr/4.9.2/include
 /bin/../lib/gcc/avr/4.9.2/include-fixed
End of search list.
</code></pre>

<p>From this, I could see that <code>avr-cpp</code> was searching in <code>/lib/gcc/avr/4.9.2/include</code>. I examined, and compared, the contents of <code>/lib/gcc/avr/4.9.2/include</code> with <code>/usr/avr/include</code> and they held similar (the same) files, except <code>/lib/gcc/avr/4.9.2/include</code> was a subset, that is to say that it was missing the required files. </p>

<p>I ended up copying the <code>/usr/avr/include</code> directory, which contains the required header files (<code>stdlid.h</code> etc., to which I had linked previously), and replacing the original <code>include</code> directory, in the directory where <code>avr-gcc</code> seemed to be looking, which was in its own directory location <code>/lib/gcc/avr/4.9.2/</code>.</p>

<pre><code>cd /lib/gcc/avr/4.9.2/
mv include include.old
cp -r /usr/avr/include .
</code></pre>

<p>Then the Arduino compiler seemed to work, until it then gave an assembler error:</p>

<pre><code>Assembler messages
Error: unrecognized option -mmcu=avr5
</code></pre>

<p>This is an issue with <code>avr-as</code>.</p>

<p>I will update as I resolve these issues.</p>

<hr>

<p><sup>1</sup> I eventually resolved this by creating a script in <code>/usr/bin</code> (where the <code>arduino</code> binary was located) called <code>arduino.launch</code> which contains the <code>PATH</code> settings and a call to <code>arduino</code>:</p>

<pre><code>#!/bin/sh
PATH=${PATH}:/usr/libexec/gcc/avr/4.9.2
export PATH
arduino
</code></pre>

<p>setting it to be executable with <code>chmod +x arduino.launch</code>. Then I edited the properties of the Fedora Arduino launch icon, by right-clicking on the icon and selecting <strong>Properties</strong>, and changed the <strong>Command</strong> entry from <code>arduino</code> to <code>arduino.launch</code>.</p>

<p>However, there must be a better way of doing this, as this seems to be a bit of a hack.</p>

<p><sup>2</sup> Other posts <a href="http://forum.arduino.cc/index.php?topic=49652.0" rel="nofollow">1</a>, <a href="http://forum.arduino.cc/index.php?topic=86852.0" rel="nofollow">2</a> and <a href="http://forum.arduino.cc/index.php?topic=52129.0" rel="nofollow">3</a>) that I have read, apart from providing useful paths to investigate, merely suggest reinstalling. However, as bone headed as I may seem, there must be a way of linking up what is already on the file system (everything is there - just in the "wrong" place), such that compiles work as they should.</p>
