Issue with libararies and compiling in Arduino IDE
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 14
- Joined: 13 Jan 2018, 11:51
Issue with libararies and compiling in Arduino IDE
I have no issue at all getting R120 and R147 to work on my Sonoff Th10, BUT with those I can't seem to parse event values via http to the Sonoff running R120 or R147, I spent half a day trying to find out why until eventually someone somewhere on some obscure forum said it only worked in the latest release.
So I obtain the latest release, but first it doesn't compile because the ESPEasy.ino is not in a folder called ESPeasy, I change folder src to ESPeasy it tried again, it then comes back with:
fatal error: AS_BH1750.h: No such file or directory
Turns out that the #include line for this file has been added where it did not exist before, so I removed it with // and then it did the same thing with another .h file, rinse/repeat for countless files until eventually I realised there were too many and gave up.
Even with a folder structure identical to R120 and R147 it STILL throws up this error!
What would be really helpful is if I could see where exactly the Arduino IDE is looking for these damn files........ Probably somebodies desktop half way across the planet????? (wouldn't be the first time).
Any ideas??????
-Update-
Copied lib folders to "esp8266\hardware\esp8266\2.3.0\libraries" something I didn't need to do with R120 or R147. It now finds those files.....
Next it's throwing up a "`.text’ will not fit in region `iram1_0_seg" Error
After some exhaustive searching I found a reference to modifying "eagle.app.v6.common.ld" to contain "*libstdc++.a:(.literal .text .literal.* .text.*)" at line 163
This ^^ did the trick, I can only assume that at some point everyone who's actually been able to compile this, has done this mod????
I guess i'll find out later, whether this will work after flashing it to my devices......
-Update-
The above fix mod to "eagle.app.v6.common.ld" no longer works, I get the same error, I have no explanation for this at all.
So I obtain the latest release, but first it doesn't compile because the ESPEasy.ino is not in a folder called ESPeasy, I change folder src to ESPeasy it tried again, it then comes back with:
fatal error: AS_BH1750.h: No such file or directory
Turns out that the #include line for this file has been added where it did not exist before, so I removed it with // and then it did the same thing with another .h file, rinse/repeat for countless files until eventually I realised there were too many and gave up.
Even with a folder structure identical to R120 and R147 it STILL throws up this error!
What would be really helpful is if I could see where exactly the Arduino IDE is looking for these damn files........ Probably somebodies desktop half way across the planet????? (wouldn't be the first time).
Any ideas??????
-Update-
Copied lib folders to "esp8266\hardware\esp8266\2.3.0\libraries" something I didn't need to do with R120 or R147. It now finds those files.....
Next it's throwing up a "`.text’ will not fit in region `iram1_0_seg" Error
After some exhaustive searching I found a reference to modifying "eagle.app.v6.common.ld" to contain "*libstdc++.a:(.literal .text .literal.* .text.*)" at line 163
This ^^ did the trick, I can only assume that at some point everyone who's actually been able to compile this, has done this mod????
I guess i'll find out later, whether this will work after flashing it to my devices......
-Update-
The above fix mod to "eagle.app.v6.common.ld" no longer works, I get the same error, I have no explanation for this at all.
Last edited by Strider336 on 13 Jan 2018, 13:31, edited 2 times in total.
Re: Issue with libararies and compiling in Arduino IDE
Hi. Folder ESPEasy (with all .ino files) must be in src
-
- Normal user
- Posts: 14
- Joined: 13 Jan 2018, 11:51
Re: Issue with libararies and compiling in Arduino IDE
Then why are all the files in the "src" folder? Somebodies idea of a joke?
Anyway, changing "src" to "ESPeasy" solves that little problem.
Still no idea why it couldn't find the libraries, made 2 copies of the folder, renamed one as "libraries" and the other as "lib", neither worked, put extra copies of those in the ESPeasy folder and still Arduino IDE was like "hahaha f**k off, I can't find the files and i'm not telling you why!!!"
Especially weird considering that R120 and R147 had no issue with this.
It'd be really nice if everyone was working from a standard platform, but then some random person puts in a line of code pointing at a file in a location unique to that individual and the whole thing falls over as soon as anyone else gets their hands on it.
On a positive note my frustrations with this are nothing compared to my various RPi projects, trying to get information out of the elitist Linux crowd is literally a classic blood/stone situation.
Anyway, changing "src" to "ESPeasy" solves that little problem.
Still no idea why it couldn't find the libraries, made 2 copies of the folder, renamed one as "libraries" and the other as "lib", neither worked, put extra copies of those in the ESPeasy folder and still Arduino IDE was like "hahaha f**k off, I can't find the files and i'm not telling you why!!!"
Especially weird considering that R120 and R147 had no issue with this.
It'd be really nice if everyone was working from a standard platform, but then some random person puts in a line of code pointing at a file in a location unique to that individual and the whole thing falls over as soon as anyone else gets their hands on it.
On a positive note my frustrations with this are nothing compared to my various RPi projects, trying to get information out of the elitist Linux crowd is literally a classic blood/stone situation.
-
- Normal user
- Posts: 14
- Joined: 13 Jan 2018, 11:51
Re: Issue with libararies and compiling in Arduino IDE
Ok, so I tried the very latest release and I don't even know where to start with that....
How the hell does a new release go from one or two errors to this shower of sh*t?
How the hell does a new release go from one or two errors to this shower of sh*t?
Command:570: error: variable or field 'printDirectory' declared void
void printDirectory(File dir, int numTabs) {
^
Command:570: error: 'File' was not declared in this scope
Command:570: error: expected primary-expression before 'int'
void printDirectory(File dir, int numTabs) {
^
Networking:414: error: variable or field 'SSDP_schema' declared void
void SSDP_schema(WiFiClient &client) {
^
Networking:414: error: 'WiFiClient' was not declared in this scope
Networking:414: error: 'client' was not declared in this scope
void SSDP_schema(WiFiClient &client) {
^
_N001_Email:113: error: 'WiFiClient' was not declared in this scope
boolean NPlugin_001_MTA(WiFiClient& client, String aStr, const String &aWaitForPattern)
^
_N001_Email:113: error: 'client' was not declared in this scope
boolean NPlugin_001_MTA(WiFiClient& client, String aStr, const String &aWaitForPattern)
^
_N001_Email:113: error: expected primary-expression before 'aStr'
boolean NPlugin_001_MTA(WiFiClient& client, String aStr, const String &aWaitForPattern)
^
_N001_Email:113: error: expected primary-expression before 'const'
boolean NPlugin_001_MTA(WiFiClient& client, String aStr, const String &aWaitForPattern)
^
_N001_Email:113: error: expression list treated as compound expression in initializer [-fpermissive]
boolean NPlugin_001_MTA(WiFiClient& client, String aStr, const String &aWaitForPattern)
^
C:\Projects\sonoff\ESPeasyFW2\Source\ESPeasy\Command.ino: In function 'bool safeReadStringUntil(Stream&, String&, char, unsigned int, unsigned int)':
Command:28: error: 'LOG_LEVEL_ERROR' was not declared in this scope
addLog(LOG_LEVEL_ERROR, F("Not enough bufferspace to read all input data!"));
^
Command:36: error: 'LOG_LEVEL_ERROR' was not declared in this scope
addLog(LOG_LEVEL_ERROR, F("Timeout while reading input data!"));
^
C:\Projects\sonoff\ESPeasyFW2\Source\ESPeasy\Command.ino: In function 'void ExecuteCommand(byte, const char*)':
Command error: 'Settings' was not declared in this scope
if (Settings.NotificationEnabled[Par1 - 1] && Settings.Notification[Par1 - 1] != 0)
^
Command:103: error: 'NPLUGIN_NOT_FOUND' was not declared in this scope
if (NotificationProtocolIndex!=NPLUGIN_NOT_FOUND)
^
Command:105: error: aggregate 'EventStruct TempEvent' has incomplete type and cannot be defined
struct EventStruct TempEvent;
^
Command:108: error: 'NPlugin_ptr' was not declared in this scope
NPlugin_ptr[NotificationProtocolIndex](NPLUGIN_NOTIFY, &TempEvent, message);
^
Command:108: error: 'NPLUGIN_NOTIFY' was not declared in this scope
NPlugin_ptr[NotificationProtocolIndex](NPLUGIN_NOTIFY, &TempEvent, message);
^
Command:117: error: 'RTC' was not declared in this scope
RTC.flashDayCounter = 0;
^
Command:134: error: 'File' was not declared in this scope
File root = SD.open("/");
^
Command:134: error: expected ';' before 'root'
File root = SD.open("/");
^
Command:135: error: 'root' was not declared in this scope
root.rewindDirectory();
^
Command:136: error: 'printDirectory' was not declared in this scope
printDirectory(root, 0);
^
Command:147: error: 'SD' was not declared in this scope
SD.remove((char*)fname.c_str());
^
Command:152: error: 'lowestRAM' was not declared in this scope
Serial.print(lowestRAM);
^
Command:154: error: 'lowestRAMfunction' was not declared in this scope
Serial.println(lowestRAMfunction);
^
Command:167: error: 'loopCounterLast' was not declared in this scope
Serial.print(100 - (100 * loopCounterLast / loopCounterMax));
^
Command:167: error: 'loopCounterMax' was not declared in this scope
Serial.print(100 - (100 * loopCounterLast / loopCounterMax));
^
Command:185: error: 'SecuritySettings' was not declared in this scope
Serial.println(sizeof(SecuritySettings));
^
Command:187: error: 'Settings' was not declared in this scope
Serial.println(sizeof(Settings));
^
Command:189: error: 'ExtraTaskSettings' was not declared in this scope
Serial.println(sizeof(ExtraTaskSettings));
^
Command:191: error: 'Device' was not declared in this scope
Serial.println(sizeof(Device));
^
Command:203: error: 'Wire' was not declared in this scope
Wire.beginTransmission(Par1); // address
^
Command:212: error: 'Wire' was not declared in this scope
Wire.beginTransmission(Par1); // address
^
Command:228: error: 'Settings' was not declared in this scope
Settings.Build = Par1;
^
Command:235: error: 'Settings' was not declared in this scope
Settings.deepSleep = 0;
^
Command:245: error: 'Wire' was not declared in this scope
Wire.beginTransmission(address);
^
Command:267: error: aggregate 'EventStruct TempEvent' has incomplete type and cannot be defined
struct EventStruct TempEvent;
^
Command:286: error: 'UserVar' was not declared in this scope
UserVar[(VARS_PER_TASK * (Par1 - 1)) + Par2 - 1] = result;
^
Command:286: error: 'VARS_PER_TASK' was not declared in this scope
UserVar[(VARS_PER_TASK * (Par1 - 1)) + Par2 - 1] = result;
^
Command:298: error: 'RULES_TIMER_MAX' was not declared in this scope
if (Par1>=1 && Par1<=RULES_TIMER_MAX)
^
Command:303: error: 'RulesTimer' was not declared in this scope
RulesTimer[Par1 - 1] = millis() + (1000 * Par2);
^
Command:306: error: 'RulesTimer' was not declared in this scope
RulesTimer[Par1 - 1] = 0L;
^
Command:310: error: 'LOG_LEVEL_ERROR' was not declared in this scope
addLog(LOG_LEVEL_ERROR, F("TIMER: invalid timer number"));
^
Command:324: error: 'Settings' was not declared in this scope
Settings.UseRules = true;
^
Command:326: error: 'Settings' was not declared in this scope
Settings.UseRules = false;
^
Command:335: error: 'Settings' was not declared in this scope
if (Settings.UseRules)
^
Command:351: error: 'WiFi' was not declared in this scope
if (strcasecmp_P(Command, PSTR("Publish")) == 0 && WiFi.status() == WL_CONNECTED)
^
Command:351: error: 'WL_CONNECTED' was not declared in this scope
if (strcasecmp_P(Command, PSTR("Publish")) == 0 && WiFi.status() == WL_CONNECTED)
^
Command:361: error: 'MQTTclient' was not declared in this scope
MQTTclient.publish(topic.c_str(), value.c_str(), Settings.MQTTRetainFlag);
^
Command:361: error: 'Settings' was not declared in this scope
MQTTclient.publish(topic.c_str(), value.c_str(), Settings.MQTTRetainFlag);
^
Command:365: error: 'WiFi' was not declared in this scope
if (strcasecmp_P(Command, PSTR("SendToUDP")) == 0 && WiFi.status() == WL_CONNECTED)
^
Command:365: error: 'WL_CONNECTED' was not declared in this scope
if (strcasecmp_P(Command, PSTR("SendToUDP")) == 0 && WiFi.status() == WL_CONNECTED)
^
Command:375: error: 'IPAddress' was not declared in this scope
IPAddress UDP_IP(ipaddress[0], ipaddress[1], ipaddress[2], ipaddress[3]);
^
Command:375: error: expected ';' before 'UDP_IP'
IPAddress UDP_IP(ipaddress[0], ipaddress[1], ipaddress[2], ipaddress[3]);
^
Command:376: error: 'portUDP' was not declared in this scope
portUDP.beginPacket(UDP_IP, port.toInt());
^
Command:376: error: 'UDP_IP' was not declared in this scope
portUDP.beginPacket(UDP_IP, port.toInt());
^
Command:381: error: 'WiFi' was not declared in this scope
if (strcasecmp_P(Command, PSTR("SendToHTTP")) == 0 && WiFi.status() == WL_CONNECTED)
^
Command:381: error: 'WL_CONNECTED' was not declared in this scope
if (strcasecmp_P(Command, PSTR("SendToHTTP")) == 0 && WiFi.status() == WL_CONNECTED)
^
Command:389: error: 'WiFiClient' was not declared in this scope
WiFiClient client;
^
Command:389: error: expected ';' before 'client'
WiFiClient client;
^
Command:390: error: 'client' was not declared in this scope
if (client.connect(host.c_str(), port.toInt()))
^
Command:407: error: 'LOG_LEVEL_DEBUG' was not declared in this scope
addLog(LOG_LEVEL_DEBUG, line);
^
Command:422: error: 'SecuritySettings' was not declared in this scope
strcpy(SecuritySettings.WifiSSID, Line + 9);
^
Command:428: error: 'SecuritySettings' was not declared in this scope
strcpy(SecuritySettings.WifiKey, Line + 8);
^
Command:434: error: 'SecuritySettings' was not declared in this scope
strcpy(SecuritySettings.WifiSSID2, Line + 10);
^
Command:440: error: 'SecuritySettings' was not declared in this scope
strcpy(SecuritySettings.WifiKey2, Line + 9);
^
Command:470: error: 'Settings' was not declared in this scope
Settings.Unit=Par1;
^
Command:476: error: 'Settings' was not declared in this scope
strcpy(Settings.Name, Line + 5);
^
Command:482: error: 'SecuritySettings' was not declared in this scope
strcpy(SecuritySettings.Password, Line + 9);
^
Command:503: error: 'WiFi' was not declared in this scope
WiFi.persistent(true); // use SDK storage of SSID/WPA parameters
^
Command:529: error: 'Settings' was not declared in this scope
Settings.SerialLogLevel = Par1;
^
Command:536: error: 'Settings' was not declared in this scope
if (!str2ip(TmpStr1, Settings.IP))
^
Command:547: error: 'IPAddress' was not declared in this scope
IPAddress ip = WiFi.localIP();
^
Command:547: error: expected ';' before 'ip'
IPAddress ip = WiFi.localIP();
^
Command:548: error: 'ip' was not declared in this scope
sprintf_P(str, PSTR("%u.%u.%u.%u"), ip[0], ip[1], ip[2], ip[3]);
^
Command:550: error: 'BUILD' was not declared in this scope
Serial.print(F(" Build : ")); Serial.println((int)BUILD);
^
Command:551: error: 'Settings' was not declared in this scope
Serial.print(F(" Name : ")); Serial.println(Settings.Name);
^
Command:553: error: 'SecuritySettings' was not declared in this scope
Serial.print(F(" WifiSSID : ")); Serial.println(SecuritySettings.WifiSSID);
^
C:\Projects\sonoff\ESPeasyFW2\Source\ESPeasy\Command.ino: At global scope:
Command:570: error: variable or field 'printDirectory' declared void
void printDirectory(File dir, int numTabs) {
^
Command:570: error: 'File' was not declared in this scope
Command:570: error: expected primary-expression before 'int'
void printDirectory(File dir, int numTabs) {
^
ESPEasy:4: error: expected declaration before end of line
#pragma GCC diagnostic warning "-Wall"
Re: Issue with libararies and compiling in Arduino IDE
NO! You can not just rename src to ESPeasy. You need this structure:
arduino/src/ESPEasy
Exactly written like the above! The ESP libraries go to arduino/libraries (NOT lib!)
".. was not declared .." is typical for that. Arduino can not find the include files...
arduino/src/ESPEasy
Exactly written like the above! The ESP libraries go to arduino/libraries (NOT lib!)
".. was not declared .." is typical for that. Arduino can not find the include files...
-
- Normal user
- Posts: 14
- Joined: 13 Jan 2018, 11:51
Re: Issue with libararies and compiling in Arduino IDE
Then why does the downloaded file have any folder structure at all?
Might as well just dump all the files in a single file folder, with a readme.txt saying "sort it out yourself, I can't be bothered".
When I allowed Arduino IDE to move ESPeasy.ino into it's own ESPeasy folder, the result was IDE complaining it couldn't find the other ino files, I figured that moving all the files was a bad idea and so renamed SRC to ESPeasy, as surely once you start messing with folders, nothing is going to be where it's expected to be?
What pisses me off, is the fact that previous releases work without messing with the folder structures. It's just makes zero sense...........
Last edited by Strider336 on 13 Jan 2018, 15:02, edited 1 time in total.
Re: Issue with libararies and compiling in Arduino IDE
That's why I help you. I had also to learn all that stuff for a year ago now. But with each step done it's less work!
-
- Normal user
- Posts: 14
- Joined: 13 Jan 2018, 11:51
Re: Issue with libararies and compiling in Arduino IDE
I do appreciate the help, i'm just moving across that line from frustration to anger right now........ If only Arduino IDE gave me some clue as to where it was expecting to find these files, the whole thing would be less painful.
What would be less work is if stuff was documented properly.
Ok so where is arduino/src supposed to be?
I've got:
C: \Users\%username%\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries
and
C: \Program Files (x86)\Arduino\libraries
and
C:\Users\%username%\Documents\Arduino\libraries
In fact lets start at the beginning, let's start with the obvious stuff that's not so f**king obvious, let's say I open this abortion of a zip file "ESPEasy_v2.0-20180113.zip"..... Where do I put the files? What should the folder structure look like?
Re: Issue with libararies and compiling in Arduino IDE
Ok, all .ino files in src (from the ZIP file) come into arduino/src/ESPEasy. The folders in lib (from the ZIP file) come into /arduino/libraries.
"C: \Users\%username%\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries" -> let it untouched.
"C: \Program Files (x86)\Arduino\libraries" -> place where Arduino store library files
That should work now. Hope there is no difference between Windows and Linux version of Arduino....
"C: \Users\%username%\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries" -> let it untouched.
"C: \Program Files (x86)\Arduino\libraries" -> place where Arduino store library files
That should work now. Hope there is no difference between Windows and Linux version of Arduino....
Who is online
Users browsing this forum: Google [Bot] and 11 guests