3

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.

  • Can you post the verbose build output? – Ignacio Vazquez-Abrams Aug 28 '15 at 2:20
  • Could you try this again with Fedora 23? I just tested it, and it works for me out of the box. – mattdm May 9 '16 at 15:07
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.