Sketch compiles on PC but not on Raspberry Pi

O have this Sketch

String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete
int ledpin = 13;
#include <Time.h>  
#include <Wire.h>  
#include <DS1307RTC.h>  // a basic DS1307 library that returns time as a time_t

  
void setup() 
{
// initialize serial:
  Serial.begin(9600);
// reserve 200 bytes for the inputString:
  inputString.reserve(200); 
  while (!Serial) ; // wait until Arduino Serial Monitor opens
  setSyncProvider(RTC.get);   // the function to get the time from the RTC
  if(timeStatus()!= timeSet) 
     Serial.println("Unable to sync with the RTC");
  else
     Serial.println("RTC has set the system time");      
}

void loop() 
{
// print the string when a newline arrives and turn led on/off
  if (stringComplete) 
  {
    Serial.println(inputString);
    if(inputString == "1")
    {
      Serial.print(inputString);
      if (timeStatus() == timeSet) 
      {
        digitalClockDisplay();
      }
      else 
      {
        Serial.println("The time has not been set.  Please run the Time");
        Serial.println("TimeRTCSet example, or DS1307RTC SetTime example.");
        Serial.println();
        delay(4000);
      }
      delay(1000);
    }
    else if(inputString == "two")
    {
      digitalWrite(ledpin,LOW);
    }
    inputString = "";
    stringComplete = false;
  }
}
void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year()); 
  Serial.println(); 
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

/*
  SerialEvent occurs whenever a new data comes in the
 hardware serial RX.  This routine is run between each
 time loop() runs, so using delay inside loop can delay
 response.  Multiple bytes of data may be available.
 */
void serialEvent() 
{
  while (Serial.available()) 
  {
// get the new byte:
    char inChar = (char)Serial.read(); 
//    Serial.print(inChar);    // add it to the inputString:
    if (inChar == '\n') 
    {
      stringComplete = true;
    }
    else
    {
    inputString += inChar;
    }
  }
}

It compiles without error on my win7-64 bit pc, but fail when I attempt to compile on my Raspberry Pi. The error is

/usr/share/arduino/libraries/Time/DateStrings.cpp:41:22: error: variable ‘monthNames_P’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
/usr/share/arduino/libraries/Time/DateStrings.cpp:58:20: error: variable ‘dayNames_P’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
/usr/share/arduino/libraries/Time/DateStrings.cpp:59:24: error: variable ‘dayShortNames_P’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’

Any ideas?
Jim

Yes. Go to the Raspberry Pi site and ask them.

I believe it is the IDE version for RPi that is your problem. What IDE version are they using now?

The newer IDE versions on the Arduino website have their own gcc compiler and libraries included in the download. I'm not sure how the IDE in the RPi repository gets the compiler and libraries.

I tried downloading a current Linux IDE from the Arduino website onto my RPi, and could not get it to compile. :frowning:

econjack:
Yes. Go to the Raspberry Pi site and ask them.

i have similar problems, i wanted to download from RPI arduino IDE to a arduino DUE ( not known )
and a arduino pro micro ( possible as leonardo ).
the IDE there is called "1.0.1" and i got it by:
sudo apt-get install -y arduino
download the devices from win7 PC with the windows version arduino IDE no problem,
and connect them then to win7 PC with python / or RPI with python / all no problem.
example:http://kll.engineering-news.org/kllfusion01/downloads/uPCS_RPI_POINTS.jpg
@econjack your answer means that the arduino ?developers? ?you? have nothing to do with this?
i just want find out who is working on this and if possible i could download a newer version from there?

The Yun and Due require an IDE version v1.5.x. The Arduino website recommends v1.5.7.

IDE v1.0.1 won't work.

You need to get together with developers on the RPi site to get them to upgrade the repository version. I tried downloading the latest IDE from the Arduino site to my RPi, but it won't compile. It throws a bunch of compiler errors. :frowning:

@econjack your answer means that the arduino ?developers? ?you? have nothing to do with this?

The Arduino team members rarely reply on the forum. Those of us who do have nothing to do with the packages available from the Arduino team or the packages that the raspberry pi people put together for the Pi.

I tried running a Linux 32 bit IDE v1.0.5 on the RPi, and it won't even start. If you try to run it from a terminal, it throws errors about the Java version .so files are for a 32 bit processor, not an ARM based processor.

There are two options.

  1. get the RPi repository IDE upgraded to v1.5.7
    or
  2. Get Arduino to offer an ARM based IDE version

Do the obvious, fix the source code.

In file Time/DateStrings.cpp.

Line 41.

From: PGM_P monthNames_P[] PROGMEM = 
To: PGM_P const monthNames_P[] PROGMEM =

Line 58.

From: PGM_P dayNames_P[] PROGMEM = 
To: PGM_P const dayNames_P[] PROGMEM =

Line 59.

From: char dayShortNames_P[] PROGMEM =
To: const char dayShortNames_P[] PROGMEM =

tf68 said, Do the obvious, fix the source code.

Not exactly obvious to this beginner. Certainly not obvious from the error messages. BUT, it did the trick!! Thank you! Thank you! Thank you!!!
Jim