Thinger/Relay/DHT11 - Code Error

I’ve taken some working code from a Serial Print Temp/Humidity program that triggers a relay when out of temp range.

Getting an error I haven’t come across before?

In function ‘global constructors keyed to 65535_0_thinger_trial_testing_DHT11_v1.1.ino.cpp.o’:
lto1.exe: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.
lto-wrapper.exe: fatal error: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc returned 1 exit status
compilation terminated.
c:/program files/windowsapps/arduinollc.arduinoide_1.8.21.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/…/lib/gcc/avr/5.4.0/…/…/…/…/avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

Anyone shed some light on this? Thanks

#include <DHT.h>
#include <Ethernet.h>
#include <ThingerEthernet.h>

// dht config
#define DHTPIN 7
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
const int relay = 10; //sets relay to pin 10


// thinger.io config
ThingerEthernet thing("haggis77", "Arduino", "minibeast123");

void setup() {
  dht.begin();
  pinMode(relay, OUTPUT); //sets pin8 as relay output
  
  thing["Minibeast Woodies"] >> [](pson& out){
    out["Humidity"] = dht.readHumidity();
    out["Temperature"] = dht.readTemperature();
    };
}

void loop() {  
    thing.handle();

if(dht.readTemperature() < 16) digitalWrite(relay, HIGH);

if(dht.readTemperature() > 31) digitalWrite(relay, HIGH);

delay (10000);

digitalWrite(relay, LOW);//Reset Alarm Relay
}

This bug is specific to the 5.4.0-atmel3.6.1-arduino2 version of avr-gcc used by Arduino AVR Boards 1.6.22 and newer. It has been reported here:

Here's the traditional workaround:

  • Tools > Board > Boards Manager
  • Wait for downloads to finish.
  • When you move the mouse pointer over "Arduino AVR Boards", you will see a "Select version" dropdown menu appear. Select "1.6.21".
  • Click "Install".
  • Wait for installation to finish.
  • Click "Close".

If you have File > Preferences > Check for updates on startup checked, the Arduino IDE may occasionally notify you that a new version of Arduino AVR Boards is available, you'll need to refrain from updating back to the new Arduino AVR Boards version, otherwise you'll be back to seeing the segmentation fault error again.

Thank you, worked a treat :slight_smile:

You're welcome. I'm glad to hear it's working now. Enjoy!
Per